PetarKirov / dlang.nix

Nix expressions for building D compilers
MIT License
6 stars 1 forks source link

Dub coming with ldc-binary-1.34 doesn't find curl, reason unclear. #69

Open dukc opened 2 months ago

dukc commented 2 months ago

DUB can't access the Internet to download packages. Strace says it isn't searching the curl path when trying to do so:

# ...
openat(AT_FDCWD, "/nix/store/1q6qwq8csbhyy0pv54sab00jxlmb3rw2-gcc-12.3.0-libgcc/lib/libcurl-gnutls.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/gqghjch4p1s69sv4mcjksb2kb65rwqjy-glibc-2.38-23/lib/libcurl-gnutls.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/sdhmm56jv7r449hf7f57cl3pvnsy3cbg-xgcc-12.3.0-libgcc/lib/libcurl-gnutls.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/1q6qwq8csbhyy0pv54sab00jxlmb3rw2-gcc-12.3.0-libgcc/lib/libcurl-nss.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/gqghjch4p1s69sv4mcjksb2kb65rwqjy-glibc-2.38-23/lib/libcurl-nss.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/nix/store/sdhmm56jv7r449hf7f57cl3pvnsy3cbg-xgcc-12.3.0-libgcc/lib/libcurl-nss.so.4", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
# and so on...

I figured out it doesn't do this because it's trying to open curl at runtime, so that Autopatchelf at pkgs/ldc/binary.nix can't figure out it'll do so. So I went ahead and added runtimeDependencies = [curl]; and rebuilt my LDC binary derivation. Both patchelf and objdump confirm that RPATH now correctly includes Curl.

But for some reason. this does not fix the issue nor change what strace prints. ltrace confirms that dlopen is being used, so it can't be some custom library searching either. I'm confused.

PetarKirov commented 2 months ago

Thanks for detailed analysis @dukc! I recall encountering the same (or at least very similar issue) with our Dub derivation. I didn't debug the issue, but what you're saying makes sense to me.