[Scons-users] How to fix the link order of scons?

Bill Deegan bill at baddogconsulting.com
Thu Sep 8 13:31:34 EDT 2022


Lan,

Not sure where you're getting this quote from:


*"When the source files are the same, the sequential compilation and
linking order of scons is not fixed, which is reflected in the inconsistent
map files generated."*

That shouldn't be happening unless there's something wrong with the way
you're using SCons.
If you're using Glob() to find source files for builders, then it's
possible they may not be found in the same order from run to run, in which
case you should sort the list before using it.

But honestly there's just not enough information yet to help you.
Try running two runs with `--debug=explain`
Also does this build output the full command lines of all the compile steps?
If so build -j1 from a clean build and compare the output.

-Bill


On Thu, Sep 8, 2022 at 4:56 AM Lan Yang <lanyang at autox.ai> wrote:

> Dear Scons users,
>
> There's a Scons feature that's been bothering me for two weeks.
>
>
>
> *"When the source files are the same, the sequential compilation and
> linking order of scons is not fixed, which is reflected in the inconsistent
> map files generated."*
>
> I compiled RT-Thread <https://github.com/RT-Thread/rt-thread> with Scons,
> an open source embedded OS.
> In the case that nothing is changed in the same project,
> the map files generated two times are different,
> which leads to different BIN files (the firmware downloaded to the MCU)
> that are finally generated.
> This means that the same source code may make the MCU behave differently,
> which brings some potential bugs.
>
> When we use Keil <https://www.keil.com/> or other MCU SDK, the map files
> generated by continuous compilation are the same.
>
> Therefore, I hope to fix the link order of Scons so that the same source
> code can be compiled to generate the same map file and firmware.
>
> *So, can Scons fix the order of links? How to fix the link order of Scons?*
>
> Best regards,
> Lan
>
>
> ------------------------------
>
> *CONFIDENTIALITY NOTICE: The contents of this email and any attachments are intended solely for the addressee(s) and contain confidential and/or privileged information and are legally protected from disclosure unless otherwise indicated. If you received this message by mistake, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.  *
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20220908/16d0dc8f/attachment.htm>


More information about the Scons-users mailing list