-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Error Making Native Module Example #6264
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I assume you refer to this docs page: https://docs.micropython.org/en/latest/develop/natmod.html#minimal-example What host system are you compiling on: OS, make version, Python version, pyelftools version? Can you post the complete build output from |
macOS 10.15, Python 3.8.3, make 3.81, pyelftools version 0.26. |
I think because you're on macOS it's producing DWARF not ELF files. Can you run |
build/features0.o: Mach-O 64-bit object x86_64 |
Mach-O output files are not supported by this build process. At this stage there are 2 options:
|
Okay, is there a compiler that you know of that would produce ELF files? I'm currently trying to build in Ubuntu, I'm setting up my environment. If that works I'll close the issue. |
I don't know, and I don't think it's easy (would need to build/install an elf-based toolchain). I'd suggest to use Ubuntu. |
Okay, thank you. I found a converter for Mach-O to ELF and used it but now I'm getting the error |
Do you mean that you get that undefined-symbol error when building everything under Ubuntu? Is Ubuntu running in a VM? Can you po
8000
st output of |
If I can chip in with my attempt, I get this outcome. My box runs native Ubuntu 18.04:
The need to install pyelftools could do with being documented. |
Okay, when I run everything under Ubuntu it works. Thanks for your help. |
Now that I've made a few changes I'm getting the error |
Native .mpy files do not support a data section (eg |
I've moved my variable inside the function and am still getting the error. Could this be from "#define"s? I'm trying to adapt the esp32 camera library for MicroPython into a .mpy module. Update: Got rid of all the #define's and am still having the issue. Here's a gist with the code gist Update 2: Removed static keyword from the camera config and it fixed the issue. Now I'm having an issue where it says |
I don't know enough about C to fully understand what's going on but my guess is that the includes aren't working properly. As I had to manually define memcpy in the file even though it was in an include. |
hi @adahl5 -- this discussion might be better suited to the forum. It would be useful if you can post the entire directory rather than just the one .c file. Something that might be worth pointing out though -- you might find it easier to get this working as part of the main firmware first, and then later investigate turning it into a dynamic native modules. The dynamic native module system is quite complicated and there are a lot of ways to 8000 get unstuck, especially when trying to integrate with system functionality (i.e. anything that isn't in dynruntime.h). This is particularly true on ESP32 -- anything in the IDF. (See #5711 for some context there). So instead if you start with just adding a new module to ports/esp32 (or maybe even start in ports/esp32/modesp32.c) and then go from there. |
Comments on my above observation would be welcome: the provided example failed to build here. |
Sorry I missed that -- the pyelftools version in Ubuntu 18.04 pre-dates the required feature... Raised #6296 to track this. |
Uh oh!
There was an error while loading. Please reload this page.
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.
The text was updated successfully, but these errors were encountered: