[Scons-users] How to fix the link order of scons?
Bill Deegan
bill at baddogconsulting.com
Fri Sep 9 18:48:00 EDT 2022
Which version of SCons are you running?
On Fri, Sep 9, 2022 at 12:13 PM Bill Deegan <bill at baddogconsulting.com>
wrote:
> Please submit a PR to the project with these changes to RT-Thread to avoid
> someone else running into this issue in the future.
> -Bill
>
> On Thu, Sep 8, 2022 at 11:50 PM Lan Yang <lanyang at autox.ai> wrote:
>
>> Dear Bill,
>>
>> Thank you very much!
>> I've solved the problem by sorting the objects in another place.
>> The link order is fixed now.
>>
>> Best regards,
>> Lan
>>
>> On Fri, Sep 9, 2022 at 1:34 PM <scons-users-request at scons.org> wrote:
>>
>>> Send Scons-users mailing list submissions to
>>> scons-users at scons.org
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> or, via email, send a message with subject or body 'help' to
>>> scons-users-request at scons.org
>>>
>>> You can reach the person managing the list at
>>> scons-users-owner at scons.org
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of Scons-users digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>> 1. Re: How to fix the link order of scons? (Lan Yang)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Fri, 9 Sep 2022 13:34:07 +0800
>>> From: Lan Yang <lanyang at autox.ai>
>>> To: scons-users at scons.org
>>> Subject: Re: [Scons-users] How to fix the link order of scons?
>>> Message-ID:
>>> <CALxRPys=K2hiaJ=cY3gw=
>>> sJgq6D75UZaCLy_keRfJKwyB_hzGQ at mail.gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> Dear Bill,
>>>
>>> Good news.
>>> After I used "scons -j1" and changed the
>>>
>>> return objs
>>> to
>>> return sorted(objs),
>>>
>>> the differences between map files have been reduced.
>>>
>>> But there are still 5~50 lines of the map files generated by two
>>> buildings.
>>> I'm looking through the source code of RT-Thread Scons now.
>>>
>>> Best regards,
>>> Lan
>>>
>>>
>>>
>>>
>>> On Fri, Sep 9, 2022 at 12:05 PM <scons-users-request at scons.org> wrote:
>>>
>>> > Send Scons-users mailing list submissions to
>>> > scons-users at scons.org
>>> >
>>> > To subscribe or unsubscribe via the World Wide Web, visit
>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> > or, via email, send a message with subject or body 'help' to
>>> > scons-users-request at scons.org
>>> >
>>> > You can reach the person managing the list at
>>> > scons-users-owner at scons.org
>>> >
>>> > When replying, please edit your Subject line so it is more specific
>>> > than "Re: Contents of Scons-users digest..."
>>> >
>>> >
>>> > Today's Topics:
>>> >
>>> > 1. Re: How to fix the link order of scons? (Lan Yang) (Bill Deegan)
>>> >
>>> >
>>> > ----------------------------------------------------------------------
>>> >
>>> > Message: 1
>>> > Date: Thu, 8 Sep 2022 21:05:08 -0700
>>> > From: Bill Deegan <bill at baddogconsulting.com>
>>> > To: SCons users mailing list <scons-users at scons.org>
>>> > Subject: Re: [Scons-users] How to fix the link order of scons? (Lan
>>> > Yang)
>>> > Message-ID:
>>> > <CAEyG4CGHpjwzq=j=
>>> > V_VL59E_SQOy6if5b3tX0_jYLwCA9e8a6Q at mail.gmail.com>
>>> > Content-Type: text/plain; charset="utf-8"
>>> >
>>> > I don't have time to try to build this.
>>> > Change the
>>> > return objs
>>> >
>>> > to
>>> > return sorted(objs)
>>> >
>>> > In theory that should do it.
>>> >
>>> > On Thu, Sep 8, 2022 at 8:46 PM Lan Yang <lanyang at autox.ai> wrote:
>>> >
>>> > > Bill,
>>> > >
>>> > > Thanks for your reply! It helps a lot.
>>> > >
>>> > > I've runs with `--debug=explain`, it outputted as follow:
>>> > > > Info: Start building, please wait ...
>>> > > > scons: Reading SConscript files ...
>>> > > > Newlib version:3.3.0
>>> > > > scons: done reading SConscript files.
>>> > > > scons: Building targets ...
>>> > > > scons: building associated VariantDir targets: build
>>> > > > scons: rebuilding `xnav_s32k344.elf' because the dependency order
>>> > > changed:
>>> > > > scons: rebuilding `rtthread.elf' because the dependency order
>>> changed:
>>> > >
>>> > > So, It seems caused by the reason you mentioned,
>>> > > the dependency files haven't been found in the same order from run ro
>>> > run.
>>> > > I'll try to sort the dependency list before using it today.
>>> > > Would you please send me a demo which sort the list before using?
>>> > >
>>> > > You can reproduce the feature I asked for by just compiling in
>>> RT-Thread
>>> > > released v4.1.0's code.
>>> > > The reproduction steps are:
>>> > > 1. download RT-Thread released v4.1.0 from:
>>> > > https://github.com/RT-Thread/rt-thread/releases/tag/v4.1.0
>>> > > 2. cd ..\rt-thread-4.1.0\bsp\stm32\stm32h750-armfly-h7-tool
>>> > > 3. run Scons two times inside the folder, and compare the generated
>>> .map
>>> > > files
>>> > >
>>> > > Best regard,
>>> > > Lan
>>> > >
>>> > >
>>> > > On Fri, Sep 9, 2022 at 8:10 AM <scons-users-request at scons.org>
>>> wrote:
>>> > >
>>> > >> Send Scons-users mailing list submissions to
>>> > >> scons-users at scons.org
>>> > >>
>>> > >> To subscribe or unsubscribe via the World Wide Web, visit
>>> > >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> > >> or, via email, send a message with subject or body 'help' to
>>> > >> scons-users-request at scons.org
>>> > >>
>>> > >> You can reach the person managing the list at
>>> > >> scons-users-owner at scons.org
>>> > >>
>>> > >> When replying, please edit your Subject line so it is more specific
>>> > >> than "Re: Contents of Scons-users digest..."
>>> > >>
>>> > >>
>>> > >> Today's Topics:
>>> > >>
>>> > >> 1. How to fix the link order of scons? (Lan Yang)
>>> > >> 2. Re: How to fix the link order of scons? (Bill Deegan)
>>> > >> 3. Re: How to fix the link order of scons? (Bill Deegan)
>>> > >>
>>> > >>
>>> > >>
>>> ----------------------------------------------------------------------
>>> > >>
>>> > >> Message: 1
>>> > >> Date: Thu, 8 Sep 2022 19:55:48 +0800
>>> > >> From: Lan Yang <lanyang at autox.ai>
>>> > >> To: scons-users at scons.org
>>> > >> Subject: [Scons-users] How to fix the link order of scons?
>>> > >> Message-ID:
>>> > >> <CALxRPyukn_xYx-wyvD2R=
>>> > >> hrfaTjD+NwAmiySVOPz1MJiC+_epQ at mail.gmail.com>
>>> > >> Content-Type: text/plain; charset="utf-8"
>>> > >>
>>> > >> 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.??*
>>> > >> -------------- next part --------------
>>> > >> An HTML attachment was scrubbed...
>>> > >> URL: <
>>> > >>
>>> >
>>> https://pairlist4.pair.net/pipermail/scons-users/attachments/20220908/f81d96e1/attachment-0001.htm
>>> > >> >
>>> > >>
>>> > >> ------------------------------
>>> > >>
>>> > >> Message: 2
>>> > >> Date: Thu, 8 Sep 2022 10:31:34 -0700
>>> > >> From: Bill Deegan <bill at baddogconsulting.com>
>>> > >> To: SCons users mailing list <scons-users at scons.org>
>>> > >> Subject: Re: [Scons-users] How to fix the link order of scons?
>>> > >> Message-ID:
>>> > >> <CAEyG4CFdcOeetFoy0r8_NQohQwSaJ0kpkxgM16++Z4SOpBC=
>>> > >> Pw at mail.gmail.com>
>>> > >> Content-Type: text/plain; charset="utf-8"
>>> > >>
>>> > >> 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-0001.htm
>>> > >> >
>>> > >>
>>> > >> ------------------------------
>>> > >>
>>> > >> Message: 3
>>> > >> Date: Thu, 8 Sep 2022 17:10:15 -0700
>>> > >> From: Bill Deegan <bill at baddogconsulting.com>
>>> > >> To: SCons users mailing list <scons-users at scons.org>
>>> > >> Subject: Re: [Scons-users] How to fix the link order of scons?
>>> > >> Message-ID:
>>> > >> <CAEyG4CFerY0Fvo_wGeJ6iuE=
>>> > >> 5VLu_MrD0saz3+n7AcKje9gbwQ at mail.gmail.com>
>>> > >> Content-Type: text/plain; charset="utf-8"
>>> > >>
>>> > >> Lan,
>>> > >>
>>> > >> This problem has been brought to our user communities attention
>>> before
>>> > and
>>> > >> a fix has been provided.
>>> > >> I guess it didn't make it upstream.
>>> > >>
>>> > >> If you change this function
>>> > >>
>>> >
>>> https://github.com/RT-Thread/rt-thread/blob/master/tools/building.py#L367
>>> > >> To return a sorted list instead of the unordered (and likely order
>>> > >> changing
>>> > >> on each run) list it's currently returning, that should (we believe)
>>> > >> resolve your issue.
>>> > >>
>>> > >> -Bill
>>> > >>
>>> > >> On Thu, Sep 8, 2022 at 10:31 AM Bill Deegan <
>>> bill at baddogconsulting.com>
>>> > >> wrote:
>>> > >>
>>> > >> > 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/330d945b/attachment.htm
>>> > >> >
>>> > >>
>>> > >> ------------------------------
>>> > >>
>>> > >> Subject: Digest Footer
>>> > >>
>>> > >> _______________________________________________
>>> > >> Scons-users mailing list
>>> > >> Scons-users at scons.org
>>> > >> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> > >>
>>> > >>
>>> > >> ------------------------------
>>> > >>
>>> > >> End of Scons-users Digest, Vol 133, Issue 2
>>> > >> *******************************************
>>> > >>
>>> > >
>>> > >
>>> > > ------------------------------
>>> > >
>>> > > *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/922a258c/attachment.htm
>>> > >
>>> >
>>> > ------------------------------
>>> >
>>> > Subject: Digest Footer
>>> >
>>> > _______________________________________________
>>> > Scons-users mailing list
>>> > Scons-users at scons.org
>>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>>> >
>>> >
>>> > ------------------------------
>>> >
>>> > End of Scons-users Digest, Vol 133, Issue 5
>>> > *******************************************
>>> >
>>>
>>> --
>>>
>>>
>>>
>>>
>>> *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.??*
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: <
>>> https://pairlist4.pair.net/pipermail/scons-users/attachments/20220909/0a0d2507/attachment.htm
>>> >
>>>
>>> ------------------------------
>>>
>>> Subject: Digest Footer
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>> ------------------------------
>>>
>>> End of Scons-users Digest, Vol 133, Issue 6
>>> *******************************************
>>>
>>
>>
>> ------------------------------
>>
>> *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/20220909/fdae66da/attachment-0001.htm>
More information about the Scons-users
mailing list