gaochunzy / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
1 stars 0 forks source link

Linker error when compiling mongoose with -DNO_SSL_DL #371

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
start a new build with:
$ make CFLAGS="-lssl -lcrypto -DNO_SSL_DL" linux

What is the expected output? What do you see instead?
A clean make is expected, however the result is:
g++ mongoose.c -shared -fPIC -fpic -o _mongoose.so -ldl -pthread -lssl -lcrypto 
-DNO_SSL_DL
g++ mongoose.c main.c -o mongoose -ldl -pthread -lssl -lcrypto -DNO_SSL_DL
/tmp/cc4UdVKZ.o: In function `ssl_error()':
mongoose.c:(.text+0x3ff): undefined reference to `ERR_get_error()'
mongoose.c:(.text+0x41b): undefined reference to `ERR_error_string(unsigned 
long, char*)'
/tmp/cc4UdVKZ.o: In function `push(_IO_FILE*, int, ssl_st*, char const*, long)':
mongoose.c:(.text+0x1595): undefined reference to `SSL_write(ssl_st*, void 
const*, int)'
/tmp/cc4UdVKZ.o: In function `pull(_IO_FILE*, int, ssl_st*, char*, int)':
mongoose.c:(.text+0x166f): undefined reference to `SSL_read(ssl_st*, void*, 
int)'
/tmp/cc4UdVKZ.o: In function `sslize(mg_connection*, int (*)(ssl_st*))':
mongoose.c:(.text+0x2199): undefined reference to `SSL_new(ssl_ctx_st*)'
mongoose.c:(.text+0x21d6): undefined reference to `SSL_set_fd(ssl_st*, int)'
/tmp/cc4UdVKZ.o: In function `set_ssl_option(mg_context*)':
mongoose.c:(.text+0x8bcf): undefined reference to `SSL_library_init()'
mongoose.c:(.text+0x8bd4): undefined reference to `SSL_load_error_strings()'
mongoose.c:(.text+0x8bd9): undefined reference to `SSLv23_server_method()'
mongoose.c:(.text+0x8be1): undefined reference to `SSL_CTX_new(ssl_method_st*)'
mongoose.c:(.text+0x8ca2): undefined reference to 
`SSL_CTX_use_certificate_file(ssl_ctx_st*, char const*, int)'
mongoose.c:(.text+0x8d17): undefined reference to 
`SSL_CTX_use_PrivateKey_file(ssl_ctx_st*, char const*, int)'
mongoose.c:(.text+0x8d8e): undefined reference to 
`SSL_CTX_use_certificate_chain_file(ssl_ctx_st*, char const*)'
mongoose.c:(.text+0x8de9): undefined reference to `CRYPTO_num_locks()'
mongoose.c:(.text+0x8e92): undefined reference to `CRYPTO_num_locks()'
mongoose.c:(.text+0x8ea6): undefined reference to 
`CRYPTO_set_locking_callback(void (*)(int, int, char const*, int))'
mongoose.c:(.text+0x8eb0): undefined reference to 
`CRYPTO_set_id_callback(unsigned long (*)())'
/tmp/cc4UdVKZ.o: In function `uninitialize_ssl(mg_context*)':
mongoose.c:(.text+0x8efb): undefined reference to 
`CRYPTO_set_locking_callback(void (*)(int, int, char const*, int))'
mongoose.c:(.text+0x8f33): undefined reference to `CRYPTO_num_locks()'
mongoose.c:(.text+0x8f47): undefined reference to 
`CRYPTO_set_locking_callback(void (*)(int, int, char const*, int))'
mongoose.c:(.text+0x8f51): undefined reference to 
`CRYPTO_set_id_callback(unsigned long (*)())'
/tmp/cc4UdVKZ.o: In function `close_connection(mg_connection*)':
mongoose.c:(.text+0x918b): undefined reference to `SSL_free(ssl_st*)'
/tmp/cc4UdVKZ.o: In function `worker_thread(mg_context*)':
mongoose.c:(.text+0x9961): undefined reference to `SSL_accept(ssl_st*)'
/tmp/cc4UdVKZ.o: In function `free_context(mg_context*)':
mongoose.c:(.text+0x9fa6): undefined reference to `SSL_CTX_free(ssl_ctx_st*)'
collect2: error: ld returned 1 exit status
make: *** [linux] Error 1

What version of the product are you using? On what operating system?
mongoose 3.1 on Linux x86_64 box.

Please provide any additional information below.
Attached patch fixes the issue

Original issue reported on code.google.com by raaquini on 5 Jul 2012 at 9:53

Attachments: