configuring the clang toolset

I'm trying to get bjam and clang to play nice. I have Ubuntu linux running in an VM with boost trunk and the llvm+clang sources also from svn. I've built clang as described here: <http://clang.llvm.org/get_started.html>. I added the following line to my user-config.jam: using clang : : /home/eric/build/Debug+Asserts/bin/clang++ ; Now when I try to build, say, the Foreach tests, I get: In file included from cstr_byref.cpp:11: In file included from ../../../boost/test/minimal.hpp:37: In file included from ../../../boost/test/impl/execution_monitor.ipp:170: In file included from /usr/include/errno.h:36: In file included from /usr/include/bits/errno.h:25: /usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found #include <asm/errno.h> ^ 1 error generated. "/home/eric/build/Debug+Asserts/bin/clang++" -c -x c++ -O0 -g -fno-inline -Wall -g -fPIC -DBOOST_ALL_NO_LIB=1 -I"../../.." -o "../../../bin.v2/libs/foreach/test/cstr_byref.test/clang-linux-3.0/debug/cstr_byref.o" "cstr_byref.cpp" What have I done wrong? -- Eric Niebler BoostPro Computing http://www.boostpro.com

Hi Eric, On Saturday, 24. September 2011 01:45:06 Eric Niebler wrote:
. I've built clang as described here: <http://clang.llvm.org/get_started.html>. I added the following line to my user-config.jam:
using clang : : /home/eric/build/Debug+Asserts/bin/clang++ ;
looks fine.
Now when I try to build, say, the Foreach tests, I get:
In file included from cstr_byref.cpp:11: In file included from ../../../boost/test/minimal.hpp:37: In file included from ../../../boost/test/impl/execution_monitor.ipp:170: In file included from /usr/include/errno.h:36: In file included from /usr/include/bits/errno.h:25: /usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found #include <asm/errno.h>
Clang and gcc and includes. A never ending story ;-)) I use: # Clang trunk using clang : # version 3.0 : # compiler $(HOME)/local/bin/clang++ : # options <cxxflags>-fPIC <cxxflags>-Wno-mismatched-tags <cxxflags>-Wno-unused-variable # Workaround <cxxflags>-I/usr/include/x86_64-linux-gnu ; The main workaround is -I/usr/include/x86_64-linux-gnu where I have /usr/include/x86_64-linux-gnu/asm/errno.h You might want to file a bug report with clang. Yours, Jürgen -- Dipl.-Math. Jürgen Hunold | IVE mbH Software-Entwickler | Lützerodestraße 10 Tel: +49 511 897668 33 | 30161 Hannover, Germany Fax: +49 511 897668 29 | http://www.ivembh.de juergen.hunold@ivembh.de | | Geschäftsführer: Sitz des Unternehmens: Hannover | Univ.-Prof. Dr.-Ing. Thomas Siefer Amtsgericht Hannover, HRB 56965 | PD Dr.-Ing. Alfons Radtke

On 9/24/2011 2:19 AM, Jürgen Hunold wrote:
Hi Eric,
On Saturday, 24. September 2011 01:45:06 Eric Niebler wrote:
. I've built clang as described here: <http://clang.llvm.org/get_started.html>. I added the following line to my user-config.jam:
using clang : : /home/eric/build/Debug+Asserts/bin/clang++ ;
looks fine.
Now when I try to build, say, the Foreach tests, I get:
In file included from cstr_byref.cpp:11: In file included from ../../../boost/test/minimal.hpp:37: In file included from ../../../boost/test/impl/execution_monitor.ipp:170: In file included from /usr/include/errno.h:36: In file included from /usr/include/bits/errno.h:25: /usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found #include <asm/errno.h>
Clang and gcc and includes. A never ending story ;-))
Well, it's better than clang on Windows or clang on cygwin. :-P
I use:
# Clang trunk using clang : # version 3.0 : # compiler $(HOME)/local/bin/clang++ : # options <cxxflags>-fPIC <cxxflags>-Wno-mismatched-tags <cxxflags>-Wno-unused-variable # Workaround <cxxflags>-I/usr/include/x86_64-linux-gnu ;
The main workaround is -I/usr/include/x86_64-linux-gnu
where I have
/usr/include/x86_64-linux-gnu/asm/errno.h
For me, the magic switch was: <cxxflags>-I/usr/include/i386-linux-gnu/
You might want to file a bug report with clang.
I might at that! Thanks to all who helped. It works now. -- Eric Niebler BoostPro Computing http://www.boostpro.com

