Tuesday, March 15, 2022

[SOLVED] Redhat Linux - SO file not found

Issue

I am having trouble when running my compiled C++ code on linux. It worked fine on Ubuntu when I used the line:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../irrklang/lib/linux-gcc-64/

Before running my program. If I don't do this I receive an error:

./main: error while loading shared libraries: libIrrKlang.so: cannot open shared object file: No such file or directory

On the version of Redhat I am using, it is a Uni PC and it has to run here. Running the export command above results in:

Bad : modifier in $ (.).

I've also tried:

ldconfig -l ../irrklang/lib/linux-gcc-64/libIrrKlang.so

But that did not work either. I'm not sure what else to try to get my program working.

EDIT:

I've just tried this:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:"../irrklang/lib/linux-gcc-64/"

But this said that LD_LIBRARY_PATH is undefined


Solution

user2672165 pointed me in the right direction. The shell was tcsh which required me to set the LD_LIBRARY_PATH with:

setenv LD_LIBRARY_PATH "../irrklang/lib/linux-gcc-64/"

Another work around was to use bash for the export command and ./run



Answered By - Lame
Answer Checked By - Mary Flores (WPSolving Volunteer)