Opened 5 years ago

Closed 5 years ago

#5503 closed defect (fixed)

Symbols not found and linker command failed errors during CLI build on MacOS

Reported by: coldphoenix Owned by:
Priority: Should Have Milestone: Alpha 24
Component: Build & Packages Keywords:
Cc: historic_bruno, coldphoenix Patch:

Description (last modified by coldphoenix)

Hey, folks. First time giving this build a shot, and while following the Build Instructions for Personal Use on macOS, the build fails and I get the following errors when building pyrogenisis (after executing "make -j3"):

==== Building pyrogenesis (release) ====
Creating obj/pyrogenesis_Release
main.cpp
Linking pyrogenesis
Undefined symbols for architecture x86_64:
  "_libintl_bindtextdomain", referenced from:
      __gnutls_global_init in libgnutls.a(global.o)
  "_libintl_dgettext", referenced from:
      _gnutls_certificate_verification_status_print in libgnutls.a(cert-cred.o)
      _gnutls_strerror in libgnutls.a(errors.o)
      __gnutls_ocsp_verify_status_to_str in libgnutls.a(ocsp.o)
      _gnutls_alert_get_name in libgnutls.a(alert.o)
      _gnutls_x509_crt_print in libgnutls.a(output.o)
      _print_oneline in libgnutls.a(output.o)
      _print_cert in libgnutls.a(output.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]: *** [../../../binaries/system/pyrogenesis] Error 1
make: *** [pyrogenesis] Error 2

This is just the trailing end snippet from the output.

What I'm using:

  • Xcode CLI tools: 10.2.1.0.1.1554506761
  • Xcode: 10.2.1
  • Python: 2.7.10
  • cmake: 3.15.0-rc4
  • Mac OS: Mojave (10.14.5)
  • MacBook Pro (Retina, 13-inch, Mid 2014), 3GHz i7 processor, 16GB RAM

I'm building from: https://svn.wildfiregames.com/public/ps/trunk/ Current revision: 22464

Any advice is appreciated. Let me know if any more info is needed.

Attachments (1)

config.log.zip (85.9 KB ) - added by coldphoenix 5 years ago.
config.log for gnutls

Download all attachments as: .zip

Change History (13)

comment:1 by coldphoenix, 5 years ago

Description: modified (diff)

comment:2 by historic_bruno, 5 years ago

Thanks for the report! Can you attach the config.log for gnutls? It should be in libraries/osx/gnutls/gnutls-3.6.8/config.log

by coldphoenix, 5 years ago

Attachment: config.log.zip added

config.log for gnutls

in reply to:  2 comment:3 by coldphoenix, 5 years ago

Replying to historic_bruno:

Thanks for the report! Can you attach the config.log for gnutls? It should be in libraries/osx/gnutls/gnutls-3.6.8/config.log

Thanks for helping with this historic_bruno. I've compressed and attached the log file. The only modification I've made to the file is to replace the username in path references to <<<user>>>.

One additional note: After I encountered the failed build with the Personal Use package, I did successfully build the distributable app bundle using the CLI on Mac.

comment:4 by historic_bruno, 5 years ago

That tells us exactly what we need to know:

configure:61141: checking for gettext in -lintl
configure:61166: clang -o conftest  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden   -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch x86_64 -stdlib=libc++ -Wl,-no_weak_imports conftest.c -lintl   >&5
configure:61166: $? = 0
configure:61175: result: yes

It's detecting libintl in the Xcode SDK. The problem is if you're doing the "personal use" build, you shouldn't be using the SDK. The necessary build options aren't enabled, causing the linker error. This doesn't happen on my build system, because GnuTLS config does this:

configure:61166: clang -o conftest -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -mmacosx-version-min=10.9 -arch x86_64 -stdlib=libc++ -Wl,-no_weak_imports conftest.c -lintl >&5
ld: library not found for -lintl

So either GnuTLS is doing something it shouldn't on your system, or you have the SDK build enabled by accident (SYSROOT). Can you provide the results of running the env command? (feel free to remove any personal info there, like your username)

