10.13 ntp build failure (undefined symbols)
Joshua Root
jmr at macports.org
Tue Oct 3 20:26:07 UTC 2017
On 2017-10-4 03:37 , Daniel J. Luke wrote:
> Currently ntp builds on 10.13 fail with:
>
> % make
> /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
> CCLD ntptime
> Undefined symbols for architecture x86_64:
> "_lib_nextbuf", referenced from:
> _common_prettydate in libntp.a(prettydate.o)
> "_lib_stringbuf", referenced from:
> _common_prettydate in libntp.a(prettydate.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[1]: *** [ntptime] Error 1
> make: *** [all] Error 2
>
> The libtool invocation is actually:
>
> ../libtool --silent --tag=CC --mode=link cc -Wall -Wcast-align -Wcast-qual -Wmissing-prototypes -Wpointer-arith -Wshadow -Winit-self -Wstrict-overflow -D_P1003_1B_VISIBLE -Wstrict-prototypes -g -O2 -L/opt/local/lib -o ntptime ntptime.o ../libntp/libntp.a -lresolv -intl
>
> What's confusing to me is that libntp.a includes those symbols:
>
> % nm -AU ../libntp/libntp.a | grep _lib_nextbuf
> ../libntp/libntp.a:lib_strbuf.o: 0000000000000004 C _lib_nextbuf
> % nm -AU ../libntp/libntp.a | grep _lib_stringbuf
> ../libntp/libntp.a:lib_strbuf.o: 0000000000000800 C _lib_stringbuf
>
> I'm clearly missing something - but I'm not sure what it is. Any thoughts?
Apparently Apple's linker doesn't recognise common symbols in static
libraries as being defined. Workaround would be to initialise the
variables somewhere or use -fno-common. Ideally don't use common linkage
at all, have one file that each global actually lives in and have all
other declarations be extern.
- Josh
More information about the macports-dev
mailing list