[Scons-dev] Clang support

2015-01-05 Thread Russel Winder
Is it my imagination or is there no support for Clang in SCons?

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part
___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Damian Maguire
There's no official support that I've ever seen for it, but because Clang
generally plays nice with GCC it's usually possible to make it work just by
tweaking the environment a little. I actually wrote some small tools as
part of a project I work on (OpenMAMA) to support clang, and the static
analyzer - they basically inherit from GCC's tools, and set a few other
parameters. You can see the code for them here:

http://git.openmama.org/?p=OpenMAMA.git;a=tree;f=site_scons/site_tools;h=9f43e04b2e170548c2a115b21efef80d18b5bdcd;hb=refs/heads/next

I wouldn't go so far as to suggest they'll stand up to much of a test, but
they've been suitable for my requirements.

Cheers,

D

On Mon, Jan 5, 2015 at 11:48 AM, Russel Winder rus...@winder.org.uk wrote:

 Is it my imagination or is there no support for Clang in SCons?

 --
 Russel.

 =
 Dr Russel Winder  t: +44 20 7585 2200   voip:
 sip:russel.win...@ekiga.net
 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
 London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Gary Oberbrunner
On Mon, Jan 5, 2015 at 7:48 AM, Paweł Tomulik ptomu...@meil.pw.edu.pl
wrote:

  ...
 I have a project where I just set construction variables CC=clang and
 CXX=clang++ and it works well


That's more or less what we do too (in addition to some clang-specific
flags we need).  Seems to work fine.

It'll be much easier to support clang with the new toolchain stuff I'm
working on (slowly, but r0).

-- 
Gary
___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Paweł Tomulik

W dniu 05.01.2015 o 12:48, Russel Winder pisze:

Is it my imagination or is there no support for Clang in SCons?



___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


I have a project where I just set construction variables CC=clang and 
CXX=clang++ and it works well (I check existence of these compilers with 
SConf, so I don't need the Tool machinery to search for the compiler 
executables).


Some time ago I also wrote these two tools:

https://github.com/ptomulik/scons-tool-clang
https://github.com/ptomulik/scons-tool-clangpp

but for some (forgotten) reason I don't use them :)

Best regards!

--
Pawel Tomulik

___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Paweł Tomulik

W dniu 05.01.2015 o 18:09, Dirk Bächle pisze:

Hi Paweł,

On 05.01.2015 13:48, Paweł Tomulik wrote:

W dniu 05.01.2015 o 12:48, Russel Winder pisze:

Is it my imagination or is there no support for Clang in SCons?



___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


I have a project where I just set construction variables CC=clang and 
CXX=clang++ and it works well (I check existence of these
compilers with SConf, so I don't need the Tool machinery to search 
for the compiler executables).


Some time ago I also wrote these two tools:

https://github.com/ptomulik/scons-tool-clang
https://github.com/ptomulik/scons-tool-clangpp

but for some (forgotten) reason I don't use them :)



would you mind if we add these to the ToolsIndex in our Wiki?

Best regards,

Dirk

___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Sure, go ahead.

Regards!

--
Pawel Tomulik

___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread William Blevins
Im not sure what percentage of linux devs use clang vs gcc, but my
personal experience is gcc is more widely used.

Yet another gcc user,
William
On Jan 5, 2015 6:51 PM, Russel Winder rus...@winder.org.uk wrote:

 On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
 […]
  I have a project where I just set construction variables CC=clang and
  CXX=clang++ and it works well (I check existence of these compilers with
  SConf, so I don't need the Tool machinery to search for the compiler
  executables).
 
  Some time ago I also wrote these two tools:
 
  https://github.com/ptomulik/scons-tool-clang
  https://github.com/ptomulik/scons-tool-clangpp
 
  but for some (forgotten) reason I don't use them :)

 This may work fine, but if SCons does not have tools called clang, clang
 ++, clanglink *AND* detection of clang for the cc, c++ and link tools,
 then SCons has no credible support for Clang.

 My real question is whether SCons should prefer clang over gcc for
 Linux.

 --
 Russel.

 =
 Dr Russel Winder  t: +44 20 7585 2200   voip:
 sip:russel.win...@ekiga.net
 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
 London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Bill Deegan
I'd say on linux default to gcc.
If we add clang tools the user can always override them if they wish to.

-Bill

On Mon, Jan 5, 2015 at 3:58 PM, William Blevins wblevins...@gmail.com
wrote:

 Im not sure what percentage of linux devs use clang vs gcc, but my
 personal experience is gcc is more widely used.

 Yet another gcc user,
 William
 On Jan 5, 2015 6:51 PM, Russel Winder rus...@winder.org.uk wrote:

 On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
 […]
  I have a project where I just set construction variables CC=clang and
  CXX=clang++ and it works well (I check existence of these compilers with
  SConf, so I don't need the Tool machinery to search for the compiler
  executables).
 
  Some time ago I also wrote these two tools:
 
  https://github.com/ptomulik/scons-tool-clang
  https://github.com/ptomulik/scons-tool-clangpp
 
  but for some (forgotten) reason I don't use them :)

 This may work fine, but if SCons does not have tools called clang, clang
 ++, clanglink *AND* detection of clang for the cc, c++ and link tools,
 then SCons has no credible support for Clang.

 My real question is whether SCons should prefer clang over gcc for
 Linux.

 --
 Russel.

 =
 Dr Russel Winder  t: +44 20 7585 2200   voip:
 sip:russel.win...@ekiga.net
 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
 London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Michael Jarvis
I use both clang and gcc. They both have their pros and cons.



On Mon, Jan 5, 2015 at 5:58 PM, William Blevins wblevins...@gmail.com
wrote:

 Im not sure what percentage of linux devs use clang vs gcc, but my
 personal experience is gcc is more widely used.

 Yet another gcc user,
 William
 On Jan 5, 2015 6:51 PM, Russel Winder rus...@winder.org.uk wrote:

 On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
 […]
  I have a project where I just set construction variables CC=clang and
  CXX=clang++ and it works well (I check existence of these compilers with
  SConf, so I don't need the Tool machinery to search for the compiler
  executables).
 
  Some time ago I also wrote these two tools:
 
  https://github.com/ptomulik/scons-tool-clang
  https://github.com/ptomulik/scons-tool-clangpp
 
  but for some (forgotten) reason I don't use them :)

 This may work fine, but if SCons does not have tools called clang, clang
 ++, clanglink *AND* detection of clang for the cc, c++ and link tools,
 then SCons has no credible support for Clang.

 My real question is whether SCons should prefer clang over gcc for
 Linux.

 --
 Russel.

 =
 Dr Russel Winder  t: +44 20 7585 2200   voip:
 sip:russel.win...@ekiga.net
 41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
 London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev




