Question

I am trying to compile boost C++ using clang.

./b2 --prefix=~/boost --includedir=~/boost/include --libdir=~/boost/lib toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -isystem ~/libcxx/include/" linkflags="-stdlib=libc++ -L ~/libcxx/lib/"

When I see log file it gives error saying

 Undefined symbols for architecture x86_64:
 "boost::system::system_category()", referenced from:
  __GLOBAL__I_a in exceptions.o
 "boost::system::generic_category()", referenced from:
  __GLOBAL__I_a in exceptions.o
  ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see invocation)

my default clang is clang-mp-3.3. Can anyone please help me figure out what this problem is.

Was it helpful?

Solution

After searching for the reason of error in the web I found this which explain about compiling boost with clang. I am not sure why adding define=BOOST_SYSTEM_NO_DEPRECATED made it worked. Please do comment anyone who knows why it worked. I was then able to compile with no error but I still see some warnings but it worked for me for now.

The default clang I am using is (clang-mp-3.3)

$ clang -v

clang version 3.3 (tags/RELEASE_33/final) Target: x86_64-apple-darwin11.4.2 Thread model: posix

 ./bootstrap.sh --with-toolset=clang --without-libraries=mpi,python,graph_parallel
 ./b2 clean
 ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++"  linkflags="-stdlib=libc++"  define=BOOST_SYSTEM_NO_DEPRECATED
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top