[Scons-users] scons and clang++

Florian Lindner mailinglists at xgm.de
Wed Jul 16 14:03:08 EDT 2014


Kenny, Jason L wrote:

> 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).

It works fine outside scons. A simple hello world program (using iostream / 
cout) compiles and runs just fine (clang++ hello.cpp).

> 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.

As said above it works fine outside of scons. I just tried a compile run 
with g++, canceled it after 4 files, took the g++ command replacing g++ with 
clang++, it workes fine.

Curiously I just tried again and put 

env["CXX"]="clang++"  # put that
env = conf.Finish()   # right before this

now it works until it hits some c++ error which occurs also outside of scons 
(when using clang, not with g++).

Still, when I try to use "scons compiler=clang++" it fails and does not find 
the boost lib. --debug=includes has not brought more information.

Being puzzled...
Florian

> -----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
> _______________________________________________
> 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