Undefined symbols "std::ios_base::Init::Init()" on macOS

153 views
Skip to first unread message

nalzok

unread,
Feb 20, 2020, 3:33:18 PM2/20/20
to fix8 support
Hi there,

I got an error when trying to build Fix8 on macOS 10.14. Basically, the commands I used are the following two lines (I'm using fish shell, whose syntax is probably a little different from bash/zsh, but you get the idea)

env CC="clang" CXX="clang++" LDFLAGS="-L/opt/local/lib/db48" CPPFLAGS="-I/opt/local/include/db48" CXXFLAGS="-v" ./configure --enable-bdb=yes --with-poco=/opt/local
make -j4

The error I got is (scroll all the way down the attached error log file make.out to find it)

/bin/sh ../libtool  --tag=CXX   --mode=link clang++  -v -std=c++11 -Wall -lfix8 -lPocoFoundation -lPocoNet -lPocoUtil  -L../runtime   -ldb_cxx    -lz -L/opt/local/lib/db48 -L/opt/local/lib -o f8c f8c.o f8cutils.o f8precomp.o precomp.o  -ldb  -lstdc++ -lm
libtool: link: clang++ -v -std=c++11 -Wall -o .libs/f8c f8c.o f8cutils.o f8precomp.o precomp.o -Wl,-bind_at_load  /Users/nalzok/Developer/fix8-1.4.1/runtime/.libs/libfix8.dylib -L/opt/local/lib/db48 -L/opt/local/lib -lpthread -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -ldb_cxx -lz -ldb -lstdc++ -lm
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.14.0 -o .libs/f8c -L/opt/local/lib/db48 -L/opt/local/lib -L../runtime f8c.o f8cutils.o f8precomp.o precomp.o -bind_at_load /Users/nalzok/Developer/fix8-1.4.1/runtime/.libs/libfix8.dylib -lpthread -lPocoFoundation -lPocoNet -lPocoUtil -ldb_cxx -lz -ldb -lc++ -lm -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "std::ios_base::Init::Init()", referenced from:
      __GLOBAL__sub_I_precomp.cpp in precomp.o
  "std::ios_base::Init::~Init()", referenced from:
      __GLOBAL__sub_I_precomp.cpp in precomp.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[2]: *** [f8c] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Attached is the log files in their entirety. Can someone take a look and help me out? Thanks!


Bests,
Qingyao
configure.out
make.out

Ian McKane

unread,
Feb 20, 2020, 4:32:04 PM2/20/20
to fix8 support
Something wrong with your environment and or linker line. This std::ios is from libstdc++
There are plenty of examples of this issue on the net:



/Ian

nalzok

unread,
Feb 20, 2020, 6:03:31 PM2/20/20
to fix8 support
Hi, lan. Thanks for the advice. I have tried the linked solutions, but none works. To be more specific, the commands I used are

env CC="clang" CXX="clang++" LDFLAGS="-L/opt/local/lib/db48" CPPFLAGS="-I/opt/local/include/db48" CXXFLAGS="-stdlib=libc++ -lstdc++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" ./configure --enable-bdb=yes --with-poco=/opt/local
make -j8

The error message is identical, i.e.

/bin/sh ../libtool  --tag=CXX   --mode=link clang++  -stdlib=libc++ -lstdc++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -Wall -lfix8 -lPocoFoundation -lPocoNet -lPocoUtil  -L../runtime   -ldb_cxx    -lz -L/opt/local/lib/db48 -L/opt/local/lib -o f8c f8c.o f8cutils.o f8precomp.o precomp.o  -ldb  -lstdc++ -lm
libtool: link: clang++ -stdlib=libc++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -std=c++11 -Wall -o .libs/f8c f8c.o f8cutils.o f8precomp.o precomp.o -Wl,-bind_at_load  /Users/nalzok/Developer/fix8-1.4.1/runtime/.libs/libfix8.dylib -L/opt/local/lib/db48 -L/opt/local/lib -lpthread -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -ldb_cxx -lz -ldb -lstdc++ -lm

Undefined symbols for architecture x86_64:
  "std::ios_base::Init::Init()", referenced from:
      __GLOBAL__sub_I_precomp.cpp in precomp.o
  "std::ios_base::Init::~Init()", referenced from:
      __GLOBAL__sub_I_precomp.cpp in precomp.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[2]: *** [f8c] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

In fact, you can see clang++ is used as the linker in the error messages, so I think there exist other issues.

Ian McKane

unread,
Feb 20, 2020, 6:08:27 PM2/20/20
to fix8 support
No the problem is with your build env. The linker is telling you that there is an unresolved symbol. It can't get any clearer than that. You might try changing the order of the libraries, or trying to hunt down the symbol itself.
/Ian

On Friday, February 21, 2020 at 7:33:18 AM UTC+11, nalzok wrote:
Reply all
Reply to author
Forward
0 new messages