I'm trying to build OpemCV from source, and surround it in Klocwork static code analysis tool. One of the steps is to build the project and invoke kwinject so it will create a file later to be used for analysis. Within the /home/user/opencv_build/opencv/build directory I'm running:

kwinject sudo make

Problem is I get the following error at the beginning of the build:

ERROR: ld.so: object 'libkwinject.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

The .so file is located in 2 locations: /home/ubuntu/klocwork/lib/ix86-pc-linux/libkwinject.so /home/ubuntu/klocwork/lib64/ix86-pc-linux/libkwinject.so

I added the first full path to the LD_PRELOAD variable but I still get the same error mentioned above

I'm using Ubuntu 22.04

1

There are 1 best solutions below

0
On

I had the same issue and solved it by setting the LD_PRELOAD before running kwinject. In order that in the second step kwbuildproject does not fail I had after to unset it...

# ERROR: ld.so: object 'libkwinject.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
#64
LD_PRELOAD=/path_to_64_bit_version/lib64/ix86-pc-linux/libkwinject.so
#32
#LD_PRELOAD=/path_to_32_bit_version/lib/ix86-pc-linux/libkwinject.so
export LD_PRELOAD

kwinject -o ./kwinject.out sh ./compile_my_target.sh

unset LD_PRELOAD

This was done on Ubuntu 20.04 and Klocwork 2020.4.