克服DLL地狱与code :: Blocks的 [英] Overcome DLL Hell with Code::Blocks

查看:349
本文介绍了克服DLL地狱与code :: Blocks的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用code :: Blocks的一个项目。我没有在Linux上使用的IDE多年来,所以我有点不使用Linux的IDE脱节。

I'm using Code::Blocks for a project. I have not used an IDE on Linux in years, so I'm a bit out of touch with Linux IDEs.

我与使用FIPS验证的库中OpenSSL的项目。我复制GCC编译器工具链和修改它使用OpenSSL的 fipsld (并将其设置为默认值)。

I'm working with an OpenSSL project that uses FIPS validated library. I duplicated the GCC compiler toolchain and modified it to use OpenSSL's fipsld (and set it as default).

在项目的code下code执行:: Blocks的通过<大骨节病> F8 FIPS_mode_set 失败,错误252104805(0xF06D065) 。 0xF06D065是:

When the project's code executes under Code::Blocks via F8, FIPS_mode_set fails with error 252104805 (0xF06D065). 0xF06D065 is:

$ openssl errstr 0xF06D065
error:0F06D065:common libcrypto routines:FIPS_mode_set:fips mode not supported

这告诉我,code :: Blocks的未使用OpenSSL的我在指定的/ usr /本地/ SSL / lib目录。相反,程序正在使用Debian是在 / usr / lib目录/ x86_64的-Linux的GNU /

which tells me Code::Blocks is not using the OpenSSL I specified in /usr/local/ssl/lib. Rather, the program is using the non-FIPS library provided by Debian in /usr/lib/x86_64-linux-gnu/.

的链接库设置的图像如下。请注意,库完全指定,并没有什么侥幸心理。

An image of the link library settings is below. Note that the libraries are fully specified, and nothing is left to chance.

$ C $个cblocks显然做的事情 LD_LIBRARY_PATH (如下图所示)。

CodeBlocks is clearly doing things with LD_LIBRARY_PATH (shown below).

我也验证项目是否使用了正确的搜索目录 - 的/ usr /本地/ SSL /包括页眉和的/ usr /本地/ SSL / lib目录链接器。

I've also verified the project is using the correct search directories - /usr/local/ssl/include for headers and /usr/local/ssl/lib for the linker.

使用编译器的日志记录设置为完整的命令行载,这里就是我从生成日志得到:

With compiler logging set to "Full Command Line" set, here's what I get from the build log:

-------------- Build: Debug in ac ---------------

Compiling: main.cpp
/home/jwalton/Desktop/ac/main.cpp:8:5: warning: unused parameter ‘argc’ [-Wunused-parameter]
/home/jwalton/Desktop/ac/main.cpp:8:5: warning: unused parameter ‘argv’ [-Wunused-parameter]
Linking console executable: bin/Debug/ac
Output size is 569.67 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 2 warnings

我所知道的巴西莱Starynkevitch的建议在 rpath的 LD_ preLOAD 的招数,但这似乎是那些事的IDE应为处理我一个(Visual Studio将妥善处理它,甚至给了我们一个输入框的设置工作目录找到额外的库的)。

I'm aware of Basile Starynkevitch's suggestions on rpath's and LD_PRELOAD tricks, but this seems like one of those things the IDE should be handling for me (Visual Studio will handle it properly, and even gives us an input box to set Working Directories to find additional libraries).

任何想法如何使code :: Blocks的使用共享对象的/ usr /本地/ SSL / lib目录在调试器下执行程序时?

Any ideas how to make Code::Blocks use the shared objects in /usr/local/ssl/lib when executing the program under the debugger?

推荐答案

您IDE指示编译器针对指定库链接,的而不是他们在运行时的加载。对于发生后一件事,你需要通过另一种选择链接器,即

Your IDE instructs the compiler to link against the specified libraries, but not to load them at run time. For this latter thing to happen, you need to pass another option to the linker, namely

-rpath=/path/to/directory/with/your/libraries

,或者,如果接头是由编译器调用,

or, if the linker is invoked by the compiler,

-Wl,-rpath=/same/thing

这篇关于克服DLL地狱与code :: Blocks的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