Search code examples
compilationcompiler-errorscross-compilingscons

How to export a program with an alternate extension in SCons on Windows


I am using SCons to cross-compile embedded code using a Windows host. My colleagues are running Ubuntu. We have many lines in our SConscript files like the following:

prog = env.Program("progname.elf", obj, libs)

On Ubuntu this works fine. On Windows it fails with the following error:

scons: *** An executable should have exactly one target with the suffix: .exe

The best answer I have managed to find so far is to name the file progname_elf.exe and rename it after the fact, but it seems like SCons ought to be able to handle this.


Solution

  • The call

    prog = env.Program("progname.elf", obj, libs)
    

    in your SConscripts should look like this:

    prog = env.Program("progname", obj, libs)
    

    . Then you could set the variable "$PROGSUFFIX" to ".elf" under Posix systems. This would be the SConsish way of dealing with this...see also How to force scons to generate binary file with .bin extension? .