On 9/25/2011 4:03 PM, Eric Niebler wrote:
On 9/24/2011 2:19 AM, Jürgen Hunold wrote:
Hi Eric,
On Saturday, 24. September 2011 01:45:06 Eric Niebler wrote:
. I've built clang as described here: <http://clang.llvm.org/get_started.html>. I added the following line to my user-config.jam:
using clang : : /home/eric/build/Debug+Asserts/bin/clang++ ;
looks fine.
Now when I try to build, say, the Foreach tests, I get:
In file included from cstr_byref.cpp:11: In file included from ../../../boost/test/minimal.hpp:37: In file included from ../../../boost/test/impl/execution_monitor.ipp:170: In file included from /usr/include/errno.h:36: In file included from /usr/include/bits/errno.h:25: /usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found #include<asm/errno.h>
Clang and gcc and includes. A never ending story ;-))
Well, it's better than clang on Windows or clang on cygwin. :-P
You are right. I never got clang to work on Windows, either with MingW or VC++. Nor did I get any real support on the clang mailing list, which is really just a clang developer mailing list since there is no clang user mailing list. So I do not think that clang for Windows is a reality in any meaningful way. It's a wonderful compiler but only for non-Windows use.

On 24/09/11 10:19, Jürgen Hunold wrote:
Clang and gcc and includes. A never ending story ;-))
I use:
# Clang trunk using clang : # version 3.0 : # compiler $(HOME)/local/bin/clang++ : # options <cxxflags>-fPIC <cxxflags>-Wno-mismatched-tags <cxxflags>-Wno-unused-variable # Workaround <cxxflags>-I/usr/include/x86_64-linux-gnu ;
The main workaround is -I/usr/include/x86_64-linux-gnu
where I have
/usr/include/x86_64-linux-gnu/asm/errno.h
You might want to file a bug report with clang.
I build Boost on Linux x64 (Ubuntu 10.04) using clang from current svn trunk. I have tried with and without your workaround and I don't see any difference. Perhaps the problem has been fixed already. (However, I'm getting a bunch of errors for various libraries leading to 40 targets failed, whereas ~800 targets are successful.) Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org Member of ACCU, http://accu.org

Hi Eric, On 24 September 2011 00:45, Eric Niebler <eric@boostpro.com> wrote:
I'm trying to get bjam and clang to play nice. I have Ubuntu linux running in an VM with boost trunk and the llvm+clang sources also from svn. I've built clang as described here: <http://clang.llvm.org/get_started.html>. I added the following line to my user-config.jam:
using clang : : /home/eric/build/Debug+Asserts/bin/clang++ ;
Now when I try to build, say, the Foreach tests, I get:
In file included from cstr_byref.cpp:11: In file included from ../../../boost/test/minimal.hpp:37: In file included from ../../../boost/test/impl/execution_monitor.ipp:170: In file included from /usr/include/errno.h:36: In file included from /usr/include/bits/errno.h:25: /usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found #include <asm/errno.h> ^ 1 error generated.
"/home/eric/build/Debug+Asserts/bin/clang++" -c -x c++ -O0 -g -fno-inline -Wall -g -fPIC -DBOOST_ALL_NO_LIB=1 -I"../../.." -o
"../../../bin.v2/libs/foreach/test/cstr_byref.test/clang-linux-3.0/debug/cstr_byref.o" "cstr_byref.cpp"
What have I done wrong?
I use this in my user-config.jam file: using clang : : : <cxxflags>"-I/usr/include/c++/4.5/x86_64-linux-gnu/ -I/usr/include/x86_64-linux-gnu/" ; I've not spent any time figuring if this is a Boost.Build bug or a clang configuration bug, but the above has worked well for me with clang / llvm trunk. Cheers, Darren

Eric Niebler wrote:
I've built clang as described here: <http://clang.llvm.org/get_started.html>.
Maybe you already know, but just in case ;) Release build of clang is much faster than debug build. If you want relase build, try `make ENABLE_OPTIMIZED=1` or `../llvm/configure --enable-optimized` then `make` Regards, Michel
participants (6)
-
Darren Garvey
-
Edward Diener
-
Eric Niebler
-
Jürgen Hunold
-
Mateusz Loskot
-
Michel Morin