On 2013-03-30, at 17:59, Greg Troxel <[email protected]> wrote: > Sverre Froyen <[email protected]> writes: > >> Manually linking npfctl using the above statement, substituting >> >> -Wl,-rpath,/lib >> with >> >> -Wl,-rpath,/usr/src/obj.amd64/destdir.amd64/lib >> >> and then restarting the build, allows the build to complete. A grep of >> the build output shows that the "-Wl,-rpath,/lib" path occurs about >> 200 times, however. That does not seem right. > > That seems messed up. The -L argument should point to where the > libraries are *now*, and -rpath to where they will be in the installed > system.
I suppose the --sysroot argument should have forced the use of the correct arguments. I ktrace'd the link step and discovered that the i386 build reads /lib/libcrypt.so too but the immediately reads version in /usr/src/obj.i386/destdir.i386/lib. Presumably because the linker realize it's not the correct version. The amd64 build, on the other hand, appears happy with the /lib version and skips the /usr/src/obj.amd64/destdir.amd64/lib version. Removing /lib/libcrypt.so "fixes" the problem. This seems like a bug in the build system. Here is the output of gcc -v for the command that produces the error. I added some blank lines for readability. # /usr/src/tooldir/bin/x86_64--netbsd-gcc -v --sysroot=/usr/src/obj.amd64/destdir.amd64 -o npfctl npfctl.o npf_var.o npf_data.o npf_ncgen.o npf_build.o npf_extmod.o npf_disassemble.o npf_scan.o npf_parse.o -lnpf -lprop -lcrypto -lutil -ly -Wl,-dynamic-linker=/libexec/ld.elf_so -Wl,-rpath,/lib -L=/lib Using built-in specs. COLLECT_GCC=/usr/src/tooldir/bin/x86_64--netbsd-gcc COLLECT_LTO_WRAPPER=/usr/src/tooldir/libexec/gcc/x86_64--netbsd/4.5.3/lto-wrapper Target: x86_64--netbsd Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=x86_64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20111202' --with-system-zlib --enable-__cxa_atexit --with-tune=nocona --with-mpc=/usr/src/tooldir --with-mpfr=/usr/src/tooldir --with-gmp=/usr/src/tooldir --disable-nls --enable-multilib --program-transform-name=s,^,x86_64--netbsd-, --enable-languages='c c++ objc' --prefix=/usr/src/tooldir Thread model: posix gcc version 4.5.3 (NetBSD nb2 20111202) COMPILER_PATH=/usr/src/tooldir/libexec/gcc/x86_64--netbsd/4.5.3/:/usr/src/tooldir/libexec/gcc/x86_64--netbsd/4.5.3/:/usr/src/tooldir/libexec/gcc/x86_64--netbsd/:/usr/src/tooldir/lib/gcc/x86_64--netbsd/4.5.3/:/usr/src/tooldir/lib/gcc/x86_64--netbsd/:/usr/src/tooldir/lib/gcc/x86_64--netbsd/4.5.3/../../../../x86_64--netbsd/bin/ LIBRARY_PATH=/usr/src/tooldir/lib/gcc/x86_64--netbsd/4.5.3/:/usr/src/tooldir/lib/gcc/x86_64--netbsd/4.5.3/../../../../x86_64--netbsd/lib/:/usr/src/obj.amd64/destdir.amd64/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-o' 'npfctl' '-L=/lib' '-mtune=nocona' '-march=x86-64' /usr/src/tooldir/libexec/gcc/x86_64--netbsd/4.5.3/collect2 --sysroot=/usr/src/obj.amd64/destdir.amd64 --eh-frame-hdr -dc -dp -e _start -dynamic-linker /usr/libexec/ld.elf_so -o npfctl /usr/src/obj.amd64/destdir.amd64/usr/lib/crt0.o /usr/src/obj.amd64/destdir.amd64/usr/lib/crti.o /usr/src/obj.amd64/destdir.amd64/usr/lib/crtbegin.o -L=/lib -L/usr/src/tooldir/lib/gcc/x86_64--netbsd/4.5.3 -L/usr/src/tooldir/lib/gcc/x86_64--netbsd/4.5.3/../../../../x86_64--netbsd/lib -L/usr/src/obj.amd64/destdir.amd64/usr/lib npfctl.o npf_var.o npf_data.o npf_ncgen.o npf_build.o npf_extmod.o npf_disassemble.o npf_scan.o npf_parse.o -lnpf -lprop -lcrypto -lutil -ly -dynamic-linker=/libexec/ld.elf_so -rpath /lib -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/src/obj.amd64/destdir.amd64/usr/lib/crtend.o /usr/src/obj.amd64/destdir.amd64/usr/lib/crtn.o /lib/libcrypt.so.1: undefined reference to `__explicit_bzero' collect2: ld returned 1 exit status Anything else that I should look for? Regards, Sverre
