LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   problem with openssl (https://www.linuxquestions.org/questions/programming-9/problem-with-openssl-519005/)

ashishjen 01-13-2007 02:42 PM

problem with openssl
 
i m getting the following error when compiling any file using SSL libraries...

[root@localhost ssl]# gcc -I./include nossl.c ./lib/libcrypto.a
nossl.c: In function ‘main’:
nossl.c:25: warning: ‘return’ with no value, in function returning non-void
nossl.c:31: warning: ‘return’ with no value, in function returning non-void
/tmp/ccgusGub.o: In function `main':nossl.c:(.text+0x22): undefined reference to `SSL_load_error_strings'
./lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':dso_dlfcn.c:(.text+0x27d): undefined reference to `dlsym'
:dso_dlfcn.c:(.text+0x2f9): undefined reference to `dlerror'
./lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':dso_dlfcn.c:(.text+0x36d): undefined reference to `dlsym'
:dso_dlfcn.c:(.text+0x3e1): undefined reference to `dlerror'
./lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':dso_dlfcn.c:(.text+0x44c): undefined reference to `dlclose'
./lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':dso_dlfcn.c:(.text+0x4f5): undefined reference to `dlopen'
:dso_dlfcn.c:(.text+0x546): undefined reference to `dlclose'
:dso_dlfcn.c:(.text+0x56f): undefined reference to `dlerror'
collect2: ld returned 1 exit status
[root@localhost ssl]#

try to sort out this....

indienick 01-13-2007 04:36 PM

Quote:

nossl.c:25: warning: ‘return’ with no value, in function returning non-void
nossl.c:31: warning: ‘return’ with no value, in function returning non-void
I'm pretty sure in C, if a function is cast as void, you don't have to enter a RETURN call at the end of the function. But it looks like the function casting isn't void, but something non-void (such as int, char, double, etc.). Check to make sure if you use a return in a function, and the return type isn't void, that you specify the returned value.

matthewg42 01-14-2007 07:27 PM

Warnings about proper C usage aside, you need to tell the linker to include the SSl library, where SSL_load_error_strings is defined. You do this by adding
Code:

-lssl
...to your linker command.
You need to make sure the libssl.a file is in the default linker path. Usually this woulc be /usr/lib/libssl.a. If that exists, you're OK, else you'll have to add a -L option. E.g. if your libssl.a file is in the /home/me/build/ssl/lib directory, you would add
Code:

-L/home/me/build/ssl/lib -lssl
Similarly for other missing symbols.

ashishjen 01-15-2007 11:00 PM

@matthewg42
 
thanx ... its working now....


All times are GMT -5. The time now is 01:57 PM.