Problem with hdf5 shared library binary installation on Mac OS

Hi,

The hdf5-1.8.6-macosx64-shared binary available at

http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz

contains hard-coded paths to a particular user's directory, presumably the developer who built the binary. This means that when you try to run an executable which is linked against this installation on your own machine, you get an error message. A workaround is to use the statically linked version which doesn't suffer from this problem.

Steps to reproduce:

wget http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz

tar xfz hdf5-1.8.6-macosx64-shared.tar.gz

cat >testhdf5.c
#include "hdf5.h"

int main()
{
  H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
  return 0;
}
^D

gcc -o testhdf5 -Ihdf5-1.8.6-macosx64-shared/include -lhdf5 -lsz -lz -Lhdf5-1.8.6-macosx64-shared/lib testhdf5.c

MacBook:hdf5bin ian$ ./testhdf5
dyld: Library not loaded: /Users/epourmal/Working/_tmp_shared/hdf5/lib/libhdf5.6.dylib
  Referenced from: /Users/ian/Projects/misc/hdf5bin/./testhdf5
  Reason: image not found
Trace/BPT trap

MacBook:hdf5bin ian$ grep "/Users" hdf5-1.8.6-macosx64-shared/lib/lib*.la
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'

Also, the h5cc script in the bin directory seems to use this user's home directory as a default location where it will look for HDF5, which probably isn't correct.

···

--
Ian Hinder
ian.hinder@aei.mpg.de

Perhaps when the HDF binaries are built they should be built somewhere like /Library/Frameworks/ or /Users/Shared/Library to avoid this type of runtime problem.

  For the end developer who is going to distribute an OS X Application with HDF5 support it is typical to embed the hdf5 library into the .app bundle then run "install_name_tool" to change that path to the proper @executable_path/../lib or something like that.

···

___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

On Mar 22, 2011, at 10:12 AM, Ian Hinder wrote:

Hi,

The hdf5-1.8.6-macosx64-shared binary available at

http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz

contains hard-coded paths to a particular user's directory, presumably the developer who built the binary. This means that when you try to run an executable which is linked against this installation on your own machine, you get an error message. A workaround is to use the statically linked version which doesn't suffer from this problem.

Steps to reproduce:

wget http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz

tar xfz hdf5-1.8.6-macosx64-shared.tar.gz

cat >testhdf5.c
#include "hdf5.h"

int main()
{
H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
return 0;
}
^D

gcc -o testhdf5 -Ihdf5-1.8.6-macosx64-shared/include -lhdf5 -lsz -lz -Lhdf5-1.8.6-macosx64-shared/lib testhdf5.c

MacBook:hdf5bin ian$ ./testhdf5
dyld: Library not loaded: /Users/epourmal/Working/_tmp_shared/hdf5/lib/libhdf5.6.dylib
Referenced from: /Users/ian/Projects/misc/hdf5bin/./testhdf5
Reason: image not found
Trace/BPT trap

MacBook:hdf5bin ian$ grep "/Users" hdf5-1.8.6-macosx64-shared/lib/lib*.la
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'

Also, the h5cc script in the bin directory seems to use this user's home directory as a default location where it will look for HDF5, which probably isn't correct.

--
Ian Hinder
ian.hinder@aei.mpg.de

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Mike and Ian,

