vam
vam

Reputation: 63

Unable to load library from custom paths during compilation

I am working on cross compiling my code base for QNX aarch64 architecture on x86_64 host.

The gcc version i am using is 12.2 where it expects minimum glib version as 2.25 as per error :-

lib/gcc/aarch64-unknown-nto-qnx8.0.0/12.2.0/cc1:  /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by lib/gcc/aarch64-unknown-nto-qnx8.0.0/12.2.0/cc1)

/lib/x86_64-linux-gnu/libc.so.6 => is basically with version 2.23

So i have to workaround this by loading glibc (libc.so) and other libraries from my custom path where i have required version of libc.so.6 with version 2.36. I found this answer useful and try to load the libraries accordingly and here is my compilation command :-

/home/unix-build/lib64/ld-linux-x86-64.so.2 --library-path /home/unix-build/lib64 /home/usr/bin/qcc -V12.2.0,gcc_ntoaarch64le -fdata-sections -ffunction-sections -DSTD_NOWINSOCK2 -DRELEASE -DNDEBUG  -o threadsMessageDefs.o -c /llvm/repo/../../utilities/threads/threadsMessageDefs.c 

/home/unix-build/lib64 => contains all required libraries that satisfices including libc.so.6 (2.36 version).

Some reason libraries are not getting loading from /home/unix-build/lib64. I still face the same issue where lib/gcc/aarch64-unknown-nto-qnx8.0.0/12.2.0/cc1 is referring to system path /lib/x86_64-linux-gnu/libc.so.6

Do i need to follow different approach for QNX? Am i missing something? Please advice.

Upvotes: 0

Views: 112

Answers (1)

Employed Russian
Employed Russian

Reputation: 213955

/lib/x86_64-linux-gnu/libc.so.6 => is basically with version 2.23

There is no basically here -- either it's 2.23 or it isn't.

So i have to workaround this by loading glibc (libc.so) and other libraries from my custom path

You don't have to, you are choosing to.

The correct solution is to either

  • rebuild gcc-12.2 on your system, so it just works (TM), or
  • if you insist on using pre-built gcc-12.2, upgrade your system to be compatible with it (i.e. upgrade to something using GLIBC-2.25 or above).

I still face the same issue where lib/gcc/aarch64-unknown-nto-qnx8.0.0/12.2.0/cc1 is referring to system path /lib/x86_64-linux-gnu/libc.so.6

You are facing the same issue because the command you used affects qcc (the frontend) and only qcc. It does not affect any subprocesses qcc creates (the cc1 here).

Upvotes: 0

Related Questions