Boost logo

Boost :

Subject: [boost] [1.61.0] building with Clang and c++11
From: Richard Hadsell (hadsell_at_[hidden])
Date: 2016-06-30 16:32:15


I have downloaded 1.61.0 and want to build it with Clang. This is in my user-config:

using clang : 3.5.0 : /netDISKS/master/netmt/LINUX_C65/app/clang/3.5.0/bin/clang++ : <compileflags>"-fPIC -gcc-toolchain /netDISKS/master/netmt/LINUX_C65/app/gcc/4.8.3 -Wno-overloaded-virtual -Wno-unused-function -Wno-unused-variable -Wno-c99-extensions -Wno-variadic-macros" <linkflags>"-fPIC -gcc-toolchain /netDISKS/master/netmt/LINUX_C65/app/gcc/4.8.3" ;

When I build, I see warnings like these:

./boost/mpl/print.hpp:50:19: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
     const int m_x = 1 / (sizeof(T) - sizeof(T));
                   ^
./boost/timer/timer.hpp:44:43: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
     void clear() { wall = user = system = 0LL; }
                                           ^
./boost/regex/v4/instances.hpp:124:34: warning: unknown warning group '-Wkeyword-macro', ignored [-Wunknown-pragmas]
#pragma clang diagnostic ignored "-Wkeyword-macro"
                                  ^

When I add '-std=c++11' to the <compileflags> and <linkflags>, I get errors and warnings like these:

clang-linux.compile.c.without-pth bin.v2/libs/container/build/clang-linux-3.5.0/release/instruction-set-core2/link-static/threading-multi/alloc_lib.o
error: invalid argument '-std=c++11' not allowed with 'C/ObjC'

   "/netDISKS/master/netmt/LINUX_C65/app/clang/3.5.0/bin/clang++" -c -x c -O3 -Wno-inline -Wall -std=c++11 -fPIC -gcc-toolchain /netDISKS/master/netmt/LINUX_C65/app/gcc/4.8.3 -Wno-overloaded-virtual -Wno-unused-function -Wno-unused-variable -Wno-c99-extensions -Wno-variadic-macros -march=core2 -pthread -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTAINER_STATIC_LINK=1 -DNDEBUG -I"." -c -o "bin.v2/libs/container/build/clang-linux-3.5.0/release/instruction-set-core2/link-static/threading-multi/alloc_lib.o" "libs/container/src/alloc_lib.c"

libs/locale/src/shared/localization_backend.cpp:54:22: warning: 'auto_ptr' is deprecated [-Wdeprecated-declarations]
                 std::auto_ptr<localization_backend> res(new actual_backend(backends,default_backends_));
                      ^

./boost/regex/v4/instances.hpp:124:34: warning: unknown warning group '-Wkeyword-macro', ignored [-Wunknown-pragmas]
#pragma clang diagnostic ignored "-Wkeyword-macro"
                                  ^

What options do I need to add or remove to build and use boost with no errors and as few warnings as possible?

-- 
Dick Hadsell			203-992-6320  Fax: 203-992-6001
Reply-to:			hadsell_at_[hidden]
Blue Sky Studios                http://www.blueskystudios.com
1 American Lane, Greenwich, CT 06831-2560

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk