When I use the command gcc teste.c -lssl -o teste: 

Error:
ubuntu@omap:~/arquivos$ gcc rsa.c -lssl -o teste
/tmp/ccyvrO2i.o: In function `main':
rsa.c:(.text+0x8): undefined reference to `BN_new'
rsa.c:(.text+0xe): undefined reference to `BN_new'
rsa.c:(.text+0x14): undefined reference to `BN_new'
rsa.c:(.text+0x1a): undefined reference to `BN_new'
rsa.c:(.text+0x20): undefined reference to `BN_new'
/tmp/ccyvrO2i.o:rsa.c:(.text+0x26): more undefined references to `BN_new' follow
/tmp/ccyvrO2i.o: In function `main':
rsa.c:(.text+0x5c): undefined reference to `BN_set_word'
rsa.c:(.text+0x66): undefined reference to `BN_set_word'
rsa.c:(.text+0x70): undefined reference to `BN_set_word'
rsa.c:(.text+0x98): undefined reference to `BN_generate_prime'
rsa.c:(.text+0xba): undefined reference to `BN_generate_prime'
rsa.c:(.text+0xbe): undefined reference to `BN_CTX_new'
rsa.c:(.text+0xca): undefined reference to `BN_mul'
rsa.c:(.text+0xd4): undefined reference to `BN_sub'
rsa.c:(.text+0xe2): undefined reference to `BN_bn2dec'
rsa.c:(.text+0xf6): undefined reference to `BN_sub'
rsa.c:(.text+0xfa): undefined reference to `BN_CTX_new'
rsa.c:(.text+0x106): undefined reference to `BN_mul'
rsa.c:(.text+0x114): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x11c): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x124): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x140): undefined reference to `BN_rand'
rsa.c:(.text+0x1b8): undefined reference to `BN_mul'
rsa.c:(.text+0x1c6): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x1de): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x1f6): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x204): undefined reference to `BN_CTX_new'
rsa.c:(.text+0x216): undefined reference to `BN_div'
rsa.c:(.text+0x224): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x236): undefined reference to `BN_cmp'
rsa.c:(.text+0x24a): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x252): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x25a): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x262): undefined reference to `BN_bn2dec'
rsa.c:(.text+0x26a): undefined reference to `BN_bn2dec'
collect2: ld returned 1 exit status

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

Any idea? 

I haven't found the libssl.so in my directory /usr/lib.

Thanks everybody.


> Date: Fri, 24 Aug 2012 09:45:15 +0100
> Subject: Re: OpenSSL on beagleboard
> From: b...@links.org
> To: openssl-users@openssl.org
> 
> On Fri, Aug 24, 2012 at 2:18 AM, Jeffrey Walton <noloa...@gmail.com> wrote:
> > On Thu, Aug 23, 2012 at 9:06 PM, Paulo Roberto <bad_boy_...@hotmail.com> 
> > wrote:
> >> Hello, I am using the package libssl-dev on ubuntu in my beagleboard xm, 
> >> and
> >> I have to run two C algorithms using the openSSL library..
> >> Although I can't compile using the command: gcc test.c -lssl -o test. It
> >> seems the compiler isn't recognizing the "-lssl" command.
> 
> You really need to show the error, I doubt it is "not recognizing" it.
> 
> >> Does someone know how to solve this?
> >> Do I have to set some path, or something like that?
> 
> You might do, use -L for this.
> 
> > You specify linker commands (such as libraries) at the very end of the
> > compiler drive command. From the g++ man pages (around line 25):
> > "...the placement of the -l option is significant."
> 
> Significant relative to .o and other libraries, not to the output
> file, so this should make no difference.
> 
> >
> >     gcc test.c -o test -lssl
> >
> > You might also want to add -Wl,-Bstatic unless you want to do the
> > shared object thing.
> >
> > Jeff
> > ______________________________________________________________________
> > OpenSSL Project                                 http://www.openssl.org
> > User Support Mailing List                    openssl-users@openssl.org
> > Automated List Manager                           majord...@openssl.org
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
                                          

Reply via email to