开发者

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

开发者 https://www.devze.com 2023-03-30 21:07 出处:网络
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), whic

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

Wh开发者_如何学Pythonen 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?


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.


Probably the easiest way to get code::blocks up and running on Ubuntu is to just install it via the Synaptic Package Manager. Just type in codeblocks into 'Quick search'. Find codeblocks on the list and just right-click to mark for install. Any dependencies and missing libraries needed will automatically be handled and installed by Synaptic as necessary.

If you're interested in trying the C::B nightly builds on Ubuntu then you'll want to checkout Jens' unofficial debian-repository here.


You can visit Why do I have to define LD_LIBRARY_PATH with an export every time I run my application? for a more generic case. For a particular case like yours you can follow the below given steps

If you had installed wxGTK then you would see the file in /usr/local/lib. You would get this error when the the above path is not as part of the makefile. I received this error while starting wxFormBuilder after building from source on CentOS. There are 2 approaches.

Approach 1: Putting the path in .bashrc

gedit /home/{your-username}/.bashrc

Then after the line # User specific aliases and functions paste the following

export $LD_LIBRARY_PATH=/usr/local/lib.

This would work for fine but for the current login, but for other users like root you might have to do the same in the respective .bashrc files.

Approach 2: Creating your own conf files

cd /etc/ld.so.conf.d

gedit wxformbuilder.conf

Give the path /usr/local/lib and save the file.

ldconfig (To update the library path).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号