← index #5500Issue #6264
Likely Duplicate · high · value 2.336
QUERY · ISSUE

Native modules don't compile on macOS for x64 / x86 arch

openby stepansnigirevopened 2020-01-06updated 2025-11-17
port-unix

I tried to compile the native module example (examples/natmod/feature0) on macOS and got the following error:

GEN build/features0.config.h
CC features0.c
LINK build/features0.o
Traceback (most recent call last):
  File "../../../tools/mpy_ld.py", line 964, in <module>
    main()
  File "../../../tools/mpy_ld.py", line 961, in main
    do_link(args)
  File "../../../tools/mpy_ld.py", line 937, in do_link
    load_object_file(env, file)
  File "../../../tools/mpy_ld.py", line 585, in load_object_file
    elf = elffile.ELFFile(f)
  File "/usr/local/lib/python3.7/site-packages/elftools/elf/elffile.py", line 67, in __init__
    self._identify_file()
  File "/usr/local/lib/python3.7/site-packages/elftools/elf/elffile.py", line 421, in _identify_file
    elf_assert(magic == b'\x7fELF', 'Magic number does not match')
  File "/usr/local/lib/python3.7/site-packages/elftools/common/utils.py", line 77, in elf_assert
    _assert_with_exception(cond, msg, ELFError)
  File "/usr/local/lib/python3.7/site-packages/elftools/common/utils.py", line 109, in _assert_with_exception
    raise exception_type(msg)
elftools.common.exceptions.ELFError: Magic number does not match
make: *** [build/features0.native.mpy] Error 1

On Ubuntu everything compiles. On Mac armv7m works, x86 and x64 - not.
I am using macOS Catalina v10.15.2.

CANDIDATE · ISSUE

Error Making Native Module Example

closedby adahl5opened 2020-07-21updated 2020-07-29

Hello, I'm running into an error trying to compile the native module example from here. I keep getting the error elftools.common.exceptions.ELFError: Magic number does not match make: *** [build/factorial.native.mpy] Error 1

This also happens when I try to make the examples in the examples/natmod directory as well.

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