Search code examples
cross-compilingsconsavr-gcc

SCons ignoring Env AR option


I'm running SCons under cygwin to compile AVR static library

In SConstruct I set:

Env = Environment()

ToolChainPrefix = r'/cygdrive/c/Program\ Files\ \(x86\)/Atmel/Atmel\ Toolchain/AVR8\ GCC/Native/3.4.1056/avr8-gnu-toolchain/bin/'

Env.Replace(CXX = ToolChainPrefix + 'avr-g++.exe')
Env.Replace(AR = ToolChainPrefix + 'avr-ar.exe')
Env.Replace(CXXFLAGS = '-Wall -Wextra -std=c++11 -mmcu=' + Options['mmcu'] + ' -DF_CPU=' + Options['F_CPU'] + ' -Os -funsigned-char -funsigned-bitfields -fshort-enums -fpack-struct -ffunction-sections -fdata-sections')

C++ files are being compiled using correct compiler, but for unknown reason ar rc is still used to create target .a file

How can I fix that?


Solution

  • Ok, I came up with solution.

    Instead of doing Env.StaticLibrary() I was doing StaticLibrary() which ignored all Env variables.