arm-none-linux-gnueabihf-gcc does not detect soname libraries even though path to the directory is set.

Hi All,

I have downloaded gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf.tar.xz toolchain and extracted it into ~/toolchains/armhf directory.

I have set the PATH to point to  ~/toolchains/armhf/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin directory.

Please look at my linker command and the error (warning):

arm-none-linux-gnueabihf-gcc -o bin/update-service ./obj/us_db.o ./obj/us_web.o ./obj/us_disk_and_install.o ./obj/us_archive.o ./obj/us_update_service.o ./obj/main.o -lglib-2.0 -lzlog -lsqlite3 -lsoup-2.4 -lgio-2.0 -ljson-glib-1.0 -lgobject-2.0 -larchive -L/usr/lib/arm-linux-gnueabihf/ -L/usr/local/armhf/byos_zlog_1.2.13/lib -lm -Wl,-soname,/usr/lib/arm-linux-gnueabihf/libpcre.so.3
/home/eugene/toolchains/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/../lib/gcc/arm-none-linux-gnueabihf/9.2.1/../../../../arm-none-linux-gnueabihf/bin/ld: warning: libpcre.so.3, needed by /usr/lib/arm-linux-gnueabihf//libglib-2.0.so, not found (try using -rpath or -rpath-link)

The soname library /usr/lib/arm-linux-gnueabihf/libpcre.so.3 exists.

I have the same issue for about dozen of soname libraries (and only for soname libraries).

I resolve this issue by using in the linker command full paths for those soname libraries:

arm-none-linux-gnueabihf-gcc -o bin/update-service ./obj/us_db.o ./obj/us_web.o ./obj/us_disk_and_install.o ./obj/us_archive.o ./obj/us_update_service.o ./obj/main.o -lglib-2.0 -lzlog -lsqlite3 -lsoup-2.4 -lgio-2.0 -ljson-glib-1.0 -lgobject-2.0 -larchive /usr/lib/arm-linux-gnueabihf/libpcre.so.3 -L/usr/lib/arm-linux-gnueabihf/ -L/usr/local/armhf/byos_zlog_1.2.13/lib -lm

As far as I know, the -L option is used for defining paths to the shared objects, but not for sonam, and according to my tests (and the linker commands above) defining path to libraries does not help the linker to detect soname libraries located there.

Is there a shortcut to define the path to soname libraries instead of listing full path to each one of them in the linker command?

Thanks in advance!

More questions in this forum