How to link openssl library with arm-cross compiler

I have a test.c application which, using gcc on the host (on ubuntu) machine, I was able to compile and successfully run the application program on the host.

now I would like to cross-compile the same application with the arm-cross compiler for LPC1788 . please tell me how to link openssl library files

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) 

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) 

leading to these errors

 fatal error: openssl/rsa.h: No such file or directory fatal error: openssl/rsa.h: No such file or directory 

what causes these errors and how to end with them

+1
source share
1 answer

You cannot use host libraries when compiling for another architecture. Firstly, you need to cross-compile all non-standard libraries (libxml, libopenssl) for your target machine (i.e. ARM).

Basically, you need to download the source code for these libraries and configure it with

 --host=arm-uclinuxeabi --prefix=SOME_HOST_DIR 

(or something like that - you can check the README files) assuming you have your own cross-compiler in PATH.

These libraries may also need to compile more libraries.

When compiling the application, you must use these compiled libraries.

0
source

All Articles