[Scons-users] Cyclic references between lib archives

Ivan Kravets me at ikravets.com
Wed Feb 4 16:55:49 EST 2015

> On Feb 4, 2015, at 23:26, Dirk Bächle <tshortik at gmx.de> wrote:
> Hi Ivan,
> On 04.02.2015 21:35, Ivan Kravets wrote:
>> Hi,
>> Can someone explain me how to setup cyclic references between lib archives?
>> We can tell gcc-linker which libs should be "cyclic" via --start-group archives --end-group.
>> I use gcc for linking and these options should pass to "linker", not to "compiler". In this case it looks like:
>> -Wl,--start-group archives -Wl,--end-group
> look what Google found:
>  http://scons.1086193.n5.nabble.com/begin-group-LIBS-end-group-td18246.html
> Hope this helps...
> Best regards,
> Dirk
I tried it early. It doesn't work because the order of options to gcc is incorrect. See example based on your link:
    deplibs = [.....]

            Split('-Wl,--start-group $STATIC_LIBS -Wl,--end-group')
    return env.Program(
        join("$BUILD_DIR", "firmware"),
        [src.GlobCXXFiles(vdir) for vdir in vdirs],

Please compare:

Doesn't work:
avr-g++ -o .pioenvs/autogen_uno/firmware.elf -Os -mmcu=atmega2560 -Wl,--gc-sections -Wl,--start-group .pioenvs/autogen_uno/libAdafruit_LED_Backpack_ID128.a .pioenvs/autogen_uno/libAdafruit_GFX_ID13.a .pioenvs/autogen_uno/libWire.a .pioenvs/autogen_uno/libffft.a -Wl,--end-group .pioenvs/autogen_uno/src/Piccolo.o -L.pioenvs/autogen_uno .pioenvs/autogen_uno/libFrameworkArduino.a -lm

I changed command manually and this works good:
avr-g++ -o .pioenvs/autogen_uno/firmware.elf -Os -mmcu=atmega2560 -Wl,--gc-sections .pioenvs/autogen_uno/src/Piccolo.o -L.pioenvs/autogen_uno -Wl,--start-group .pioenvs/autogen_uno/libAdafruit_LED_Backpack_ID128.a .pioenvs/autogen_uno/libAdafruit_GFX_ID13.a .pioenvs/autogen_uno/libWire.a .pioenvs/autogen_uno/libffft.a -Wl,--end-group  .pioenvs/autogen_uno/libFrameworkArduino.a -lm


I mean, how I can put some "LIBS" which are passed to env.Program to --start-group/--end-group ?

With best regards, Ivan Kravets
   - "Creativity comes from talent and never from knowledge" (c)

More information about the Scons-users mailing list