Build is... difficult
NuclearManD opened this issue · 0 comments
Build of latest repo (Just cloned earlier today) fails. I have found numerous issues causing it.
I have developed on ESP32 with Arduino for some time now, so I am comfortable with a lot of the code/api (even if uPython doesn't use Arduino), and I have been able to work out these problems myself but I have little understanding of how micropython works under the hood. That's why I'm creating this issue - because although I may be able to make solutions, they may be cheap hacks just to make it compile.
System specs
Linux Mint 19 (Tara)
nuclaer@nuclaer-machine:~$ uname -r
4.15.0-54-generic
First compiler error I managed to "solve"
./BUILD.sh -v > log.txt
full log.txt on pastebin: https://pastebin.com/raw/bitTPENu
Section just including compiler error:
[...]/MicroPython_BUILD/components/micropython/py/../extmod/vfs_native.c:641:15: error: 'FF_MAX_LFN' undeclared (first use in this function)
maxlfn = FF_MAX_LFN;
^
I looked up FF_MAX_LFN
and found this, essentially default value should be 255 and, per my understanding, this has to do with maximum file name length.
I made a sort of hack type fix by adding these three lines to MicroPython_BUILD/components/micropython/extmod/vfs_native.h:
#ifndef FF_MAX_LFN
#define FF_MAX_LFN 255
#endif
Then I got another error...
Second Error: FreeRTOS has static disabled by default.
./BUILD.sh clean
./BUILD.sh -v > log.txt
full log.txt on pastebin: https://pastebin.com/raw/npvtrC23
Just compiler error:
[...]/MicroPython_BUILD/components/micropython/esp32/main.c: In function 'micropython_entry':
[...]/MicroPython_BUILD/components/micropython/esp32/main.c:464:21: error: implicit declaration of function 'xTaskCreateStatic' [-Werror=implicit-function-declaration]
MainTaskHandle = xTaskCreateStatic(&mp_task, "mp_task", mp_task_stack_len, NULL, CONFIG_MICROPY_TASK_PRIORITY, mp
^
Evidently Micropython needs FreeRTOS configured with static allocation API enabled. For some reason by default it isn't. Fixed with ./BUILD.sh menuconfig
in components->FreeRTOS.
Third issue - gc.compile() returns value must be disabled
./BUILD.sh clean
./BUILD.sh -v > log.txt
full log.txt on pastebin again: https://pastebin.com/raw/NS1aVxn5
This time the compiler error is this:
[...]/MicroPython_BUILD/components/micropython/esp32/mpthreadport.c:171:4: error: 'n_marked' undeclared (first use in this function)
n_marked = MP_STATE_MEM(gc_marked);
^
I found this at the specified line:
#if MICROPY_PY_GC_COLLECT_RETVAL
n_marked = MP_STATE_MEM(gc_marked);
#endif
It has to do with the option of gc.collect() returning a value. I thought that could be useful so I had enabled it before building. I disabled it in ./BUILD.sh menuconfig
under micropython-> system settings.
Uploading built binary
./BUILD.sh flash > log.txt
log.txt on pastebin, in case you want it: https://pastebin.com/raw/h3DmXGMM
It did not work, but I think this issue should focus on compilation and not whatever issue I'm having on my ESP32.
Conclusion
After disabling the build worked! So there must be some issues with compilation that just aren't resolved? I am not sure the best way to permanently fix this so I made this issue here.