-- 
*Michael Jarvis*
McKinney, TX USA
http://about.me/michael.a.jarvis
___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Paweł Tomulik
Well, I thought that there were just defaults for given platform, for 
example gcc for Linux (so it used gcc, if it's installed or fails if 
it's not, even if other supported compilers are available)?. Am I wrong?


W dniu 06.01.2015 o 01:08, Bill Deegan pisze:

Pawel,

It's always been possible to set tool preference in the Environment() 
creation.
As far as allowing a user to override such via local settings, that's 
be up to the project using SCons.


Allowing such by default would likely cause more issues than it solves 
as one of the core functional requirements of SCons is that it enables 
a reproducible build regardless of the users environment.
(This is to enable production software builds, as opposed to open 
source builds which typically want autoconf like behavior, which is 
also core functional requirement for SCons to enable)


-Bill


On Mon, Jan 5, 2015 at 4:02 PM, Michael Jarvis 
mjarvis.tx...@gmail.com mailto:mjarvis.tx...@gmail.com wrote:


Clang can (mostly) emulate gcc, while the reverse is not true. I
would say default to gcc as well.

On Mon, Jan 5, 2015 at 6:00 PM, Bill Deegan
b...@baddogconsulting.com mailto:b...@baddogconsulting.com wrote:

I'd say on linux default to gcc.
If we add clang tools the user can always override them if
they wish to.

-Bill

On Mon, Jan 5, 2015 at 3:58 PM, William Blevins
wblevins...@gmail.com mailto:wblevins...@gmail.com wrote:

Im not sure what percentage of linux devs use clang vs
gcc, but my personal experience is gcc is more widely used.

Yet another gcc user,
William

On Jan 5, 2015 6:51 PM, Russel Winder
rus...@winder.org.uk mailto:rus...@winder.org.uk wrote:

On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
[…]
 I have a project where I just set construction
variables CC=clang and
 CXX=clang++ and it works well (I check existence of
these compilers with
 SConf, so I don't need the Tool machinery to search
for the compiler
 executables).

 Some time ago I also wrote these two tools:

 https://github.com/ptomulik/scons-tool-clang
 https://github.com/ptomulik/scons-tool-clangpp

 but for some (forgotten) reason I don't use them :)

This may work fine, but if SCons does not have tools
called clang, clang
++, clanglink *AND* detection of clang for the cc, c++
and link tools,
then SCons has no credible support for Clang.

My real question is whether SCons should prefer clang
over gcc for
Linux.

--
Russel.

=
Dr Russel Winder  t: +44 20 7585 2200
tel:%2B44%2020%207585%202200   voip:
sip:russel.win...@ekiga.net
mailto:sip%3arussel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077
tel:%2B44%207770%20465%20077   xmpp:
rus...@winder.org.uk mailto:rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk
http://www.russel.org.uk skype: russel_winder

___
Scons-dev mailing list
Scons-dev@scons.org mailto:Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


___
Scons-dev mailing list
Scons-dev@scons.org mailto:Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev



___
Scons-dev mailing list
Scons-dev@scons.org mailto:Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev




-- 
*Michael Jarvis*

McKinney, TX USA
http://about.me/michael.a.jarvis

___
Scons-dev mailing list
Scons-dev@scons.org mailto:Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev




___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev



--
Pawel Tomulik

___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Russel Winder
On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
[…]
 I have a project where I just set construction variables CC=clang and 
 CXX=clang++ and it works well (I check existence of these compilers with 
 SConf, so I don't need the Tool machinery to search for the compiler 
 executables).
 
 Some time ago I also wrote these two tools:
 
 https://github.com/ptomulik/scons-tool-clang
 https://github.com/ptomulik/scons-tool-clangpp
 
 but for some (forgotten) reason I don't use them :)

This may work fine, but if SCons does not have tools called clang, clang
++, clanglink *AND* detection of clang for the cc, c++ and link tools,
then SCons has no credible support for Clang.

My real question is whether SCons should prefer clang over gcc for
Linux.

-- 
Russel.
=
Dr Russel Winder  t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Roadm: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


signature.asc
Description: This is a digitally signed message part
___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Bill Deegan
Pawel,

Take a look at Environment() in the Man Page and look at it's tools
argument.
There should also be info in the users guide.
The default behavior when no tools= is specified is supposed to be
reasonable, but developers can always do what they want.
Often I use Environment(tools=[]) and then env.Tool('gcc')... to be very
explicit

-Bill

On Mon, Jan 5, 2015 at 4:13 PM, Paweł Tomulik ptomu...@meil.pw.edu.pl
wrote:

  Well, I thought that there were just defaults for given platform, for
 example gcc for Linux (so it used gcc, if it's installed or fails if it's
 not, even if other supported compilers are available)?. Am I wrong?

 W dniu 06.01.2015 o 01:08, Bill Deegan pisze:

   Pawel,

  It's always been possible to set tool preference in the Environment()
 creation.
  As far as allowing a user to override such via local settings, that's be
 up to the project using SCons.

  Allowing such by default would likely cause more issues than it solves as
 one of the core functional requirements of SCons is that it enables a
 reproducible build regardless of the users environment.
  (This is to enable production software builds, as opposed to open source
 builds which typically want autoconf like behavior, which is also core
 functional requirement for SCons to enable)

  -Bill


 On Mon, Jan 5, 2015 at 4:02 PM, Michael Jarvis mjarvis.tx...@gmail.com
 wrote:

 Clang can (mostly) emulate gcc, while the reverse is not true. I would
 say default to gcc as well.

 On Mon, Jan 5, 2015 at 6:00 PM, Bill Deegan b...@baddogconsulting.com
 wrote:

  I'd say on linux default to gcc.
  If we add clang tools the user can always override them if they wish to.

  -Bill

 On Mon, Jan 5, 2015 at 3:58 PM, William Blevins wblevins...@gmail.com
 wrote:

 Im not sure what percentage of linux devs use clang vs gcc, but my
 personal experience is gcc is more widely used.

 Yet another gcc user,
 William
  On Jan 5, 2015 6:51 PM, Russel Winder rus...@winder.org.uk wrote:

  On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
 […]
  I have a project where I just set construction variables CC=clang and
  CXX=clang++ and it works well (I check existence of these compilers
 with
  SConf, so I don't need the Tool machinery to search for the compiler
  executables).
 
  Some time ago I also wrote these two tools:
 
  https://github.com/ptomulik/scons-tool-clang
  https://github.com/ptomulik/scons-tool-clangpp
 
  but for some (forgotten) reason I don't use them :)

 This may work fine, but if SCons does not have tools called clang,
 clang
 ++, clanglink *AND* detection of clang for the cc, c++ and link tools,
 then SCons has no credible support for Clang.

 My real question is whether SCons should prefer clang over gcc for
 Linux.

 --
 Russel.

 =
 Dr Russel Winder  t: +44 20 7585 2200 %2B44%2020%207585%202200
  voip: sip:russel.win...@ekiga.net
 41 Buckmaster Roadm: +44 7770 465 077 %2B44%207770%20465%20077
  xmpp: rus...@winder.org.uk
 London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

  ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev



 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev




   --
  *Michael Jarvis*
 McKinney, TX USA
 http://about.me/michael.a.jarvis

 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev




 ___
 Scons-dev mailing 
 listScons-dev@scons.orghttps://pairlist2.pair.net/mailman/listinfo/scons-dev



 --
 Pawel Tomulik


 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 https://pairlist2.pair.net/mailman/listinfo/scons-dev


___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Clang support

2015-01-05 Thread Paweł Tomulik

Thanks Bill,

I took a look at manpage and user docs. It says how we may specify 
tools and not much more.


As I understand, this allows us to  specify what tools are **required** 
for our project (sorry, this is not clearly stated by docs so I may be 
wrong here). This doesn't seem to provide a way to define 
**alternatives** for a tool (under a given platform). Let's take an example:




# SConstruct
# Let's say I prefer clang but allow gcc (or reverse)
env = Environment(tools = [])
env.Tool('gnulink')
env.Tool('gcc')
env.Tool('clang')
env.Program('hello.c')



/* hello.c */
int main() { return 0; }


Now, some real test:

1. Installed gcc, but not clang:

ptomulik@debian:~/test1$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang -o hello.o -c hello.c
sh: 1: clang: not found
scons: *** [hello.o] Error 127
scons: building terminated because of errors.

2. Installed clang but not gcc:

ptomulik@debian:~/test1$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang -o hello.o -c hello.c
clang -o hello hello.o
scons: done building targets.

3. Installed both gcc and clang

ptomulik@debian:~/test1$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang -o hello.o -c hello.c
clang -o hello hello.o
scons: done building targets.


ptomulik@debian:~/test1$ scons -v
SCons by Steven Knight et al.:
script: v2.3.1, 2014/03/02 14:18:15, by garyo on lubuntu
engine: v2.3.1, 2014/03/02 14:18:15, by garyo on lubuntu
engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 
2010, 2011, 2012, 2013, 2014 The SCons Foundation


Clearly, this does not work as expected.

The Tool('gcc') always returns None and does not throw exception.
One way, to cimcurvent this is to determine manually what compilers are 
available and then provide approptiate argument to env.Tool(), but will 
my compiler search work better than the internal search performed by 
Tool()?


W dniu 06.01.2015 o 01:15, Bill Deegan pisze:

Pawel,

Take a look at Environment() in the Man Page and look at it's tools 
argument.

There should also be info in the users guide.
The default behavior when no tools= is specified is supposed to be 
reasonable, but developers can always do what they want.
Often I use Environment(tools=[]) and then env.Tool('gcc')... to be 
very explicit


-Bill

On Mon, Jan 5, 2015 at 4:13 PM, Paweł Tomulik ptomu...@meil.pw.edu.pl 
mailto:ptomu...@meil.pw.edu.pl wrote:


Well, I thought that there were just defaults for given platform,
for example gcc for Linux (so it used gcc, if it's installed or
fails if it's not, even if other supported compilers are
available)?. Am I wrong?

W dniu 06.01.2015 o 01:08, Bill Deegan pisze:

Pawel,

It's always been possible to set tool preference in the
Environment() creation.
As far as allowing a user to override such via local settings,
that's be up to the project using SCons.

Allowing such by default would likely cause more issues than it
solves as one of the core functional requirements of SCons is
that it enables a reproducible build regardless of the users
environment.
(This is to enable production software builds, as opposed to open
source builds which typically want autoconf like behavior, which
is also core functional requirement for SCons to enable)

-Bill


On Mon, Jan 5, 2015 at 4:02 PM, Michael Jarvis
mjarvis.tx...@gmail.com mailto:mjarvis.tx...@gmail.com wrote:

Clang can (mostly) emulate gcc, while the reverse is not
true. I would say default to gcc as well.

On Mon, Jan 5, 2015 at 6:00 PM, Bill Deegan
b...@baddogconsulting.com
mailto:b...@baddogconsulting.com wrote:

I'd say on linux default to gcc.
If we add clang tools the user can always override them
if they wish to.

-Bill

On Mon, Jan 5, 2015 at 3:58 PM, William Blevins
wblevins...@gmail.com mailto:wblevins...@gmail.com wrote:

Im not sure what percentage of linux devs use clang
vs gcc, but my  personal experience is gcc is more
widely used.

Yet another gcc user,
William

On Jan 5, 2015 6:51 PM, Russel Winder
rus...@winder.org.uk mailto:rus...@winder.org.uk
wrote:

On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik
wrote:
[…]
 I have a project where I just set construction
variables CC=clang and
 CXX=clang++ and it works well (I check
existence of these compilers with
 SConf, so I don't need the Tool machinery 

Re: [Scons-dev] Clang support

2015-01-05 Thread Bill Deegan
Looks like your clang tool is not properly detecting that the tool is not
there and indicating that..

On Mon, Jan 5, 2015 at 5:56 PM, Paweł Tomulik ptomu...@meil.pw.edu.pl
wrote:

  Thanks Bill,

 I took a look at manpage and user docs. It says how we may specify tools
 and not much more.

 As I understand, this allows us to  specify what tools are **required**
 for our project (sorry, this is not clearly stated by docs so I may be
 wrong here). This doesn't seem to provide a way to define **alternatives**
 for a tool (under a given platform). Let's take an example:



 # SConstruct
 # Let's say I prefer clang but allow gcc (or reverse)
 env = Environment(tools = [])
 env.Tool('gnulink')
 env.Tool('gcc')
 env.Tool('clang')
 env.Program('hello.c')



 /* hello.c */
 int main() { return 0; }


 Now, some real test:

 1. Installed gcc, but not clang:

 ptomulik@debian:~/test1$ scons
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 clang -o hello.o -c hello.c
 sh: 1: clang: not found
 scons: *** [hello.o] Error 127
 scons: building terminated because of errors.

 2. Installed clang but not gcc:

 ptomulik@debian:~/test1$ scons
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 clang -o hello.o -c hello.c
 clang -o hello hello.o
 scons: done building targets.

 3. Installed both gcc and clang

 ptomulik@debian:~/test1$ scons
 scons: Reading SConscript files ...
 scons: done reading SConscript files.
 scons: Building targets ...
 clang -o hello.o -c hello.c
 clang -o hello hello.o
 scons: done building targets.


 ptomulik@debian:~/test1$ scons -v
 SCons by Steven Knight et al.:
 script: v2.3.1, 2014/03/02 14:18:15, by garyo on lubuntu
 engine: v2.3.1, 2014/03/02 14:18:15, by garyo on lubuntu
 engine path: ['/usr/lib/scons/SCons']
 Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 2011, 2012, 2013, 2014 The SCons Foundation

 Clearly, this does not work as expected.

 The Tool('gcc') always returns None and does not throw exception.
 One way, to cimcurvent this is to determine manually what compilers are
 available and then provide approptiate argument to env.Tool(), but will my
 compiler search work better than the internal search performed by Tool()?

 W dniu 06.01.2015 o 01:15, Bill Deegan pisze:

   Pawel,

  Take a look at Environment() in the Man Page and look at it's tools
 argument.
  There should also be info in the users guide.
  The default behavior when no tools= is specified is supposed to be
 reasonable, but developers can always do what they want.
 Often I use Environment(tools=[]) and then env.Tool('gcc')... to be very
 explicit

  -Bill

 On Mon, Jan 5, 2015 at 4:13 PM, Paweł Tomulik ptomu...@meil.pw.edu.pl
 wrote:

  Well, I thought that there were just defaults for given platform, for
 example gcc for Linux (so it used gcc, if it's installed or fails if it's
 not, even if other supported compilers are available)?. Am I wrong?

 W dniu 06.01.2015 o 01:08, Bill Deegan pisze:

   Pawel,

  It's always been possible to set tool preference in the Environment()
 creation.
  As far as allowing a user to override such via local settings, that's be
 up to the project using SCons.

  Allowing such by default would likely cause more issues than it solves
 as one of the core functional requirements of SCons is that it enables a
 reproducible build regardless of the users environment.
  (This is to enable production software builds, as opposed to open
 source builds which typically want autoconf like behavior, which is also
 core functional requirement for SCons to enable)

  -Bill


 On Mon, Jan 5, 2015 at 4:02 PM, Michael Jarvis mjarvis.tx...@gmail.com
 wrote:

 Clang can (mostly) emulate gcc, while the reverse is not true. I would
 say default to gcc as well.

 On Mon, Jan 5, 2015 at 6:00 PM, Bill Deegan b...@baddogconsulting.com
 wrote:

  I'd say on linux default to gcc.
  If we add clang tools the user can always override them if they wish
 to.

  -Bill

 On Mon, Jan 5, 2015 at 3:58 PM, William Blevins wblevins...@gmail.com
 wrote:

 Im not sure what percentage of linux devs use clang vs gcc, but my
 personal experience is gcc is more widely used.

 Yet another gcc user,
 William
  On Jan 5, 2015 6:51 PM, Russel Winder rus...@winder.org.uk wrote:

  On Mon, 2015-01-05 at 13:48 +0100, Paweł Tomulik wrote:
 […]
  I have a project where I just set construction variables CC=clang
 and
  CXX=clang++ and it works well (I check existence of these compilers
 with
  SConf, so I don't need the Tool machinery to search for the compiler
  executables).
 
  Some time ago I also wrote these two tools:
 
  https://github.com/ptomulik/scons-tool-clang
  https://github.com/ptomulik/scons-tool-clangpp
 
  but for some (forgotten) reason I don't use them :)

 This may work fine, but if SCons does not have tools called clang,
 clang
 ++, clanglink *AND* 

Re: [Scons-dev] Clang support

2015-01-05 Thread Gary Oberbrunner
On Mon, Jan 5, 2015 at 7:02 PM, Paweł Tomulik ptomu...@meil.pw.edu.pl
wrote:

 Looks like SCons is missing a tool preference system, where each user
 (developer, not end user) could easily re-define by its own the preferred
 order of compiler toolchains. The same applies to other tools. Don't worry,
 there will always be room for discussion, for example what should be the
 default preference order :)


This will be (much) more configurable at some point.  There will be chains
of tools, selectable and overridable and auto-detectable in various ways.
I'm working on it.

-- 
Gary
___
Scons-dev mailing list
Scons-dev@scons.org
https://pairlist2.pair.net/mailman/listinfo/scons-dev