[Scons-users] Questions about tool selection

Andrew C. Morrow andrew.c.morrow at gmail.com
Tue Jun 11 19:19:09 EDT 2013


On Solaris, you can build g++ to use the Solaris assembler and linker, or
you can build g++ to use the binutils assembler or linker. If you were so
inclined, you could even build it setup to use the GNU assembler and the
Solaris linker.

However, the default SCons link tool selection order seems to be based on
the platform, so when you use SCons on Solaris, you get sunlink, rather
than gnulink. This is a problem when building a shared library, as sunlink
passes -G instead of -shared, which g++ will silently ignore. You get a
broken shared library.

Is there some way to ask the tool selection to base its linker selection
based on its observation of the currently selected compiler? Is there some
way to blacklist sunlink if I know that I will only be using GCC configured
with the binutils linker? How is this supposed to work? For C++ you almost
always need to drive the link with the compiler, so it should be the
compilers job to know how to map its 'build a shared library' flag to the
'build a shared library flag' of the linker it was configured to use.

Similarly, on many systems 'cc' and 'c++' are symlinks to the most recent
compiler version. This is nice, for situations like when Apple updated its
default compiler from GCC to clang. But the tool mechanism doesn't honor
this: it prefers GCC always, and will select it by name before testing 'cc'
or 'cxx'. This seems backwards to me: 'cc' and 'c++' should be tried first,
and, if determined to be present, inspected, then dispatched to the
appropriate specialized tool for further configuration. Otherwise, there is
no way to ensure that the default selected compiler matches the default
system compiler.

It is also unclear to me how this is supposed to work with a user selected
compiler. If the user specifies CC=/path/to/a/c/compiler and
CXX=/path/to/a/cxx/compiler and I populate the Environment with these
values, how do the 'cc' and 'gcc' tools respond? Are they evaluated? I
don't see that they even look at what CC and CXX are set to in the
Environment. Should I not allow those tools to run if the user has
specified CC and CXX via variables or command line flags? Or am I supposed
to overwrite their values after tool selection has run? In that case, if
the auto selected tool is gcc, but the user selects a different compiler
via CC/CXX, then might it not be the case that the environment
modifications made by the gcc tool may be incorrect? It seems, again, that
what the tool should be doing is inspecting the compiler currently selected
by CC and CXX, if preset, and then determining which tool to invoke, not
the other way around.

I'm sorry for this long email, but I'm quite puzzled by how this all is
intended to work. Any insights would be appreciated.

Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20130611/6fe06e46/attachment.htm


More information about the Scons-users mailing list