-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
Describe the bug
When having external code (e.g. in Hydra) using WorkerProto::Serialise<StorePathSet>
(which is required when trying to build Hydra against Nix 2.17), the build fails with the following errors when using a Nix with --enable-lto
set:
hydra-0.1.20230804.DIRTY> /nix/store/7q1b1bsmxi91zci6g8714rcljl620y7f-bash-5.2-p15/bin/bash ../../libtool --tag=CXX --mode=link g++ -std=c++2a -I/nix/store/2wc8v442wwy4zqcnwr1l62v1vp9da2sq-nix-2.17.0-dev/include/nix -I/nix/store/ksqbb3np13si616y71y1bbxyyhqcm0pr-boehm-gc-8.2.2-dev/include -Wall -I ../libhydra -Wno-deprecated-declarations -g -O2 -include nix/config.h -o hydra-queue-runner hydra_queue_runner-hydra-queue-runner.o hydra_queue_runner-queue-monitor.o hydra_queue_runner-dispatcher.o hydra_queue_runner-builder.o hydra_queue_runner-build-result.o hydra_queue_runner-build-remote.o hydra_queue_runner-nar-extractor.o -L/nix/store/11vbrp5bsvh31ddb8vxl82ryyb1rqq2z-nix-2.17.0/lib -L/nix/store/3a9r1dwgnszi7x9vybsx8y8mhhl8s0n0-boehm-gc-8.2.2/lib -lnixmain -lnixexpr -lgc -lpthread -ldl -lnixstore -lnixutil -lpqxx -lprometheus-cpp-pull -lprometheus-cpp-core
hydra-0.1.20230804.DIRTY> libtool: link: g++ -std=c++2a -I/nix/store/2wc8v442wwy4zqcnwr1l62v1vp9da2sq-nix-2.17.0-dev/include/nix -I/nix/store/ksqbb3np13si616y71y1bbxyyhqcm0pr-boehm-gc-8.2.2-dev/include -Wall -I ../libhydra -Wno-deprecated-declarations -g -O2 -include nix/config.h -o hydra-queue-runner hydra_queue_runner-hydra-queue-runner.o hydra_queue_runner-queue-monitor.o hydra_queue_runner-dispatcher.o hydra_queue_runner-builder.o hydra_queue_runner-build-result.o hydra_queue_runner-build-remote.o hydra_queue_runner-nar-extractor.o -L/nix/store/11vbrp5bsvh31ddb8vxl82ryyb1rqq2z-nix-2.17.0/lib -L/nix/store/3a9r1dwgnszi7x9vybsx8y8mhhl8s0n0-boehm-gc-8.2.2/lib -lnixmain -lnixexpr /nix/store/3a9r1dwgnszi7x9vybsx8y8mhhl8s0n0-boehm-gc-8.2.2/lib/libgc.so -lpthread -ldl -lnixstore -lnixutil /nix/store/cwjk8rvgpvi8dd3ga76a4z0wca2s5vlg-libpqxx-7.7.0/lib/libpqxx.so -lprometheus-cpp-pull -lprometheus-cpp-core -Wl,-rpath -Wl,/nix/store/3a9r1dwgnszi7x9vybsx8y8mhhl8s0n0-boehm-gc-8.2.2/lib -Wl,-rpath -Wl,/nix/store/cwjk8rvgpvi8dd3ga76a4z0wca2s5vlg-libpqxx-7.7.0/lib -Wl,-rpath -Wl,/nix/store/3a9r1dwgnszi7x9vybsx8y8mhhl8s0n0-boehm-gc-8.2.2/lib -Wl,-rpath -Wl,/nix/store/cwjk8rvgpvi8dd3ga76a4z0wca2s5vlg-libpqxx-7.7.0/lib
hydra-0.1.20230804.DIRTY> /nix/store/dx8hynidprz3kf4ngcjipnwaxp6h229f-binutils-2.40/bin/ld: hydra_queue_runner-build-remote.o: in function `void nix::WorkerProto::write<std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > >(nix::Store const&, nix::WorkerProto::WriteConn, std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > const&)':
hydra-0.1.20230804.DIRTY> /nix/store/2wc8v442wwy4zqcnwr1l62v1vp9da2sq-nix-2.17.0-dev/include/nix/worker-protocol.hh:112: undefined reference to `nix::WorkerProto::Serialise<std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > >::write(nix::Store const&, nix::WorkerProto::WriteConn, std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > const&)'
hydra-0.1.20230804.DIRTY> /nix/store/dx8hynidprz3kf4ngcjipnwaxp6h229f-binutils-2.40/bin/ld: hydra_queue_runner-build-remote.o: in function `State::buildRemote(nix::ref<nix::Store>, std::shared_ptr<Machine>, std::shared_ptr<Step>, unsigned int, unsigned int, unsigned int, RemoteResult&, std::shared_ptr<State::ActiveStep>, std::function<void (StepState)>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, NarMemberData, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, NarMemberData> > >&)':
hydra-0.1.20230804.DIRTY> /build/source/src/hydra-queue-runner/build-remote.cc:127: undefined reference to `nix::WorkerProto::Serialise<std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > >::read(nix::Store const&, nix::WorkerProto::ReadConn)'
hydra-0.1.20230804.DIRTY> /nix/store/dx8hynidprz3kf4ngcjipnwaxp6h229f-binutils-2.40/bin/ld: /build/source/src/hydra-queue-runner/build-remote.cc:375: undefined reference to `nix::WorkerProto::Serialise<std::map<nix::DrvOutput, nix::Realisation, std::less<nix::DrvOutput>, std::allocator<std::pair<nix::DrvOutput const, nix::Realisation> > > >::read(nix::Store const&, nix::WorkerProto::ReadConn)'
hydra-0.1.20230804.DIRTY> /nix/store/dx8hynidprz3kf4ngcjipnwaxp6h229f-binutils-2.40/bin/ld: hydra_queue_runner-build-remote.o: in function `void nix::WorkerProto::write<std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > >(nix::Store const&, nix::WorkerProto::WriteConn, std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > const&)':
hydra-0.1.20230804.DIRTY> /nix/store/2wc8v442wwy4zqcnwr1l62v1vp9da2sq-nix-2.17.0-dev/include/nix/worker-protocol.hh:112: undefined reference to `nix::WorkerProto::Serialise<std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > >::write(nix::Store const&, nix::WorkerProto::WriteConn, std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > const&)'
hydra-0.1.20230804.DIRTY> /nix/store/dx8hynidprz3kf4ngcjipnwaxp6h229f-binutils-2.40/bin/ld: hydra_queue_runner-build-remote.o: in function `State::buildRemote(nix::ref<nix::Store>, std::shared_ptr<Machine>, std::shared_ptr<Step>, unsigned int, unsigned int, unsigned int, RemoteResult&, std::shared_ptr<State::ActiveStep>, std::function<void (StepState)>, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, NarMemberData, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, NarMemberData> > >&)':
hydra-0.1.20230804.DIRTY> /build/source/src/hydra-queue-runner/build-remote.cc:458: undefined reference to `nix::WorkerProto::Serialise<std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > >::read(nix::Store const&, nix::WorkerProto::ReadConn)'
hydra-0.1.20230804.DIRTY> collect2: error: ld returned 1 exit status
hydra-0.1.20230804.DIRTY> make[3]: *** [Makefile:435: hydra-queue-runner] Error 1
hydra-0.1.20230804.DIRTY> make[3]: Leaving directory '/build/source/src/hydra-queue-runner'
hydra-0.1.20230804.DIRTY> make[2]: *** [Makefile:363: all-recursive] Error 1
hydra-0.1.20230804.DIRTY> make[2]: Leaving directory '/build/source/src'
hydra-0.1.20230804.DIRTY> make[1]: *** [Makefile:422: all-recursive] Error 1
hydra-0.1.20230804.DIRTY> make[1]: Leaving directory '/build/source'
hydra-0.1.20230804.DIRTY> make: *** [Makefile:350: all] Error 2
The linking works fine if --enable-lto
is not used for Nix. This is the case when
- using the
nix
-package defined in the overlay of this repository - removing
--enable-lto
frompkgs.nixVersions.nix_2_17
'sconfigureFlags
in nixpkgs (or an overlay).
Steps To Reproduce
A reproducer involving Hydra (with 2.17 support) is provided at NixOS/hydra#1296 (comment).
Expected behavior
Even with --enable-lto
set, the linking shouldn't fail.
nix-env (Nix) 2.17.0
Additional context
See above for the link to the Hydra PR where this issue was observed.
Priorities
Add 👍 to issues you find important.