in my c code. When I compile it with the gcc compiler, I have no errors,...">

Cross compilation of "OpenSSL" error

I am using include: <openssl / md5.h> in my c code. When I compile it with the gcc compiler, I have no errors, but when I compile it with the arm-linux-gnueabi-gcc cross compiler, I have the following error:

/usr/include/openssl/e_os2.h:56:33: fatal error: openssl/opensslconf.h: No such file or directory compilation terminated. 

I think this error is due to the fact that I do not have openssl libraries in the cross-compiler folder "/ usr / arm-linux-gnueabi-gcc".

Can someone tell me if this is the cause of the error? And how can I install openssl libraries for cross-compiler?

I start with cross-compilation and I don't have much knowledge about this. Thank you for your time!

+9
c linux openssl cross-compiling
source share
4 answers

I know this question is a little old, but since I came up with the same problem, I am going to leave this here for future reference.

I found a solution to manually compile OpenSSL with the cross-compiler installed, and then manually install it in the cross-compilation library folder.

First I installed the cross-compiler (I use Ubuntu 14.04). I installed both the C compiler and the C ++ compiler. I also installed two cross-compiler bindings, one with floating point support (arm-linux-gnueabihf) and one without (arm-linux-gnueabi). Two directories are created (as indicated in the question) /usr/arm-linux-gnueabi and /usr/arm-linux-gnueabihf , where cross-compiled libraries should be installed.

 sudo apt-get install {gcc,g++}-arm-linux-gnueabi{,hf} 

Secondly, I cloned the OpenSSL Git repository and checked the version that interested me (1.0.2):

 git clone https://github.com/openssl/openssl git checkout OpenSSL_1_0_2 # or another version 

Then I set up the cross-compilation environment and changed the installation directory (prefix) and built the library in accordance with the instructions provided in the INSTALL file (and forced to use the specific cross-compilation toolchain):

 export CROSS=arm-linux-gnueabi # or arm-linux-gnueabihf export AR=${CROSS}-ar export AS=${CROSS}-as export CC=${CROSS}-gcc export CXX=${CROSS}-g++ export LD=${CROSS}-ld ./Configure --prefix=/usr/${CROSS} os/compiler:${CC} make sudo make install 

You can repeat the process and compile both arm-linux-gnueabi ( arm-linux-gnueabi and arm-linux-gnueabihf ).

Hope this helps.

+11
source share

In my case, the exact same error message (but I collected 32 bits on a 64 bit machine). I solved this with installing a different architecture:

 apt-get install libssl-dev:i386 
+1
source share

Libraries once created for a particular platform will be for a specific platform and can only be used on another platform if its binary is compatible.

For cross-compilation, you may need binaries for different platforms.

Regarding this error, it seems that you did not mention include path for OpenSSL header files.

Without libraries, you will get a linker error, not a compiler error.

In this case, the compiler somehow cannot find the header files. Therefore, make sure that the include path is included.

0
source share
 sudo apt install libssl-dev 

this also works for some Oddball Linux distributions.

0
source share

All Articles