>From: [email protected] On Behalf Of Paulo Roberto
>Sent: Monday, 27 August, 2012 20:21
Okay, this time you did post the error.
>When I use the command gcc teste.c -lssl -o teste:
>/tmp/ccyvrO2i.o: In function `main':
>rsa.c:(.text+0x8): undefined reference to `BN_new'
<snip many more BN>
BN_* are in libcrypto not libssl.
>Another attempt:
>ubuntu@omap:~/arquivos$ gcc rsa.c -Wl, -lssl, -lcrypto -o teste
>/usr/bin/ld: cannot find : No such file or directory
>/usr/bin/ld: cannot find -lssl,
>collect2: ld returned 1 exit status
That's closer, but you've mixed up two different things.
-Wl,x,y -- comma(s) and NO space -- passes "opaque" linker
arguments, like -Wl,-Bstatic in a previous response.
-lxxx is not opaque (driver knows it) so don't use -Wl .
You do want -lssl -lcrypto (space but no comma).
>Any idea?
If you need both SSL and "low-level" routines like BN_*,
use -lssl -lcrypto . If only need low-level, just -lcrypto .
If you need both depending on your linker order may matter,
in which case -lssl should be first.
>I haven't found the libssl.so in my directory /usr/lib.
Then that's (probably) not the right location on your Unix/distro.
If it is dynamic, on Linux at least, ldd should work. Do
ldd `which openssl`
and look to see where libssl.* and libcrypto.* are.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]