how to add linker flags to create compiler specific executable in scons

scons

Solution

What you want to do is called `cross-compile`: compile a `Renesas` binary on `Windows`. Seems like what you have done is loaded the `Windows VC10` toolset in SCons (SCons does this automatically unless told not to) and just changed the compiler binary, so SCons is still using the VC10 compiler/linker flags, which dont seem to be compatible. I had to do something similar once with SCons, where I cross-compiled Cavium Octeon in a Linux environment, but luckily for me almost all of the flags were compatible.

I dont know anything about `Renesas`, but if its compilation flags are more similar to another platform/toolset, then load those instead of Windows, as follows where Im loading the Linux gcc toolset.

env = Environment(tools = ['gcc'])

Look for `Construction Environments` in the SCons man page for a complete list of supported tools. Keep in mind that by doing this, you will no longer have support for the native platform toolset, `Windows VC10` in your case.

When and if you find a similar platform, and you still need to change some compiler/linker flags or options, take a look at changing the related SCons Construction Variables. A few that could be helpful are: `CXXFLAGS, LIBSUFFIX, LINKFLAGS, OBJSUFFIX,` and `PROGSUFFIX`. The `LINKFLAGS` construction variable is actually the answer to your original question.

I did a google search for scons renesas, and came across this link which might also be helpful.

Problem

i am using scons for different compilers. vc10 and renesas compiler. if i compile the program by using env.program(---) am getting the link flags as "link /nologo /subsystem:console /pdb:project.pdb /OUT:program.exe D:\build1\subdirA\subdirA.lib D:\build1\subdirB\subdirB.lib main.obj" it is working for VC10 compiler. But for renesas(my microcontroller) compiler, i am getting an error like "Cannot open file : "/OUT:program.exe"" it will accept " -output=program.abs" command when linking. how can i change that one. can you please tell me when program is linking /OUT:program.exe is adding by default. can you please tell me how to change that to "-output=program.abs" Thank you

Original source