Looks like my failure... Not sure how did it pass our internal binary testing ;-(

Thank you for reporting.

Elena

···

On Mar 22, 2011, at 11:07 AM, Michael Jackson wrote:

Perhaps when the HDF binaries are built they should be built somewhere like /Library/Frameworks/ or /Users/Shared/Library to avoid this type of runtime problem.

For the end developer who is going to distribute an OS X Application with HDF5 support it is typical to embed the hdf5 library into the .app bundle then run "install_name_tool" to change that path to the proper @executable_path/../lib or something like that.

___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

On Mar 22, 2011, at 10:12 AM, Ian Hinder wrote:

Hi,

The hdf5-1.8.6-macosx64-shared binary available at

http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz

contains hard-coded paths to a particular user's directory, presumably the developer who built the binary. This means that when you try to run an executable which is linked against this installation on your own machine, you get an error message. A workaround is to use the statically linked version which doesn't suffer from this problem.

Steps to reproduce:

wget http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64-shared.tar.gz

tar xfz hdf5-1.8.6-macosx64-shared.tar.gz

cat >testhdf5.c
#include "hdf5.h"

int main()
{
H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
return 0;
}
^D

gcc -o testhdf5 -Ihdf5-1.8.6-macosx64-shared/include -lhdf5 -lsz -lz -Lhdf5-1.8.6-macosx64-shared/lib testhdf5.c

MacBook:hdf5bin ian$ ./testhdf5
dyld: Library not loaded: /Users/epourmal/Working/_tmp_shared/hdf5/lib/libhdf5.6.dylib
Referenced from: /Users/ian/Projects/misc/hdf5bin/./testhdf5
Reason: image not found
Trace/BPT trap

MacBook:hdf5bin ian$ grep "/Users" hdf5-1.8.6-macosx64-shared/lib/lib*.la
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:dependency_libs=' -L/Users/epourmal/Working/lib/ZLIB-U/lib -L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:libdir='/Users/epourmal/Working/_tmp_shared/hdf5/lib'

Also, the h5cc script in the bin directory seems to use this user's home directory as a default location where it will look for HDF5, which probably isn't correct.

--
Ian Hinder
ian.hinder@aei.mpg.de

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

CMake actually has some facilities to package up libraries into a
framework suitable

for installing. I've never done it, but that might be the easiest way to
make an installable package of HDF5.

···

On 3/22/11 11:07 AM, "Michael Jackson" <mike.jackson@bluequartz.net> wrote:

Perhaps when the HDF binaries are built they should be built somewhere
like /Library/Frameworks/ or /Users/Shared/Library to avoid this type of
runtime problem.

For the end developer who is going to distribute an OS X Application
with HDF5 support it is typical to embed the hdf5 library into the .app
bundle then run "install_name_tool" to change that path to the proper
@executable_path/../lib or something like that.

___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

On Mar 22, 2011, at 10:12 AM, Ian Hinder wrote:

Hi,

The hdf5-1.8.6-macosx64-shared binary available at

http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64
-shared.tar.gz

contains hard-coded paths to a particular user's directory, presumably
the developer who built the binary. This means that when you try to run
an executable which is linked against this installation on your own
machine, you get an error message. A workaround is to use the
statically linked version which doesn't suffer from this problem.

Steps to reproduce:

wget
http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64
-shared.tar.gz

tar xfz hdf5-1.8.6-macosx64-shared.tar.gz

cat >testhdf5.c
#include "hdf5.h"

int main()
{
H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
return 0;
}
^D

gcc -o testhdf5 -Ihdf5-1.8.6-macosx64-shared/include -lhdf5 -lsz -lz
-Lhdf5-1.8.6-macosx64-shared/lib testhdf5.c

MacBook:hdf5bin ian$ ./testhdf5
dyld: Library not loaded:
/Users/epourmal/Working/_tmp_shared/hdf5/lib/libhdf5.6.dylib
Referenced from: /Users/ian/Projects/misc/hdf5bin/./testhdf5
Reason: image not found
Trace/BPT trap

MacBook:hdf5bin ian$ grep "/Users"
hdf5-1.8.6-macosx64-shared/lib/lib*.la
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:libdir='/Users/epourmal/Working
/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:libdir='/Users/epourmal/Wor
king/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:libdir='/Users/epourmal/Work
ing/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:libdir='/Users/epourmal/
Working/_tmp_shared/hdf5/lib'

Also, the h5cc script in the bin directory seems to use this user's
home directory as a default location where it will look for HDF5, which
probably isn't correct.

--
Ian Hinder
ian.hinder@aei.mpg.de

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
________________________________

Hello,

CMake actually has some facilities to package up libraries into a
framework suitable

for installing. I've never done it, but that might be the easiest way to
make an installable package of HDF5.

This is in the works for 1.8.7. Hopefully we will make it.

Elena

···

On Mar 22, 2011, at 11:18 AM, Williams, Norman K wrote:

On 3/22/11 11:07 AM, "Michael Jackson" <mike.jackson@bluequartz.net> wrote:

Perhaps when the HDF binaries are built they should be built somewhere
like /Library/Frameworks/ or /Users/Shared/Library to avoid this type of
runtime problem.

For the end developer who is going to distribute an OS X Application
with HDF5 support it is typical to embed the hdf5 library into the .app
bundle then run "install_name_tool" to change that path to the proper
@executable_path/../lib or something like that.

___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson@bluequartz.net
BlueQuartz Software Dayton, Ohio

On Mar 22, 2011, at 10:12 AM, Ian Hinder wrote:

Hi,

The hdf5-1.8.6-macosx64-shared binary available at

http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64
-shared.tar.gz

contains hard-coded paths to a particular user's directory, presumably
the developer who built the binary. This means that when you try to run
an executable which is linked against this installation on your own
machine, you get an error message. A workaround is to use the
statically linked version which doesn't suffer from this problem.

Steps to reproduce:

wget
http://www.hdfgroup.org/ftp/HDF5/current/bin/macosx64/hdf5-1.8.6-macosx64
-shared.tar.gz

tar xfz hdf5-1.8.6-macosx64-shared.tar.gz

cat >testhdf5.c
#include "hdf5.h"

int main()
{
H5Fcreate("test.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
return 0;
}
^D

gcc -o testhdf5 -Ihdf5-1.8.6-macosx64-shared/include -lhdf5 -lsz -lz
-Lhdf5-1.8.6-macosx64-shared/lib testhdf5.c

MacBook:hdf5bin ian$ ./testhdf5
dyld: Library not loaded:
/Users/epourmal/Working/_tmp_shared/hdf5/lib/libhdf5.6.dylib
Referenced from: /Users/ian/Projects/misc/hdf5bin/./testhdf5
Reason: image not found
Trace/BPT trap

MacBook:hdf5bin ian$ grep "/Users"
hdf5-1.8.6-macosx64-shared/lib/lib*.la
hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5.la:libdir='/Users/epourmal/Working
/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5_cpp.la:libdir='/Users/epourmal/Wor
king/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl.la:libdir='/Users/epourmal/Work
ing/_tmp_shared/hdf5/lib'
hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:dependency_libs='
-L/Users/epourmal/Working/lib/ZLIB-U/lib
-L/Users/epourmal/Working/lib/SZIP-U/lib -lz -lm'

hdf5-1.8.6-macosx64-shared/lib/libhdf5_hl_cpp.la:libdir='/Users/epourmal/
Working/_tmp_shared/hdf5/lib'

Also, the h5cc script in the bin directory seems to use this user's
home directory as a default location where it will look for HDF5, which
probably isn't correct.

--
Ian Hinder
ian.hinder@aei.mpg.de

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
________________________________

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Thanks.

···

On 23 Mar 2011, at 04:47, Elena Pourmal wrote:

Hello,
On Mar 22, 2011, at 11:18 AM, Williams, Norman K wrote:

CMake actually has some facilities to package up libraries into a
framework suitable

for installing. I've never done it, but that might be the easiest way to
make an installable package of HDF5.

This is in the works for 1.8.7. Hopefully we will make it.

--
Ian Hinder
ian.hinder@aei.mpg.de