Repository: ldc-developers/ldc

Issue #2442: macOS binary releases should set shared stdlib install_name to relative path
Created: 2017-12-09T02:49:48Z
For the shared druntime/Phobos libraries to be used from a client program, the user currently needs to go through dynamic linker search path gymnastics or manually run install_name_tool after extracting a release tarball.
One way of doing this would be to set -install_name to @rpath/{druntime,phobos2}-ldc-shared.dylib on linking (or after the fact using install_name_tool), and telling users to set -rpath accordingly.
(Am I missing a more elegant way of doing this?)

Duplicate issue #2448: osx: otool -L libdruntime-ldc-shared.dylib reports garbage hardcoded paths
Created: 2017-12-11T05:14:20Z
we should
to reproduce:
download ldc2-1.7.0-beta1-osx-x86_64.tar.xz from https://github.com/ldc-developers/ldc/releases
gunzip ldc2-1.7.0-beta1-osx-x86_64.tar.xz
tar -xf ldc2-1.7.0-beta1-osx-x86_64.tar
otool -L ldc2-1.7.0-beta1-osx-x86_64/lib/libdruntime-ldc-shared.dylib
shows: /Users/distiller/ninja-ldc/lib64/libdruntime-ldc-shared.77.dylib
this hardcoded path varies from release to release also...
on another release it was: /tmp/build/work/ldc/lib64/libdruntime-ldc-shared.73.dylib
this creates issues when trying to use these releases (eg: dyld: Library not loaded: /Users/distiller/ninja-ldc/lib64/libphobos2-ldc-shared.77.dylib)
my workaround was:
cd $path_to_libphobos2-ldc-shared.dylib
install_name_tool -change /tmp/build/work/ldc/lib64/libdruntime-ldc-shared.73.dylib libdruntime-ldc-shared.dylib libphobos2-ldc-shared.dylib
install_name_tool -id libphobos2-ldc-shared.dylib libphobos2-ldc-shared.dylib
#etc

although i could'be also used install_name_tool -change /tmp/build/work/ldc/lib64/libdruntime-ldc-shared.73.dylib libdruntime-ldc-shared.dylib @rpath/libphobos2-ldc-shared.dylib
in any case, libphobos2-ldc-shared.dylib is better than hardcodedpath/libphobos2-ldc-shared.dylib
the build system that generates these should be fixed to remove those hardcoded paths; maybe also this could be applied to past ldc versions (if necessary, via point releases to avoid changing previously published tars)


NOTE: separate issue: is there a better way than running these 2 commands gunzip and tar -xf? on OSX double clicking on the downloaded ldc2-1.7.0-beta1-osx-x86_64.tar.xz doesn't expand the contents; it works fine for dmd.2.077.1.osx.zip from http://downloads.dlang.org/releases/2017/)


seems related to #2442

Closing comment (2017-12-11T09:47:51Z): This is indeed a duplicate of #2442. The idea is to use @rpath/libdruntime-ldc-shared.dylib for easy linking, but maybe it would be better to go for the plain library name?

the build system that generates these should be fixed to remove those hardcoded paths

That would be the default linker.

separate issue: is there a better way than running these 2 commands gunzip and tar -xf?

Just using tar xf on its own also works, "recent" versions of both bsdtar and gnutar auto-detect the compression. In the past, we offered .tar.gz tarballs as well, since .xz was used less widely, but they saw very few downloads. If one had serious trouble with extracting tarballs on the command line (where else are you going to use the compiler from?), I feel like a shiny .dmg/.pkg would be the what they were looking for, not a .zip archive.