如何OpenSSL库用手臂交叉编译器链接 [英] how to link the openssl library with the arm-cross compiler
问题描述
我的应用程序test.c以它通过使用主机的gcc(在Ubuntu)的机器我已经在编译成功,并成功运行在主机上的应用程序。
I have application test.c which by using gcc on host(on ubuntu) machine i have succeed in compilation and successfully ran the application program on host.
现在我想交叉编译与ARM的交叉编译器相同的应用程序的 LPC1788
。请指导我如何OpenSSL库文件链接
now I would like to cross compile the same application with arm-cross compiler for LPC1788
. please guide me how to link the openssl library files
我Mkakefile与海湾合作委员会
My Mkakefile with GCC
CC = gcc
CFLAGS = -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1
-DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -I/usr/include/xmlsec1
-I/usr/include/libxml2 -DXMLSEC_OPENSSL_097=1
-DXMLSEC_CRYPTO_OPENSSL=1 -DXMLSEC_CRYPTO=\"openssl\ -DUNIX_SOCKETS -D XML_SECURITY
LDFLAGS = -lcrypto -I/usr/include/libxml2 -lxml2 -I/usr/include/xmlsec1 -lxmlsec1
all:
$(CC) src/test.c -o test $(CFLAGS) $(LDFLAGS)
通过改变编译器我用下面的Makefile
by changing the compiler I used the following Makefile
CC = /home/amarayya/doc/tools/arm-2010q1/bin/arm-uclinuxeabi-gcc
CFLAGS = -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1
-DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -I/usr/include/xmlsec1
-I/usr/include/libxml2 -DXMLSEC_OPENSSL_097=1
-DXMLSEC_CRYPTO_OPENSSL=1 -DXMLSEC_CRYPTO=\"openssl\ -DUNIX_SOCKETS -D XML_SECURITY
LDFLAGS = -lcrypto -L/usr/include/libxml2 -lxml2 -L/usr/include/xmlsec1 -lxmlsec1
all:
$(CC) src/test.c -o test $(CFLAGS) $(LDFLAGS)
这导致这些错误
fatal error: openssl/rsa.h: No such file or directory
fatal error: openssl/rsa.h: No such file or directory
什么导致这些错误,以及如何你过来吧。
what causing these errors and how to over come
推荐答案
编译为一个不同的体系结构时,您不能使用你的主机库。首先,你需要交叉编译所有非标准库(libxml的,libopenssl)为你的目标机器(即ARM)。
You cannot use your host libraries when compiling for a different architecture. First, you need to cross compile all non-standard libraries (libxml, libopenssl) for your target machine (i.e. ARM).
基本上,你需要下载源$ C $ C这些库,并配置它
Basically, you need to download the source code for these libraries and configure it with
--host=arm-uclinuxeabi --prefix=SOME_HOST_DIR
(或类似的东西 - 你可以检查下的README文件)
假设,你已经在你的PATH交叉编译器。
(or something similar - you might check the README files) assuming, that you have your cross compiler in PATH.
这些库可能还需要更多的图书馆进行交叉编译。
These libraries might also require more libraries to be cross compiled.
当编译应用程序,你应该使用这些交叉编译的库。
When compiling your application you should use these cross compiled libraries.
这篇关于如何OpenSSL库用手臂交叉编译器链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!