Skip to content
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

mk: prefert inplace library paths to system ones (take 2) #6060

Merged
merged 1 commit into from
Feb 8, 2022
Merged

mk: prefert inplace library paths to system ones (take 2) #6060

merged 1 commit into from
Feb 8, 2022

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Feb 7, 2022

It's a second attempt to merge the change. Previous attempt
was reverted in b976b34.
Since then underlying failure exposed by original change was
fixed by #5354.

Below goes description of original change:

The link failure happens on a system with stable nix-2.3.15
installed in /usr/lib64 (it's libutil.so API differs from master):

LANG=C make V=1
g++ -o /home/slyfox/dev/git/nix/src/libstore/libnixstore.so \
    -shared -L/usr/lib64 -Wl,--no-copy-dt-needed-entries \
    src/libstore/binary-cache-store.o ... src/libstore/uds-remote-store.o \
    -lsqlite3 -lcurl -lsodium -pthread -ldl -lseccomp -Wl,-z,defs -Wl,-soname=libnixstore.so
      -Wl,-rpath,/home/slyfox/dev/git/nix/src/libutil -Lsrc/libutil -lnixutil
ld: src/libstore/binary-cache-store.o: in function `nix::BinaryCacheStore::BinaryCacheStore(
    std::map<std::__cxx11::basic_string<char, std::char_traits<char>, ...
nix/src/libstore/binary-cache-store.cc:30: undefined reference to `nix::readFile(
    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ...
...

This happens due to -L/usr/lib64 -Lsrc/libutil search path ordering.
The change turns it into -Lsrc/libutil -L/usr/lib64.

Closes: #3087

It's a second attempt to merge the change. Previous attempt
was reverted in b976b34.
Since then underlying failure exposed by original change was
fixed by #5354.

Below goes description of original change:

The link failure happens on a system with stable nix-2.3.15
installed in /usr/lib64 (it's libutil.so API differs from master):

```
LANG=C make V=1
g++ -o /home/slyfox/dev/git/nix/src/libstore/libnixstore.so \
    -shared -L/usr/lib64 -Wl,--no-copy-dt-needed-entries \
    src/libstore/binary-cache-store.o ... src/libstore/uds-remote-store.o \
    -lsqlite3 -lcurl -lsodium -pthread -ldl -lseccomp -Wl,-z,defs -Wl,-soname=libnixstore.so
      -Wl,-rpath,/home/slyfox/dev/git/nix/src/libutil -Lsrc/libutil -lnixutil
ld: src/libstore/binary-cache-store.o: in function `nix::BinaryCacheStore::BinaryCacheStore(
    std::map<std::__cxx11::basic_string<char, std::char_traits<char>, ...
nix/src/libstore/binary-cache-store.cc:30: undefined reference to `nix::readFile(
    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' ...
...
```

This happens due to `-L/usr/lib64 -Lsrc/libutil` search path ordering.
The change turns it into `-Lsrc/libutil -L/usr/lib64`.

Closes: #3087
@edolstra edolstra merged commit 0b3d8e1 into NixOS:master Feb 8, 2022
@trofi trofi deleted the prefer-inplace-libs branch February 8, 2022 21:17
@edolstra
Copy link
Member

edolstra commented Feb 9, 2022

Unfortunately this still breaks the static jobs, see https://hydra.nixos.org/eval/1742942.

@trofi
Copy link
Contributor Author

trofi commented Feb 9, 2022

Let's revert: #6067. Will have a detailed look at it this evening.

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