However, the problem is that I can not link to *any* functions in the
openssl libraries...
I have this test-file, saved as "aes.c":
---
#include <openssl/evp.h>
int main()
{
EVP_aes_256_cbc();
return 0;
}
---
I try to compile it, on both mingw installations, with: "gcc
-I/usr/local/ssl/include -L/usr/local/ssl/lib -lcrypto aes.c", which
gives:
---
C:\Users\Limit\AppData\Local\Temp\ccwPokzy.o:aes.c:(.text+0xe):
undefined reference to `EVP_aes_256_cbc'
collect2: ld returned 1 exit status
---
However, "nm /usr/local/ssl/lib/libcrypto.a | grep EVP_aes_256_cbc" gives:
---
0000000000000d50 T _EVP_aes_256_cbc
U _EVP_aes_256_cbc
---
So it seems like some relevant symbol are present (I tried calling
"_EVP_aes_256_cbc()" as well, without success)?
Or are they not properly exported?
Moreover, the exact same code and compile command successfully
compiles on a linux box with openssl version 0.9.7a.
I have spent a lot of time on this, and any inputs would be greatly appreciated.
Thank you.
Regards,
Eystein
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openss...@openssl.org
Automated List Manager majo...@openssl.org
Try linking against libcrypto ;).
"gcc -I/usr/local/ssl/include -L/usr/local/ssl/lib ses.c -lcrypto"
might work.
> Moreover, the exact same code and compile command=20
> successfully compiles on a linux box with openssl version 0.9.7a.
>=20
Are you sure about the command? With gcc? That would surprise me.
Thank you very much!
-Eystein
On Mon, Sep 21, 2009 at 12:30 AM, Dave Thompson
<dave.t...@princetonpayments.com> wrote:
>> From: owner-ope...@openssl.org On Behalf Of Eystein M=E5l=F8y Ste=
nberg
>> Sent: Sunday, 20 September, 2009 15:13
> <snip: simple example>
>> I try to compile it, on both mingw installations, with: "gcc
>> -I/usr/local/ssl/include -L/usr/local/ssl/lib -lcrypto aes.c", which
>> gives:
>> ---
>> C:\Users\Limit\AppData\Local\Temp\ccwPokzy.o:aes.c:(.text+0xe):
>> undefined reference to `EVP_aes_256_cbc'
>> collect2: ld returned 1 exit status
>> ---
>>
> The 'gcc' linker (ld) (and AFAIK most others) is order sensitive.
> You must have -lcrypto *after* the module(s) that calls it. (Though
> *compiling* with -I after the code that #include's them is fine!)
>
>> Moreover, the exact same code and compile command
>> successfully compiles on a linux box with openssl version 0.9.7a.
>>
> Are you sure about the command? With gcc? That would surprise me.
>
>
>
> ______________________________________________________________________
> OpenSSL Project =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 http://www.openssl.org
> User Support Mailing List =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0openssl-=
us...@openssl.org
> Automated List Manager =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 majo...@openssl.org
> You nailed it.
> "gcc -I/usr/local/ssl/include -L/usr/local/ssl/lib aes.c -lcrypto"
> works perfectly.
> However, on Red Hat, it compiles and links no matter where I=20
> put the input file (checked it again).
> On Mon, Sep 21, 2009 at 12:30 AM, Dave Thompson=20
> <dave.t...@princetonpayments.com> wrote:
> > The 'gcc' linker (ld) (and AFAIK most others) is order sensitive.
> > You must have -lcrypto *after* the module(s) that calls it. <snip>
On further checking, I realized it's different for static versus=20
dynamic/shared linking; the latter works anywhere (even first).
You apparently got dynamic built-in on Linux, but static=20
in your own build. Sorry for being partly off.