【问题标题】:How to use ported library in NaCl module?如何在 NaCl 模块中使用移植库?
【发布时间】:2014-04-24 13:53:12
【问题描述】:
我想在我的 NaCl 模块中使用 openssl 库。幸运的是,它已经像 https://code.google.com/p/naclports/ 一样被移植了。但是,有点可惜,但我不知道如何将库添加到工具链中。我按照Readme 文件中的指示做了:
...nacl_sdk/pepper_33/naclports/src$ python build_tools/naclports.py install openssl
已经安装 'openssl' [x86_64/newlib]
然后我尝试编译这个简单的 C code,编译器抱怨一些错误是因为与 openssl/evp.h 的链接问题。
这是我的 Makefile:link。请告诉我如何让它运行。
【问题讨论】:
标签:
c++
c
native-code
google-nativeclient
【解决方案1】:
NaCl 实际上由几个不同的工具链组成。 naclports 将构建并安装一个给定的库到其中一个。库和头文件直接安装到工具链中,因此无需在命令行中使用 -L 或 -I。
在这种情况下,您已经构建并安装了 x86_64 newlib 版本的 openssl。这意味着您应该能够构建应用的 x86_64 newlib 版本(将 TOOLCHAIN=newlib NACL_ARCH=x86_64 添加到您的 make 调用中)。
要构建所有其他版本的 openssh,您可以使用 naclports 顶层的“make_all.sh”脚本(例如 ./make_all.sh openssl)。
【解决方案2】:
构建 naclports。查看 naclports/README.rst 中的说明。