Have you modified build-osx-libs.sh somehow?

Last edited 5 years ago by historic_bruno (previous) (diff)

in reply to:  4 comment:5 by coldphoenix, 5 years ago

Replying to historic_bruno:

That tells us exactly what we need to know:

configure:61141: checking for gettext in -lintl
configure:61166: clang -o conftest  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden   -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch x86_64 -stdlib=libc++ -Wl,-no_weak_imports conftest.c -lintl   >&5
configure:61166: $? = 0
configure:61175: result: yes

It's detecting libintl in the Xcode SDK. The problem is if you're doing the "personal use" build, you shouldn't be using the SDK. The necessary build options aren't enabled, causing the linker error. This doesn't happen on my build system, because GnuTLS config does this:

configure:61166: clang -o conftest -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -mmacosx-version-min=10.9 -arch x86_64 -stdlib=libc++ -Wl,-no_weak_imports conftest.c -lintl >&5
ld: library not found for -lintl

So either GnuTLS is doing something it shouldn't on your system, or you have the SDK build enabled by accident (SYSROOT). Can you provide the results of running the env command? (feel free to remove any personal info there, like your username)

Have you modified build-osx-libs.sh somehow?

Thanks again for looking in to this historic_bruno.

Here's the env output (let me know if this is what you meant):

TERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
SHELL=/bin/bash
CLICOLOR=1
TMPDIR=/var/folders/rr/tvk_z2f14510pwpt81489h8h0000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.aUowWjVKW5/Render
TERM_PROGRAM_VERSION=421.2
TERM_SESSION_ID=A1A0BD1A-90DE-4757-A825-B1B6ED8C3E0F
USER=<<<username>>>
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.xaoes5yYyh/Listeners
LSCOLORS=ExFxBxDxCxegedabagacad
PATH=~/.composer/vendor/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/.composer/vendor/bin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
PWD=/Users/<<<username>>>/Documents/svnrepos/0ad/build/workspaces
LANG=en_AU.UTF-8
XPC_FLAGS=0x0
PS1=\[\]\[\]\t \[\][\[\]\u\[\] in \[\]\W\[\]]\[\]\$ \[\]
XPC_SERVICE_NAME=0
HOME=/Users/<<<username>>>
SHLVL=1
LOGNAME=<<<username>>>
DISPLAY=/private/tmp/com.apple.launchd.JfcJKikOcy/org.macosforge.xquartz:0
SECURITYSESSIONID=186a8
_=/usr/bin/env

I haven't modified build-osx-libs.sh (or any other files, just yet). I've just cottoned on to 0ad, and this was the first time downloading and building from the instructions.

comment:6 by historic_bruno, 5 years ago

One option would be to disable Native Language Support (--disable-nls) for GnuTLS. I know we already do that for libiconv. I don't really like this because the game is translated to other languages, it would be nice if the libraries used those languages too. That should be left for another (low priority) task IMO.

comment:7 by historic_bruno, 5 years ago

(From config.log) the invocation of GnuTLS configure shows it was run with sysroot flags:

./configure CFLAGS= -isysroot /Applications/Xcode.app/Contents/Developer/Platforms
/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch x86_64
 -fvisibility=hidden CXXFLAGS= -isysroot /Applications/Xcode.app/Contents/Developer
/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch
 x86_64 -fvisibility=hidden -stdlib=libc++ -std=c++0x LDFLAGS= -Wl,-
syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.9 -arch x86_64 -stdlib=libc++ LIBS=-L/Users
/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/gmp/lib -lgmp NETTLE_CFLAGS=-I/Users
/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/nettle/include NETTLE_LIBS=-L/Users
/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/nettle/lib -lnettle HOGWEED_CFLAGS=-
I/Users/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/nettle/include HOGWEED_LIBS=-
L/Users/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/nettle/lib -lhogweed GMP_CFLAGS=-
I/Users/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/gmp/include GMP_LIBS=-L/Users
/<<<user>>>/Documents/svnrepos/0ad/libraries/osx/gmp/lib -lgmp --prefix=/Users/<<<user>>>
/Documents/svnrepos/0ad/libraries/osx/gnutls --enable-shared=no --without-idn --with-
included-unistring --with-included-libtasn1 --without-p11-kit --disable-tests

