Nikita Karetnikov <[email protected]> skribis:
> I've tried to compile and run the following simple program:
Oh, this is actually Perl’s configure speaking, not you.
> #include <stdio.h>
> int main() { printf("Ok\n"); return(0); }
>
> I used the command:
>
> gcc -o try -O2 -fno-strict-aliasing -pipe -fstack-protector
> -I/nix/store/zcfiac107h1nji9sdiv2m1dzpvvagrh5-glibc-2.13/include
> -fstack-protector
> -L/nix/store/zcfiac107h1nji9sdiv2m1dzpvvagrh5-glibc-2.13/lib try.c -lnsl
> -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
> ./try
>
> and I got the following output:
>
> /nix/store/g8b8alrsy6fw1g4r6jkycpy291w2403a-binutils-2.21.1a/bin/ld: cannot
> find -lgdbm
> /nix/store/g8b8alrsy6fw1g4r6jkycpy291w2403a-binutils-2.21.1a/bin/ld: cannot
> find -ldb
> collect2: ld returned 1 exit status
> I can't compile the test program.
> (The supplied flags or libraries might be incorrect.)
>
> You have a BIG problem. Shall I abort Configure [y]
> Ok. Stopping Configure.
> phase `configure' failed after 19 seconds
(The above shows that this is Perl as built by Guix, not Nixpkgs.)
Wild guess: you’re building outside of a chroot, and Perl’s configure
found /usr/lib/libgdbm.so, so it decided to link against it, which
didn’t work because our linker doesn’t look for libraries there.
Can you confirm?
Solution: add “build-use-chroot = true” in nix.conf.
Ludo’.