Cannot run Code::Blocks: libwx_gtk2u-2.8.so.0 not found

Christoph picture Christoph · Aug 26, 2011 · Viewed 9.7k times · Source

I am trying to install Code::Blocks 10.05 from (non-SVN) sources (codeblocks-10.05-src.tar.bz2). My OS is Ubuntu 11.04. I needed to download and install wxWidgets first (I now have wxGTK-2.8.12), which seemed to work. I compiled it according to these instructions:

http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux

Then I configured C::B with

./configure --with-wx-config=/opt/wx/2.8/bin/wx-config

and ran

export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install

When trying to run C::B, I get the following error:

codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory

The same question was asked here: error while loading shared libraries, but the suggested solution (namely adding the wxWidgets config to the options passed to configure) didn't work for me.

The output of wx-config --prefix is /opt/wx/2.8,

The output of wx-config --libs is -L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8,

and that of which wx-config is /opt/wx/2.8/bin/wx-config.

I looked for the library and found /opt/wx/lib/libwx_gtk2u-2.8.so.0 to be a link to libwx_gtk2u-2.8.so.0.8.0 in the same folder.

What might be wrong here?

Answer

RobertoP picture RobertoP · Aug 30, 2011

The problem is that the program cannot find the WX widgets libraries at run time. You will need to set your LD_LIBRARY_PATH variable to include the location of wxWidgets like this:

LD_LIBRARY_PATH=/opt/wx/2.8/lib ./codeblocks

The reason why its failing is because you compiled codeblocks against wxWidgets found in /opt/ and not the one installed in /usr/; the program doesn't know to look in /opt for the wx libraries.