[Scons-users] HowTo: toggle between toolchains during sconsbuild

PhilAPol philapol at hotmail.com
Sun Sep 1 12:55:15 EDT 2013


Dirk,

Thanks for your quick response.

Your excellent suggestion for cloning was previously attempted while testing different variations of method 1. The main issue with this approach is that when the build executes the cloned environment’s CC compiler (i.e., ‘/usr/bin/native-gcc’) it internally invokes the wrong ‘as’ assembler (‘/usr/bin/as’ –> /usr/bin/arm-as). That is why something similar to method 2 or 3 is needed to change the symbolic links for all the tools just prior to compilation.

If you see something I have missed or have additional suggestions, please let me know.

Thanks,
Phil
From: Dirk Bächle
Sent: Sunday, September 01, 2013 3:43 AM
To: scons-users at scons.org
Subject: Re: [Scons-users] HowTo: toggle between toolchains during sconsbuild

Hi Phil,

On 01.09.2013 02:35, PhilAPol wrote:

Hi All,

The current scons build for mongodb assumes that it will be built on the target machine. This is not possible since there is not enough memory on the target. Consequently, I would like to cross-build mongodb under Ubuntu targeting the ARM processor.

I will need to toggle between using the native tool-chain (under Ubuntu) and the ARM tool-chain in the middle of the build. I have set up my Ubuntu environment under /usr/bin to symbolically link to either the ARM tool-chain or the Ubuntu tool-chain by invoking the use-arm-tools.sh or use-native-tools.sh scripts. Before building I invoke use-arm-tools.sh to start in ARM mode. I have tried a several different approaches (see below) without success. I am looking for a solution.

if you want to get files of your build created in a different way than others, your best approach is to put them in different environments. That's what they're actually there for ;) ...

Trying to set and restore things like the "$CC" variable for the same construction environment won't help, because the commands and variables aren't evaluated and fully expanded until the build phase begins, so the last variable assignment wins.

Instead, you should Clone() your actual environment and modify it as you like:
############################################################################
# We need to change the tool environment from ARM to native Ubuntu mode here.
# Thus jskwgen.c would be built for the Ubuntu environment then executed to
# produce the jskautokw.h and jsautocfg.h files for subsequent use in the
# overall ARM build.
############################################################################
envNative = env.Clone()
envNative['CC'] = ...


envNative.Program('jskwgen', 'jskwgen.c')
envNativ.Program('jscpucfg', 'jscpucfg.c')
envNative.Command('jsautokw.h', ['${PROGREFIX}jskwgen${PROGSUFFIX}'],
'$SOURCE >$TARGET')
envNative.Command('jsautocfg.h', ['${PROGREFIX}jscpucfg${PROGSUFFIX}'],
'$SOURCE >$TARGET')

Like this, the original environment and its clone are protected from each other, and you don't have to restore any stuff for "env" in the end.

Hope this helps you further.

Best regards,

Dirk




--------------------------------------------------------------------------------
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20130901/003bfde5/attachment-0001.htm


More information about the Scons-users mailing list