Skip to content

OSX: C shared library linked as relative #4183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
domenkozar opened this issue Dec 20, 2016 · 4 comments
Closed

OSX: C shared library linked as relative #4183

domenkozar opened this issue Dec 20, 2016 · 4 comments

Comments

@domenkozar
Copy link
Collaborator

I'm building https://github.com/serokell/rocksdb-haskell/ with just Nix and also with Stack (+Nix). Both fail to build even when rocksdb lib forder is passed correctly:

configureFlags: --verbose --prefix=/nix/store/8mlm6x003sj8781qf688qx031yjysa83-rocksdb-0.1.0 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --with-gcc=clang --package-db=/private/var/folders/v0/ydgx93x96375ws14_16p93gr0000gq/T/nix-build-rocksdb-0.1.0.
drv-1/package.conf.d --ghc-option=-optl=-Wl,-headerpad_max_install_names --disable-split-objs --enable-library-profiling --disable-profiling --enable-shared --enable-library-vanilla --enable-executable-dynamic --enable-tests --extra-include-dirs=/nix/sto
re/mj95pj47pjjmxgdzzfp2357zsylw9m3s-rocksdb-4.13/include --extra-lib-dirs=/nix/store/mj95pj47pjjmxgdzzfp2357zsylw9m3s-rocksdb-4.13/lib

Build fails as:

dyld: Library not loaded: librocksdb.4.13.dylib
  Referenced from: /private/var/folders/v0/ydgx93x96375ws14_16p93gr0000gq/T/nix-build-rocksdb-0.1.0.drv-1/rocksdb-haskell-0a5bced/dist/build/Database/RocksDB/C_hsc_make
  Reason: image not found
running dist/build/Database/RocksDB/C_hsc_make failed (exit code -5)
command was: dist/build/Database/RocksDB/C_hsc_make  >dist/build/Database/RocksDB/C.hs
note: keeping build directory _/private/var/folders/v0/ydgx93x96375ws14_16p93gr0000gq/T/nix-build-rocksdb-0.1.0.drv-1_

This is a masked error, really it doesn't find rocksdb library because it's not linked as absolute path:

$ $(which otool) -L /private/var/folders/v0/ydgx93x96375ws14_16p93gr0000gq/T/nix-build-rocksdb-0.1.0.drv-1/rocksdb-haskell-0a5bced/dist/build/Database/RocksDB/C_hsc_make                                                 
/private/var/folders/v0/ydgx93x96375ws14_16p93gr0000gq/T/nix-build-rocksdb-0.1.0.drv-1/rocksdb-haskell-0a5bced/dist/build/Database/RocksDB/C_hsc_make:
        librocksdb.4.13.dylib (compatibility version 0.0.0, current version 0.0.0)
        /nix/store/wngzdrk0b53q24b5infy1g2j4d5mh1mx-libiconv-osx-10.11.6/lib/libiconv.dylib (compatibility version 7.0.0, current version 7.0.0)
        /nix/store/f0m22bm6x14fq68jxnzw2w9dca83jfk7-gmp-6.1.1/lib/libgmp.10.dylib (compatibility version 14.0.0, current version 14.1.0)
        /nix/store/qsq0qzfi0dib713a83adz70scf5m3z1a-Libsystem-osx-10.11.6/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

Following work around works that sets the path back to absolute:

LnL7/nixpkgs@6edec59

@LnL7
Copy link

LnL7 commented Dec 20, 2016

/participate

@Ericson2314
Copy link
Collaborator

Might this relate to relocatable builds?

@LnL7
Copy link

LnL7 commented Dec 21, 2016

Possibly, is there some way to disable that? I'm also not sure how this would work outside of nix.

@domenkozar
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants