error while loading shared libraries

2019-08-28 17:55发布

问题:

I'm trying to install Code::Blocks from source. There is an `anarchy' folder on my university's CS department's mainframe, where anyone can install anything, basically.

wxwidgets is a dependency of Code::Blocks, and I'm trying to put wxGTK, as it's called, into my own folder on `anarchy', which works fine.

I then compile Code::Blocks with the correct configure flags so that it recognizes wxwidgets 2.8 during the installation. But then, when I want to run `codeblocks', it says

codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0

Obviously I don't have su access as I am only a student at the university. Is there a way to resolve this without su privileges? They are Debian 5.0 systems, I believe, with all dependencies but wxwidgets, so I had to build that on my own.

回答1:

This is how I solved this:

First I ran the configure script like this:

$ ./configure --prefix=/pub/anarchy/<myname>/codeblocks --with-wx-config=/pub/anarchy/<myname>/wxGTK/bin/wx-config

then:

$ export LDFLAGS="-Wl,-R /pub/anarchy/<myname>/wxGTK/lib"
$ make
$ make install

Now codeblocks finds libwx_gtk2u-2.8.so.0.

An alternative solution (untested) according to comments would be:

$ ./configure LDFLAGS="-Wl,-R /path/to/wxGTK/lib" # other configure flags omitted
$ make
$ make install