On the other hand I managed to build tools/gcc with the latest FreeBSD Clang (including even static-linking with a bit of manual help running nbgmake again in the build directory because for some reason it wasn't running the right commands when run from build.sh + nbmake) Tools continued to build until: link mandoc/mandoc ld: error: duplicate symbol: strcasecmp >>> defined at strcasecmp.c:61 (/more/work/woods/m-NetBSD-current/tools/compat/../../common/lib/libc/string/strcasecmp.c:61) >>> strcasecmp.lo:(strcasecmp) in archive /build/woods/fezzik/current-amd64-amd64-tools/lib/libnbcompat.a >>> defined at strcasecmp.c:60 (/usr/src/lib/libc/string/strcasecmp.c:60) >>> strcasecmp.o:(.text+0x110) in archive /usr/lib/libc.a ld: error: duplicate symbol: strncasecmp >>> defined at strncasecmp.c:61 (/more/work/woods/m-NetBSD-current/tools/compat/../../common/lib/libc/string/strncasecmp.c:61) >>> strncasecmp.lo:(strncasecmp) in archive /build/woods/fezzik/current-amd64-amd64-tools/lib/libnbcompat.a >>> defined at strcasecmp.c:85 (/usr/src/lib/libc/string/strcasecmp.c:85) >>> strcasecmp.o:(.text+0x2A0) in archive /usr/lib/libc.a cc: error: linker command failed with exit code 1 (use -v to see invocation) --- mandoc --- *** [mandoc] Error code 1 nbmake[7]: stopped in /more/work/woods/m-NetBSD-current/tools/mandoc 1 error This is because I'm static-linking, of course, and I'm guessing libnbcompat should not include strcasecmp() and strncasecmp() on FreeBSD. There's a real bug underlying here though, hidden from anyone not doing static linking. The problem is likely that on FreeBSD there is just one .o file in libc.a containing both strcasecmp() and strncasecmp(), as well as strcasecmp_l() and strncasecmp_l(), so if anything else that's needed from libc.a also needs str[n]casecmp_l() it will cause the linker to have to bring in libc.a's strcasecmp.o thus causing the conflict. Now as to why str[n]casecmp() end up in libnbcompat.a, well I guess that's the puzzle. Here are the mentions from the config.log: $ fgrep -i strcasecmp config.log configure:5309: checking for strcasecmp conftest.c:186:6: warning: incompatible redeclaration of library function 'strcasecmp' [-Wincompatible-library-redeclaration] char strcasecmp (); conftest.c:186:6: note: 'strcasecmp' is a builtin with type 'int (const char *, const char *)' | #define HAVE_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_STRCASECMP 1 configure:5399: checking whether strcasecmp is declared | #define HAVE_STRCASECMP 1 | #define HAVE_DECL_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_DECL_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_DECL_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_DECL_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_DECL_STRCASECMP 1 | #define HAVE_STRCASECMP 1 | #define HAVE_DECL_STRCASECMP 1 ac_cv_func_strcasecmp=yes ac_cv_have_decl_strcasecmp=yes #define HAVE_STRCASECMP 1 #define HAVE_DECL_STRCASECMP 1 Looking at tools/compat/Makefile I'm not seeing anything obvious that will use the configure choices to avoid including unnecessary objects in the final library, and I must say I'm very surprised by this omission! -- Greg A. Woods <gwoods%acm.org@localhost> Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost> Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgpZ3fzS3NcXm.pgp
Description: OpenPGP Digital Signature