0

I'm tryng to compile a program that links openssl library. When I compile dynamically I get no problems. The problems come up when I add -static flag, i get this error :

gcc -g -static -static-libgcc -static-libstdc++ -o hmac-sha1-bios-x64 ../main.c -lcrypto -lm /usr/bin/ld: impossibile trovare -lcrypto collect2: error: ld returned 1 exit status Makefile:10: set di istruzioni per l'obiettivo "hmac-sha1-bios-x64" non riuscito make: *** [hmac-sha1-bios-x64] Errore 1 

Has anyone any ideas how to compile statically openssl libraries ?

I looked for some references to libcrypto.a in /usr/lib, but I got only libcrypt.a. I'm working on an archlinux, is it possible the official openssl archlinux package doesn't include the needed files to compiple statically ?

2
  • It probably means there is no static version of libcrypto? Commented Sep 15, 2015 at 10:47
  • So, the only way to make it work it's to compile by myself the libraries, isn't it ? But it's weird, the official archlinux package is compiled with the shared option, and here (wiki.openssl.org/index.php/Compilation_and_Installation) it's written : Build a shared object in addition to the static archive Commented Sep 15, 2015 at 10:55

1 Answer 1

2

Ok, I resolved. During the creation of openssl package, all static libs are deleted. The only way is to download the PKGBUILD, then add the "staticlibs" to the options field :

options=('!makeflags' 'staticlibs') 

In this way the package is rebuild with static libs and it should work.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.