← index #15654Issue #17858
Off-topic · high · value 3.070
QUERY · ISSUE

Build embed with C modules isn't working

openby volodymyr-zvarun-globallogicopened 2024-08-13updated 2025-03-03
enhancementport-embed

Port, board and/or hardware

embed

MicroPython version

MicroPython v1.22.2 on 2024-08-13; linux [GCC 4.2.1] version

Reproduction

  1. Modify examples/embedding/main.c by adding import cexample into second example
  2. From examples/embedding run
make -f micropython_embed.mk USER_C_MODULES=<micropython_path>/examples/usercmodule
make
  1. Run embed binary

Expected behaviour

Expected to start without errors

Observed behaviour

Traceback (most recent call last):
  File "<stdin>", in <module>
ImportError: module not found

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

py.cmake: MICROPY_SOURCE_PY does not include "nlraarch64.c"

closedby Gadgetoidopened 2025-08-07updated 2026-03-19
bug

Port, board and/or hardware

embed

MicroPython version

N/A (master source tree)

Reproduction

I've been putting together CMake package config to build the embed port as a dynamic library, rather than a vendorable list of source files.

This allows a vendor to submodule MicroPython and use:

find_package(micropython-embed CONFIG REQUIRED PATHS micropython/ports/embed)

When building for macOS I run into the link errors detailed below.

I believe "nlraarch64.c" can be added to the source files list without side-effects, but it's not much use if nobody is using it. For now I'll settle to raise this issue for posterity, with a plan to fix it and other bugs if/when I get this CMake tomfoolery working nicely.

Expected behaviour

No response

Observed behaviour

The build will fail at the link stage with:

Undefined symbols for architecture arm64:
  "_nlr_jump", referenced from:
      _mp_compile in compile.c.o
      _fun_bc_call in objfun.c.o
      _gen_resume_and_raise in objgenerator.c.o
      _gen_instance_close in objgenerator.c.o
      _it_iternext in objgetitemiter.c.o
      _mp_parse in parse.c.o
      _raise_exc in parsenum.c.o
      ...
  "_nlr_push", referenced from:
      _it_iternext in objgetitemiter.c.o
      _mp_iternext in runtime.c.o
      _mp_load_method_protected in runtime.c.o
      _mp_call_function_1_protected in runtime_utils.c.o
      _mp_call_function_2_protected in runtime_utils.c.o
      _mp_execute_bytecode in vm.c.o
      _mp_embed_exec_str in embed_util.c.o
      ...
ld: symbol(s) not found for architecture arm64

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied