[Scons-users] HOWTO select a toolchain

Dominic Binks dominic.binks at thebinkles.net
Mon Jan 4 15:20:21 EST 2016


Here's the list I've found our toolchains need to set up to be able to 
build the stuff we need to build:

ALL_TOOLS = [
   "AR",
   "AS",
   "CC",
   "CXX",
   "OBJCOPY",
   "OBJDUMP",
   "NM",
   "LD",
   "LINK",
   "RANLIB",
   "SHLINK",
   "STRIP",
   "CFLAGS",
   "CCFLAGS",
   "CPPDEFINES",
   "CPPPATH",
   "CXXFLAGS",
   "LINKFLAGS",
   "LIBPATH",
   "SHLINKFLAGS",
   "LIBS"]

Probably most people won't need objcopy/objdump - but with a complete 
toolchain when cross compiling the others appear to be necessary (we 
build on x86 Linux for various ARM targets, other x86 targets as well as 
Windows builds on Linux).

Dominic

On 04/01/2016 20:08, Marc Branchaud wrote:
> On 16-01-04 02:36 PM, Stefan Seefeld wrote:
>> On 04.01.2016 14:19, William Blevins wrote:
>>> Stefan,
>>>
>>> SCons does not automatically import environment variables. The SCons
>>> DefaultEnvironment is minimalistic.
>>>
>>> http://scons.org/new/faq.html#Why_doesn.27t_SCons_find_my_compiler.2BAC8-linker.2BAC8-etc..3F_I_can_execute_it_just_fine_from_the_command_line.
>>
>> William,
>>
>> thanks, but I believe that only addresses some of my concerns. I also
>> found your answer to a similar question here:
>> http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2927425,
>> which is helpful, but not quite complete (as it isn't clear what other
>> variables specifically need to be changed, and how. Can you point me to
>> some documentation that explains how the various compiler-related
>> variables are defined, so I know what exactly I need to redefine to be
>> able to switch toolchains on the command-line ?
>
> Can't speak to Microsoft tools, but in our Unix-only 64-bit/32-bit
> cross-compilation environment the variables we override are:
>
> ToolchainVars = [
>      'AR',
>      'AS',
>      'CC',
>      'CXX',
>      # Don't need to override LINK and SHLINK because SCons maps them to
>      # CC (or CXX)
>      #'LINK',
>      #'SHLINK',
>      'RANLIB',
>      'READELF',
>      'STRIP'
> ]
>
> In cases where we need to build something natively we have an
> "UnsetToolchain" method that simply deletes the above variables from the
> build environment so that we end up with SCons's auto-detected defaults.
>
> AFAIK, SCons doesn't have anything like a "toolchain ID".  The most reliable
> way to ensure that SCons is using the toolchain you want is to make sure its
> binaries appear in your PATH before any other toolchain's.
>
> Even if SCons had some kind of toolchain-ID feature, it's always wise to
> ensure that your PATH is set to use the toolchain you want.  You never know
> what esoteric sub-tool your compiler might want to invoke!
>
> A while back our build used to do true cross-compilation, and we taught our
> SConscripts to use a TOOLCHAIN_HOME variable.  The variable specified a home
> directory for a toolchain (with various subdirectories like bin/, lib/ and
> include/), which we used as a path prefix when setting the above variables
> and others (like CPPPATH).
>
> Hope that helps!
>
> 		M.
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3725 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160104/3cabb588/attachment.bin>


More information about the Scons-users mailing list