2

Following the instructions given here, I’ve downloaded the latest version of OpenSSL (openssl-1.0.1e.tar.gz) from here and installed it on Ubuntu v12.10 (32-bit).

I have a C project in Eclipse CDT (v1.2.0.201212170456) that statically links to the following two .a files:

  • home/usr/local/ssl/lib/libcrypto.a
  • home/usr/local/ssl/lib/ libssl.a

However when I build my project I get these errors:

/home/tashimaya/Applications/CodeSourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/ssl/lib/libssl.a when searching for -lssl /home/tashimaya/Applications/CodeSourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find –lssl 

My toolchain is CodeSourcery (Sourcery G++ Lite 2010q1-202) and is for 32-bit OS.

What am I doing wrong?

Compiler command line I'm using:

arm-none-linux-gnueabi-gcc -I"/path to my/include" -O0 -g3 -Wall -c -fmessage-length=0 -v -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.c" 
2
  • What's your target architecture? Is it x86? Or ARM? Are you cross-compiling? When you say Ubuntu 12.10 32-bit, is it ARM? Commented Mar 1, 2013 at 13:53
  • My target architecture is ARM. I've installed Ubuntu on VMware running on Windows 7 32 bit machine. Commented Mar 1, 2013 at 14:02

2 Answers 2

3

You have installed OpenSSL on an Ubuntu 32-bit machine (assuming x86), but are trying to link it to an ARM binary:

  • /home/tashimaya/Applications/CodeSourcery/bin/../lib/gcc/arm-none-linux-gnueabi: your ARM toolchain
  • /usr/local/ssl/lib/libssl.a: a 32-bit x86 version of OpenSSL

You will have to cross-compile OpenSSL for ARM using your ARM toolchain (i.e.: arm-none-linux-gnueabi-gcc), then you will be able to link it to an ARM binary.

Sign up to request clarification or add additional context in comments.

2 Comments

Would you be able to tell me how to build OpenSSL using arm-none-linux-gnueabi-gcc? I've tried "make CC=arm-none-linux-gnueabi-gcc" but this doesn't seem to work.
@jpen: Try providing the absolute path to the compiler. And make clean beforehand.
0

It says that /usr/local/ssl/lib/libssl.a is not in the size expected. Try file on it to check if you compiled it in 32 or 64 bit version. And check how you are compiling your own program too. If both matches linker (ld) will link it fine.

If you compile your program into 64 bit and link it with libssl.a in 32 bit, this will not work

example:

file a.out

/* kind ofoutput */ a.out: Mach-O 64-bit executable x86_64 

http://unixhelp.ed.ac.uk/CGI/man-cgi?file

7 Comments

Thanks for your suggestion. Running "/usr/local/ssl/lib$ file libssl.a" gives this output "libssl.a: current ar archive". How do I get more information abou the file?
Strange that output well on mac. Then try lipo -info myFile.a, you'll get the architecture too.
I've tried "objdump -f libcrypto.a". Looks like my libssl.a are for 32-bit so is my C project.
Are you sure they are the same architecture? Can you show the compiler actual command wich you are compiling your c code?
Please see my original post. I've updated it with my compiler command line. I've tried running "file main.o" and I get "main.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped"
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.