- Notifications
You must be signed in to change notification settings - Fork13.3k
Respect linking order of libraries#8263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Now has the same order as the Arduino IDE does with its platform.txt
Instead of injecting at magic indices, which might break when some other extra-scripts inject other libraries, let's create the LIBS array at the bottom in easy to understand and correct order.
mcspr commentedAug 9, 2021
Initial LIBS could be left empty: ifEXCEPTIONS:CXX_LIBS= ["std++"]else:CXX_LIBS= ["std++-noexc"]SDK_LIBS= ["hal","phy","pp","net80211","wpa","crypto","main","wps","bearssl","espnow","smartconfig","airkiss","wpa2"]C_LIBS= ["m","c","gcc"]ifBLAH:LWIP_LIBS= [ ... ]# ...env.Replace(LIBS=SDK_LIBS+LWIP_LIBS+CXX_LIBS+C_LIBS) ? Hardcoded offsets are hard to parse at a glance |
maxgerhardt commentedAug 9, 2021
I'm not quite sure if I follow? The hardcoded offsets have been removed with the latest commit because I didn't like that style either. The code at the bottom with |
mcspr commentedAug 9, 2021
Github interface caching is weird, looking at the |
maxgerhardt commentedAug 28, 2021
I think this is a straight-forward fix & improvement PR. Any thoughts on getting this merged? |
Uh oh!
There was an error while loading.Please reload this page.
Fixes#8262.
Arduino IDE link order:
PlatformIO link order before this fix:
(^ which causes the linking failure in regards to the math library in the referenced issue)
PlatformIO link order after this fix:
Aka, now equivalent to the Arduino IDE linking order.
The code refactors setting
env["LIBS"]further down the script where it knows the system libraries to be built, and then creates the array with the correct linking order.The previous
env.Append(LIBS = ...)is wrong here because it appends to the back and hence does not respect the original linker order laid out in theplatform.txtArduino/platform.txt
Line 70 in5f04fbb