Page 2 of 2

Re: How to add modules like ujson, upip and etc?

Posted: Mon Oct 05, 2020 5:30 am
by houneie
Update: I found the appropriate version of modujson.c which is compatible with my port of micropython. Now those errors are gone and a new came I think it is related to the implementation of constructor/destructor.

Code: Select all

LINK micropython.elf
/home/abdrehman/src/sifive.com/riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld: build/py/../extmod/modujson.o: in function `mod_ujson_loads':
modujson.c:(.text.mod_ujson_loads+0x28): undefined reference to `mp_type_stringio'
/home/abdrehman/src/sifive.com/riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-linux-ubuntu14/bin/../lib/gcc/riscv64-unknown-elf/8.3.0/../../../../riscv64-unknown-elf/bin/ld: modujson.c:(.text.mod_ujson_loads+0x2c): undefined reference to `mp_type_stringio'
collect2: error: ld returned 1 exit status
make: *** [Makefile:107: micropython.elf] Error 1

Re: How to add modules like ujson, upip and etc?

Posted: Mon Oct 05, 2020 7:07 am
by stijn
Undefined reference means the linker doesn't find the code which defines what mp_type_stringio is. So the solution is fairly simple: look for the file which defines mp_type_stringio, make sure the code isn't disabled by preprocessor macros and build the file as well. In this case the file is objstringio.c and MICROPY_PY_IO should be 1. However since you say you're an intern my tip would be to figure out basics like this yourself because it's the best way to learn it, plus you'll be needing this knowledge often :)

Re: How to add modules like ujson, upip and etc?

Posted: Tue Oct 06, 2020 4:37 am
by houneie
stijn wrote:
Mon Oct 05, 2020 7:07 am
Undefined reference means the linker doesn't find the code which defines what mp_type_stringio is. So the solution is fairly simple: look for the file which defines mp_type_stringio, make sure the code isn't disabled by preprocessor macros and build the file as well. In this case the file is objstringio.c and MICROPY_PY_IO should be 1. However since you say you're an intern my tip would be to figure out basics like this yourself because it's the best way to learn it, plus you'll be needing this knowledge often :)
Thank you very much for the support I am learning every day :) .