[Scons-users] scons and clang++

Kenny, Jason L jason.l.kenny at intel.com
Wed Jul 16 11:53:00 EDT 2014


Hi guys,

I had added a clang builder in my addon Parts for linux and mac. During this work I believe the issues I can across are cases in which there are not clang built libraries for stuff you wanted to link with ( or it was incompatible for some reason). This might explain the issue linking with boost you are seeing. 

The issue with <iostream> would seem to me more of an issue with the clang install ( unless it works fine outside scons). I suggest this as clang/g++ generally know where to find the "std" libraries. Scons does not look for these system libraries itself unless you add them to the CPPPATH variable. I believe you can confirm that SCons is not seeing it via adding "--debug=includes". The only cases I have seen personally with my limited experience of install Clang was when someone installed at work without using the system repro version of it. In that case however clang seems pretty messed up outside scons as well.

Jason

-----Original Message-----
From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Florian Lindner
Sent: Wednesday, July 16, 2014 10:00 AM
To: scons-users at scons.org
Subject: Re: [Scons-users] scons and clang++

Gary Oberbrunner wrote:

> Could be something in your os.environ that's making clang++ work 
> outside of SCons; SCons doesn't propagate the shell environment by default.
> Does it work if you do
>   env['ENV'] = os.environ()
> ?  If so, then you can pare that down to whatever variable is actually 
> making it work.

I have put an

env['ENV'] = os.environ

at the top of my script, but changed nothing. It works with g++ but scons compiler=clang++ fails when searching for the libs, e.g. boost.

Thanks!
Florian

> 
> 
> On Wed, Jul 16, 2014 at 9:55 AM, Florian Lindner <mailinglists at xgm.de>
> wrote:
> 
>> Hello,
>>
>> I have a nicely working build script for g++. I want to modify it to 
>> be able to also compile using clang++.
>>
>> My build script: http://pastebin.com/BXCzgEvy
>>
>> There is only one place where I differentiate between g++ and clang:
>>
>> [...]
>> elif env["compiler"] == 'g++':
>>     pass
>> elif env["compiler"] == "clang++":
>>     env.Append(CCFLAGS = ["-stdlib=libc++"])
>>
>> While just "scons" with g++ as the default works, I get errors when 
>> using clang. I always to an rm -rf .scon* and scons -c before each run.
>>
>> % scons compiler=clang++
>> scons: Reading SConscript files ...
>>
>> [...]
>>
>> Configuring build variables ...
>> Checking for C++ header file boost/array.hpp... no
>> ERROR: Header 'boost/array.hpp' (needed for Boost) not found or does 
>> not compile!
>>
>>
>> Curious thing is that if I just put env["CXX"] = "clang++ -stdlib=libc++"
>> somewhere it works (the compilation failed with a clang error about 
>> not finding <iostream> but scons seems to find all libraries.
>>
>> Thanks!
>> Florian
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> http://four.pairlist.net/mailman/listinfo/scons-users
>>
> 
> 
> 


_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users


More information about the Scons-users mailing list