That shouldn't happen unless build-osx-bundle.sh was used or SYSROOT was set somehow (Note: exported vars only last for that Terminal session, so if you closed the window before running env, it would be lost).

comment:8 by historic_bruno, 5 years ago

In 22494:

Disables GnuTLS Native Language Support in build-osx-libs.sh, refs #5503

comment:9 by historic_bruno, 5 years ago

Hi, please try latest SVN and rebuild GnuTLS, then the game per instructions. From within the libraries/osx/ folder, you would type:

rm gnutls/.already-built
./build-osx-libs.sh

It should no longer link to libintl/gettext, and GnuTLS config.log should have this line:

configure:11841: checking whether NLS is requested
configure:11850: result: no

comment:10 by coldphoenix, 5 years ago

That seems to have worked! Thanks historic_bruno. I updated to the latest from svn , and went through your steps up to:

rm gnutls/.already-built
./build-osx-libs.sh

but had to clear the original build folders as I hit this error:

==== Building atlas (release) ====
ActorViewer.cpp
Brushes.cpp
GameLoop.cpp
fatal error: file '/Users/<<<username>>>/Documents/svnrepos/0ad/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-release/mozilla/Compiler.h' has been modified since the precompiled header
      'obj/atlas_Release/precompiled.h.gch' was built
note: please rebuild precompiled header 'obj/atlas_Release/precompiled.h.gch'
fatal error: file '/Users/<<<username>>>/Documents/svnrepos/0ad/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-release/mozilla/Compiler.h' has been modified since the precompiled header
      'obj/atlas_Release/precompiled.h.gch' was built
note: please rebuild precompiled header 'obj/atlas_Release/precompiled.h.gch'
fatal error: file '/Users/<<<username>>>/Documents/svnrepos/0ad/build/workspaces/gcc/../../../libraries/source/spidermonkey/include-unix-release/mozilla/Compiler.h' has been modified since the precompiled header
      'obj/atlas_Release/precompiled.h.gch' was built
note: please rebuild precompiled header 'obj/atlas_Release/precompiled.h.gch'
1 error generated.
make[1]: *** [obj/atlas_Release/Brushes.o] Error 1
make[1]: *** Waiting for unfinished jobs....
1 error generated.
make[1]: *** [obj/atlas_Release/ActorViewer.o] Error 1
1 error generated.
make[1]: *** [obj/atlas_Release/GameLoop.o] Error 1
make: *** [atlas] Error 2

So, after starting form scratch, and rebuilding per the instructions with the latest code, the game now loads. I also did try running binaries/system/test per the instructions, and looks like there's a funky error:

$ ./test
Running cxxtest tests (322 tests).....................................................................................................................................................................................
In TestCStr::test_parse:
/Users/<<<username>>>/Documents/svnrepos/0ad/source/ps/tests/test_CStr.h:135: Error: Expected (str3.ToFloat() == 3.0f), found (0.0000 != 3.0000)
/Users/<<<username>>>/Documents/svnrepos/0ad/source/ps/tests/test_CStr.h:136: Error: Expected (str3.ToDouble() == 3.0), found (0.0000 != 3.0000)
............................................................................................................................................
Failed 1 and Skipped 0 of 322 tests
Success rate: 99%

Will try and have a bit more of a play with this build over the weekend.

Thanks for the support to get this up and running!!

comment:11 by elexis, 5 years ago

#2780 for the test failure.

comment:12 by historic_bruno, 5 years ago

Milestone: BacklogAlpha 24
Resolution: fixed
Status: newclosed

Great! I'm glad it's working for you now :)

Note: See TracTickets for help on using tickets.