akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 809 forks source link

Jansson for Cortex M7 #552

Closed celiajoseph closed 3 years ago

celiajoseph commented 3 years ago

I am trying to use this library for Cortex M7. This is the steps i followed:

CFLAGS="-mthumb -mthumb-interwork -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -fomit-frame-pointer -fno-dwarf2-cfi-asm -fno-common -fdata-sections -ffunction-sections -Wall -Wno-strict-aliasing -Wno-unused-parameter -specs=nosys.specs"

./configure --prefix="$INSTALL" --build=x86_64-linux --host=arm-none-eabi CC="$CC" --target=arm-none-eabi CFLAGS="$CFLAGS"

make CFLAGS="$CFLAGS"

make check

On executing this the following error was generated.

make[4]: 'test_array' is up to date. make[4]: 'test_chaos' is up to date. make[4]: 'test_copy' is up to date. /bin/bash ../../../libtool --tag=CC --mode=link /bin/arm-none-eabi-gcc -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wno-format-truncation -mthumb -mthumb-interwork -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -fomit-frame-pointer -fno-dwarf2-cfi-asm -fno-common -fdata-sections -ffunction-sections -Wall -Wno-strict-aliasing -Wno-unused-parameter -specs=nosys.specs -static -o test_dump test_dump.o ../../../src/libjansson.la libtool: link: /bin/arm-none-eabi-gcc -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wno-format-truncation -mthumb -mthumb-interwork -mcpu=cortex-m7 -mfpu=fpv5-d16 -mfloat-abi=hard -fomit-frame-pointer -fno-dwarf2-cfi-asm -fno-common -fdata-sections -ffunction-sections -Wall -Wno-strict-aliasing -Wno-unused-parameter -specs=nosys.specs -o test_dump test_dump.o ../../../src/.libs/libjansson.a /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: test_dump.o: in function dumpfd': test_dump.c:(.text.dumpfd+0x14): undefined reference topipe' collect2: error: ld returned 1 exit status make[4]: [Makefile:470: test_dump] Error 1 make[4]: Leaving directory '/home/vagrant/mercury/m7-deps/build/jansson/test/suites/api' make[3]: [Makefile:667: check-am] Error 2 make[3]: Leaving directory '/home/vagrant/mercury/m7-deps/build/jansson/test/suites/api' make[2]: [Makefile:358: check-recursive] Error 1 make[2]: Leaving directory '/home/vagrant/mercury/m7-deps/build/jansson/test/suites' make[1]: [Makefile:567: check-recursive] Error 1 make[1]: Leaving directory '/home/vagrant/mercury/m7-deps/build/jansson/test' make: *** [Makefile:638: check-recursive] Error 1

Any help is appreciated.

ploxiln commented 3 years ago

pipe() is a libc wrapper for a system call, but it seems you are compiling jansson for a microcontroller not running an operating system kernel. This pipe() usage is actually in a test, so if you skip all tests, it should get you past this problem. I'm not sure if there are other bits of jansson that assume an OS kernel and don't work on a microcontroller ...

ploxiln commented 3 years ago

(note that "make check" will also try to run the tests, which won't work, since they're using the compiler for the arm microcontroller, not the compiler for your host system, presumably x86_64 linux)