Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

py: Add LIBS_USERMOD to LIBS.#18352

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

Open
sfe-SparkFro wants to merge2 commits intomicropython:master
base:master
Choose a base branch
Loading
fromsparkfun:fix_cpp_module_make

Conversation

@sfe-SparkFro
Copy link
Contributor

@sfe-SparkFrosfe-SparkFro commentedOct 30, 2025
edited
Loading

Summary

Progress towards#18351

This enables C++ modules to correctly postion-l linker flags at the end of the flags instead of at the start. Updated the example C++micropython.mk accordingly.

Testing

Attempted to build firmware for a board that uses Make (eg.stm32 ormimxrt). Before this change, the linker could not find the symbols fromlibstdc++.a. After this change, those symbols were found.

@github-actions
Copy link

github-actionsbot commentedOct 30, 2025
edited
Loading

Code size report:

Reference:  py/objcode: Remove `mp_obj_code_t.lnotab` field from v2 preview. [e0a9b70]Comparison: py: Add LIBS_USERMOD to LIBS. [merge of 7176acb]  mpy-cross:    +0 +0.000%    bare-arm:    +0 +0.000% minimal x86:    +0 +0.000%    unix x64:    +0 +0.000% standard      stm32:    +0 +0.000% PYBV10     mimxrt:    +0 +0.000% TEENSY40        rp2:    +0 +0.000% RPI_PICO_W       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorgedpgeorge added the py-coreRelates to py/ directory in source labelNov 3, 2025
@dpgeorge
Copy link
Member

Thanks for the patch, addingLIBS_USERMOD looks very reasonable to me.

But, the CI needs to be fixed before this PR can be merged.

If you want to quickly get theLIBS_USERMOD bit in then we can merge just that change, and not the change to usestd::vector.

This enables C++ modules to correctly postion -llinker flags at the end of the flags instead of atthe start. Updated the example C++ micropython.mkaccordingly.Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
@sfe-SparkFro
Copy link
ContributorAuthor

Thanks! Pushed7176acb which should hopefully resolve that.

I also unlinked this PR from#18351, as it's not a full solution to get C++ modules working on all ports when actually usingstdc++.a. The CMake ports seem to build fine (I've not tested execution), but every the Make port fails to build as soon as any code is used that leveragesstdc++.a. I've added a lot of notes to#18351 about how to fix this; annoyingly, every port seems to need its own unique fixes, though there are some common fixes between them.

@codecov
Copy link

codecovbot commentedNov 3, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (4efc5e1) to head (dbaa315).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@##           master   #18352      +/-   ##==========================================- Coverage   98.38%   98.38%   -0.01%==========================================  Files         171      171                Lines       22297    22294       -3     ==========================================- Hits        21936    21933       -3  Misses        361      361

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sfe-SparkFro
Copy link
ContributorAuthor

https://github.com/micropython/micropython/actions/runs/19042775575/job/54383644049?pr=18352 Hmm...

LINK build-coverage/micropython/usr/bin/ld: build-coverage/cppexample/example.o:(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'collect2: error: ld returned 1 exit statusmake: *** [../../py/mkrules.mk:248: build-coverage/micropython] Error 1make: Leaving directory '/home/runner/work/micropython/micropython/ports/unix'

Testing on my end withV=1, before this PR, the link command contains-lstdc++:

gcc ... -ftest-coverage -lstdc++    -Wl,-Map=...

After this PR,-lstdc++ goes away:

gcc ... -ftest-coverage     -Wl,-Map=....

@sfe-SparkFro
Copy link
ContributorAuthor

sfe-SparkFro commentedNov 3, 2025
edited
Loading

Ah,unix/Makefile does not useLIBS, onlyLDFLAGS. That would explain why-lstdc++ goes missing.

Would it be acceptable to simply addLDFLAGS += $(LIBS) after the last modification ofLDFLAGS? That makes it build successfully on my end.

@dpgeorge
Copy link
Member

Would it be acceptable to simply addLDFLAGS += $(LIBS) after the last modification ofLDFLAGS? That makes it build successfully on my end.

The unix and Windows ports useLIB... and that's inconsistent with all other ports which useLIBS.

So I think the right solution here is to change the two instances ofLIB inpy/mkrules.mk andports/windows/Makefile toLIBS.

Same in ports/windows/Makefile to be consistentwith other ports. Resolves build error after7176acb.Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
@sfe-SparkFro
Copy link
ContributorAuthor

dbaa315 passes 🎉

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

py-coreRelates to py/ directory in source

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@sfe-SparkFro@dpgeorge

[8]ページ先頭

©2009-2025 Movatter.jp