I'm working through a Solaris compile and link. Solaris is a good platform to test on because it often highlights areas where GCC and glibc run a bit fast and loose. With the fixes from Issue 103436 (https://bugs.freedesktop.org/show_bug.cgi?id=103436) in place, link is failing at: libtool: link: gcc -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath -Wl,/usr/local/lib64 -o p11-kit/.libs/p11-kit p11-kit/lists.o p11-kit/p11-kit.o -L/usr/local/lib64 ./.libs/libp11-kit.so -lffi ./.libs/libp11-tool.a ./.libs/libp11-common.a -lintl -ldl -lpthread -R/usr/local/lib64 libtool: link: rm -f .libs/mock-four.so.exp Undefined first referenced symbol in file __xnet_socketpair ./.libs/libp11-kit.so **************************************** Here's the same link problem with more context: libtool: link: ( cd ".libs" && rm -f "mock-two.la" && ln -s "../mock-two.la" "mock-two.la" ) /bin/sh ./libtool --tag=CC --mode=link gcc -DP11_KIT_FUTURE_UNSTABLE_API -I/usr/local/include -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64 -o trust/trust trust/trust_trust-anchor.o trust/trust_trust-parser.o trust/trust_trust-persist.o trust/trust_trust-digest.o trust/trust_trust-enumerate.o trust/trust_trust-extract.o trust/trust_trust-extract-jks.o trust/trust_trust-extract-openssl.o trust/trust_trust-extract-pem.o trust/trust_trust-extract-cer.o trust/trust_trust-list.o trust/trust_trust-save.o trust/trust_trust-trust.o libtrust-data.la libp11-kit.la libp11-common.la libp11-tool.la -L/usr/local/lib64 -ltasn1 -lintl -ldl -lpthread libtool: link: echo "local: *; };" >> .libs/mock-four.so.exp libtool: link: gcc -shared -fPIC -DPIC -Wl,-z -Wl,text -Wl,-M -Wl,.libs/mock-four.so.exp -Wl,-h -Wl,mock-four.so -o .libs/mock-four.so p11-kit/.libs/mock-module-ep.o -Wl,-z -Wl,allextract ./.libs/libp11-test.a ./.libs/libp11-common.a -Wl,-z -Wl,defaultextract -L/usr/local/lib64 -lintl -ldl -lpthread -m64 -march=native -m64 -Wl,-rpath -Wl,/usr/local/lib64 libtool: link: ( cd ".libs" && rm -f "mock-three.la" && ln -s "../mock-three.la" "mock-three.la" ) /bin/sh ./libtool --tag=CC --mode=link gcc -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64 -o test-tests common/test-tests.o libp11-test.la libp11-common.la -lintl -ldl -lpthread libtool: link: gcc -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath -Wl,/usr/local/lib64 -o p11-kit/.libs/p11-kit p11-kit/lists.o p11-kit/p11-kit.o -L/usr/local/lib64 ./.libs/libp11-kit.so -lffi ./.libs/libp11-tool.a ./.libs/libp11-common.a -lintl -ldl -lpthread -R/usr/local/lib64 libtool: link: rm -f .libs/mock-four.so.exp Undefined first referenced symbol in file __xnet_socketpair ./.libs/libp11-kit.so ld: fatal: symbol referencing errors collect2: error: ld returned 1 exit status gmake[2]: *** [p11-kit/p11-kit] Error 1 gmake[2]: *** Waiting for unfinished jobs.... libtool: link: ( cd ".libs" && rm -f "mock-four.la" && ln -s "../mock-four.la" "mock-four.la" ) libtool: link: gcc -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath -Wl,/usr/local/lib64 -o test-tests common/test-tests.o -L/usr/local/lib64 ./.libs/libp11-test.a ./.libs/libp11-common.a -lintl -ldl -lpthread libtool: link: gcc -DP11_KIT_FUTURE_UNSTABLE_API -I/usr/local/include -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return -Wno-missing-format-attribute -fno-strict-aliasing -fno-common -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath -Wl,/usr/local/lib64 -o trust/.libs/trust trust/trust_trust-anchor.o trust/trust_trust-parser.o trust/trust_trust-persist.o trust/trust_trust-digest.o trust/trust_trust-enumerate.o trust/trust_trust-extract.o trust/trust_trust-extract-jks.o trust/trust_trust-extract-openssl.o trust/trust_trust-extract-pem.o trust/trust_trust-extract-cer.o trust/trust_trust-list.o trust/trust_trust-save.o trust/trust_trust-trust.o -L/usr/local/lib64 ./.libs/libtrust-data.a ./.libs/libp11-kit.so -lffi ./.libs/libp11-common.a ./.libs/libp11-tool.a /usr/local/lib64/libtasn1.so -lintl -ldl -lpthread -R/usr/local/lib64 Undefined first referenced symbol in file __xnet_socketpair ./.libs/libp11-kit.so ld: fatal: symbol referencing errors collect2: error: ld returned 1 exit status gmake[2]: *** [trust/trust] Error 1 gmake[2]: Leaving directory `/export/home/Build-Scripts/p11-kit-0.23.2' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/export/home/Build-Scripts/p11-kit-0.23.2' gmake: *** [all] Error 2
(In reply to Jeffrey Walton from comment #0) > I'm working through a Solaris compile and link. Solaris is a good platform > to test on because it often highlights areas where GCC and glibc run a bit > fast and loose. > ... > > libtool: link: gcc -m64 -march=native -fPIC -g -Wall -Wstrict-prototypes > -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith > -Wdeclaration-after-statement -Wformat=2 -Winit-self -Waggregate-return > -Wno-missing-format-attribute -fno-strict-aliasing -fno-common > -Wmissing-include-dirs -Wundef -m64 -Wl,-rpath -Wl,/usr/local/lib64 -o > p11-kit/.libs/p11-kit p11-kit/lists.o p11-kit/p11-kit.o -L/usr/local/lib64 > ./.libs/libp11-kit.so -lffi ./.libs/libp11-tool.a ./.libs/libp11-common.a > -lintl -ldl -lpthread -R/usr/local/lib64 > libtool: link: rm -f .libs/mock-four.so.exp > Undefined first referenced > symbol in file > __xnet_socketpair ./.libs/libp11-kit.so It looks like LDFLAGS was missing -lsocket -lnsl. My script to drive things looks like so. The OPT_* arrays are what you would expect from a Bash shell script. if [[ "$IS_SOLARIS" -ne "0" ]]; then OPT_CPPFLAGS+=("-D_XOPEN_SOURCE=500") OPT_LDFLAGS=("-lsocket -lnsl ${OPT_LDFLAGS[@]}") fi PKG_CONFIG_PATH="${OPT_PKGCONFIG[*]}" \ CPPFLAGS="${OPT_CPPFLAGS[*]}" \ CFLAGS="${OPT_CFLAGS[*]}" \ CXXFLAGS="${OPT_CXXFLAGS[*]}" \ LDFLAGS="${OPT_LDFLAGS[*]}" \ LIBS="${OPT_LIBS[*]}" \ ./configure "${P11KIT_CONFIG_OPTIONS[@]}" # On Solaris the script puts /usr/gnu/bin on-path, so we get a useful grep if [[ "$IS_SOLARIS" -ne "0" ]]; then for file in $(grep -IR '#define _XOPEN_SOURCE' "$PWD" | cut -f 1 -d ':' | sort | uniq); do echo "Fixing $file" sed -i '/#define _XOPEN_SOURCE/d' "$file" done fi The script is available at https://github.com/noloader/Build-Scripts/blob/master/build-p11kit.sh .
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.