c++ - cryptopp 外部库依赖

标签 c++ cabal archlinux crypto++ happstack

我尝试在 Arch Linux (3.12.9) 上通过 cabal 安装 happstack-server-tls 软件包,但收到此错误:

Resolving dependencies...
Configuring happstack-server-tls-7.1.0...
Failed to install happstack-server-tls-7.1.0
Last 10 lines of the build log ( /home/boris/.cabal/logs/happstack-server-tls-7.1.0.log ):
Configuring happstack-server-tls-7.1.0...
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
setup-Cabal-1.16.0-x86_64-linux-ghc-7.6.3: Missing dependency on a foreign
library:
* Missing C library: cryptopp
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
happstack-server-tls-7.1.0 failed during the configure step. The exception
was:
ExitFailure 1

第一次看到这个错误消息后,我通过 pacman 安装了 crypto++。但这对我没有帮助。

我什至尝试过这个:

$ whereis libcryptopp.a                                                                                           
libcryptopp: /usr/lib/libcryptopp.so
$ cabal install happstack-server-tls --extra-include-dirs=/usr/lib/ --extra-lib-dirs=/usr/lib/

但还是没有运气。

我检查了 crypto++ lib 是否适用于此 test.cpp 文件:

#include <iostream>
using std::cout;
using std::endl;

#include "cryptopp/integer.h"
using CryptoPP::Integer;

int main( int, char** ) {

    Integer i;

    cout << "i: " << i << endl;

    return 0;
}

并且使用 g++ -g3 -ggdb -O0 -Wall -Wextra -Wno-unused -o test test.cpp -lcryptopp -pthread test.cpp 编译良好。

然后我尝试

$ cd /usr/lib
$ g++ -fpic -nostartfiles -nostdlib -shared libcryptopp.so -o libcryptopp.dylib

但是,还是没有运气。

有人遇到过这个问题吗?有没有什么解决办法呢?

最佳答案

运行cabal unpack happstack-server-tls以获取源代码并将其解压到本地目录中。然后编辑 happstack-server-tls.cabal 并尝试删除这些行:

if !os(darwin)
    Extra-Libraries: cryptopp

关于c++ - cryptopp 外部库依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22343259/

相关文章:

java - SWIG java : releasing memory allocated in c++

c++ - CMake在编译使用OpenCV的项目时遇到问题

java - 如何在 Arch Linux 上安装 Java

ssl - 在 Archlinux 中删除 DST_Root_CA_X3

linux - Antergos Linux 上的 "OPENSSL_1.0.0 not found"

C++ - 使用#include <ClassName> 而不是#include <classname.h> 有好处吗?

c++ - 如果我没有为其相应命令声明消息映射条目,如何阻止 MFC 禁用我的控件?

Haskell 堆栈与全局 ghc

windows - 在 Windows 上安装 Haskell,cabal 配置

haskell - 由于路径长度限制,我如何解决 Windows 上的 cabal 沙箱构建错误?