I am seeing the following errors loading my LD_preload library
ERROR: ld.so: object '/nobackup/sarvi/cel8root/${LIB}/libwisktrack.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
I have an LD_PRELOAD library libwisktrack.so. It has been compiled for both 32 bit and 64 bit and have been organized as follows
/usr/lib -> /usr/lib32
/usr/lib32/libwisktrack.so
/usr/lib64/libwisktrack.so
passing the following
LD_PREOAD=/usr/$LIB/libwisktrack.so ls -al
works fine for executable binaries that are built for 32 bit or 64 bit
bash-4.4$ file /usr/bin/ls
/usr/bin/ls: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=937708964f0f7e3673465d7749d6cf6a2601dea2, stripped, too many notes (256)
But as part of our build system, we have some tools that are compiled into the workspace specifically for 64 bit. They are compiled with their own ld-linux-x86-64.so.2 which seems to expects 64 bit library in /usr/lib
bash-4.4$ file /nobackup/sarvi/xewisktest/binos/linkfarm/x86_64_cge7/sysroot-host/usr/bin/pseudo
/nobackup/sarvi/xewisktest/binos/linkfarm/x86_64_cge7/sysroot-host/usr/bin/pseudo: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /nobackup/sarvi/xewisktest/binos/linkfarm/x86_64_cge7/sdk/sysroots/x86_64-xesdk-linux/lib/ld-linux-x86-64.so.2, BuildID[sha1]=b64aae37205ce835e321cb00191e65f53ef7adaa, for GNU/Linux 2.6.32, stripped
What is the best way to make sure that the right libwisktrack.so gets loaded and in both these environments?
Also, if I setup
LD_PRELOAD=/usr/lib64/libwisktrack.so:/usr/lib32/libwisktrack.so
would that a problem? I understand one of them will error out. But this error does not seem to be failing the system
Also, if I had the same library twice, for different bit compilations or the same bit compilations, will the program get loaded twice ?
LD_PRELOAD=/usr/lib64/libwisktrack.so:/usr/lib32/libwisktrack.so
OR
LD_PRELOAD=/usr/lib32/libwisktrack.so:/usr/lib32/libwisktrack.so