I am able to build swupdate using Yocto but it fails when suricatta is enabled because it cannot find -ljson-c

125 views Asked by At

I can build swupdate without suricatta but when I enable it, fails to find -ljson-c.
I am using ubuntu 20.04 and yocto kirkstone, with an A55 processor.

The problem is normally that libjson-c-dev has not not being installed using apt. This is not the case, I can see the headers and the libraries.

This is the cmdline used by bitbake

aarch64-elytone_nav-linux-gcc -mcpu=cortex-a55 -march=armv8.2-a+crypto -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/recipe-sysroot -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wno-format-truncation -Wold-style-definition -finline-limit=0 -fno-builtin-strlen -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -static-libgcc -fno-unwind-tables -fno-asynchronous-unwind-tables -Os -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0=/usr/src/debug/swupdate/2023.05-r0 -fdebug-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0=/usr/src/debug/swupdate/2023.05-r0 -fdebug-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/recipe-sysroot= -fdebug-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/recipe-sysroot-native= -flto -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0=/usr/src/debug/swupdate/2023.05-r0 -fdebug-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0=/usr/src/debug/swupdate/2023.05-r0 -fdebug-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/recipe-sysroot= -fdebug-prefix-map=/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/recipe-sysroot-native= -Wl,-z,relro,-z,now -flto -L/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/build -o tools/swupdate-progress -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--gc-sections -Wl,--start-group tools/swupdate-progress.o corelib/lib.a mongoose/lib.a parser/lib.a fs/lib.a -Wl,--end-group -Wl,--start-group -lpthread -lcurl -lconfig -ljson-c -lcrypto -lssl -lubi -lmtd -lz -ldl -l:libswupdate.so.0.1 -Wl,--end-group

This is the error shown, it cannot find libjson.

`your text`/gxp/build/tmp/work/cortexa55-elytone_nav-linux/swupdate/2023.05-r0/recipe-sysroot-native/usr/bin/aarch64-elytone_nav-linux/../../libexec/aarch64-elytone_nav-linux/gcc/aarch64-elytone_nav-linux/11.2.0/ld: 
cannot find -ljson-c: No such file or directory`

I have checked the headers and libs are installed

find /usr/lib -name libjson*
/usr/lib/x86_64-linux-gnu/libjson-c.a
/usr/lib/x86_64-linux-gnu/libjson-c.so.4
/usr/lib/x86_64-linux-gnu/libjson-c.so.4.0.0
/usr/lib/x86_64-linux-gnu/libjson-c.so

I have checked the search path and that matches the path for the libjson-c libs.

ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012
SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu")
SEARCH_DIR("=/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu64")
SEARCH_DIR("=/usr/local/lib64")
SEARCH_DIR("=/lib64")
SEARCH_DIR("=/usr/lib64")
SEARCH_DIR("=/usr/local/lib")
SEARCH_DIR("=/lib")
SEARCH_DIR("=/usr/lib")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib64")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib")

I have checked the libraries are in the correct format.

I checked libcrypt and libjson-c library as libcrpt is found and is in the same directory as libjson-c.
objdump -h /usr/lib/x86_64-linux-gnu/libjson-c.a
file format elf64-x86-64
objdump -h /usr/lib/x86_64-linux-gnu/libcrypt.a
file format elf64-x86-64

Can anybody suggest how to analyse why it is not finding this one library ?

0

There are 0 answers