无法运行代码::块:找不到 libwx_gtk2u-2.8.so.0
我正在尝试从(非 SVN)源(codeblocks-10.05-src.tar.bz2)安装 Code::Blocks 10.05。我的操作系统是 Ubuntu 11.04。我需要先下载并安装wxWidgets(我现在有wxGTK-2.8.12),这似乎有效。我根据以下说明编译了它:
http://wiki.codeblocks.org /index.php?title=Installing_Code::Blocks_from_source_on_Linux
然后我配置了 C::B
./configure --with-wx-config=/opt/wx/2.8/bin/wx-config
并运行
export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install
当尝试运行 C::B 时,出现以下错误:
codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory
这里提出了同样的问题:加载共享库时出错,但是建议的解决方案(即,将 wxWidgets 配置添加到传递给 configure
的选项中)对我来说不起作用。
wx-config --prefix
的输出为 /opt/wx/2.8
,wx-config
--libs 的输出为 >-L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8
,
以及 which wx-config
的内容/opt/wx/2.8/bin/wx-config
。
我查找了该库,发现 /opt/wx/lib/libwx_gtk2u-2.8.so.0
是指向 libwx_gtk2u-2.8.so.0.8.0
的链接同一个文件夹。
这里可能出了什么问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
问题是程序在运行时无法找到WX widgets 库。您需要设置 LD_LIBRARY_PATH 变量以包含 wxWidgets 的位置,如下所示:
其失败的原因是您针对 /opt/ 中找到的 wxWidgets 编译了代码块,而不是针对 /usr/ 中安装的代码块;该程序不知道在 /opt 中查找 wx 库。
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:
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.
在 Ubuntu 上启动并运行 code::blocks 的最简单方法可能是通过 Synaptic 包管理器安装它。只需在“快速搜索”中输入代码块即可。在列表中找到代码块,然后右键单击即可标记安装。 Synaptic 将根据需要自动处理和安装所需的任何依赖项和缺失的库。
如果您有兴趣在 Ubuntu 上尝试 C::B nightly 版本,那么您需要查看 Jens 的非官方 debian-存储库在这里。
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.
您可以访问 为什么每次运行应用程序时都必须使用导出来定义 LD_LIBRARY_PATH? 对于更通用的情况。对于像您这样的特定情况,您可以按照下面给出的步骤进行操作。
如果您已经安装了 wxGTK,那么您将在 /usr/local/lib 中看到该文件。当上述路径不是 makefile 的一部分时,您会收到此错误。我在 CentOS 上从源代码构建后启动 wxFormBuilder 时收到此错误。有两种方法。
方法1:将路径放入.bashrc中
然后在 # 用户特定别名和函数行后面粘贴以下内容
这对于当前登录来说效果很好,但对于 root 用户等其他用户,您可能必须在相应的 .bashrc 文件中执行相同的操作。
方法 2: 创建您自己的conf文件
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
Then after the line # User specific aliases and functions paste the following
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