【问题标题】:cryptopp on centos4.8 segmentation fault when link with pthread与 pthread 链接时,centos4.8 上的 cryptopp 分段错误
【发布时间】:2013-12-29 22:42:18
【问题描述】:

我有一个程序在 centos4.8 上编译并运行。我已将cryptopp 5.6.2 下载并编译到一个静态库中。运行测试程序时,我在调用

时遇到分段错误
CTR_Mode< AES >::Encryption e;
e.SetKeyWithIV( key, key.size(), ctr ); // segmentation fault here

我可以在一个小程序中重新创建它。如果我与 libpthread.a 链接,则会出现错误,如果我不与它链接,程序会按预期运行。

我的应用程序依赖于与 pthread 的链接,所以我希望找到一种方法来编译兼容的 cryptopp。 谢谢

【问题讨论】:

  • 假设您使用的是 g++,您是像 g++ &lt;code&gt; -o &lt;output&gt; -pthread 那样链接还是使用 -lpthread?您应该使用不带“l”的-pthread
  • 这是我的编译批处理 g++ -g -o testcrypto \ testmod.c \ -lstdc++ -lcryptopp -static -pthread
  • 更多信息...在制作cryptopp库时,我运行make static test。如果我运行 aes ctr test "cryptest.exe ae 00000000000000000000000000000000 0000000000000000000000000000000000 myfile.txt myfile.encrypted" 没有分段错误
  • 附加信息...如果我删除 -static 则测试程序编译并运行正常。将在我们的完整应用程序中调查对此的需求
  • 更多信息...如果我强制 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION 一切似乎都正常

标签: c++ linux centos crypto++


【解决方案1】:

看来……

在带有 gcc 3.4.6 cryptopp 的 CentOS 4.8 上,静态链接时需要 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION。希望这可以节省一些时间!

【讨论】:

    猜你喜欢
    • 2015-06-29
    • 2014-03-26
    • 2012-09-10
    • 1970-01-01
    • 2016-11-05
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2012-09-07
    相关资源
    最近更新 更多