kuksugen / mongoose

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

Unable to compile on Windows using cyassl.lib #251

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download latest cyassl source and compile
2. Modify Makefile to provide the correct cyassl.lib location
3. On Windows using MSVS 2010, execute nmake windows

What is the expected output? What do you see instead?
I should get a proper compiled binary, mongoose.exe. I am getting unresolved 
external symbols. I have also compiled "cyassl.lib" from source and specified 
the correct location in the Makefile. Are you not using cyassl.lib or perhaps a 
different version?? Where can I find that?

What version of the product are you using? On what operating system?
Compiling from code, Windows XP using MSVS 2010

Please provide any additional information below.
I get the following unresolved external symbol errors:

mongoose.obj : error LNK2019: unresolved external symbol _ERR_error_string@8 ref
erenced in function _ssl_error@0
mongoose.obj : error LNK2019: unresolved external symbol _ERR_get_error@0 refere
nced in function _ssl_error@0
mongoose.obj : error LNK2019: unresolved external symbol _SSL_write@12 reference
d in function _push@24
mongoose.obj : error LNK2019: unresolved external symbol _SSL_read@12 referenced
 in function _pull@20
mongoose.obj : error LNK2019: unresolved external symbol _SSL_set_fd@8 reference
d in function _sslize@8
mongoose.obj : error LNK2019: unresolved external symbol _SSL_new@4 referenced i
n function _sslize@8
mongoose.obj : error LNK2019: unresolved external symbol _SSL_free@4 referenced
in function _close_connection@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_CTX_free@4 referen
ced in function _free_context@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_connect@4 referenc
ed in function _mg_connect@16
mongoose.obj : error LNK2019: unresolved external symbol _CRYPTO_set_id_callback
@4 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _CRYPTO_set_locking_cal
lback@4 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_CTX_use_certificat
e_chain_file@8 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_CTX_use_PrivateKey
_file@12 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_CTX_use_certificat
e_file@12 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _CRYPTO_num_locks@0 ref
erenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_CTX_new@4 referenc
ed in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSLv23_server_method@0
 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings
@0 referenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_library_init@0 ref
erenced in function _set_ssl_option@4
mongoose.obj : error LNK2019: unresolved external symbol _SSL_accept@4 reference
d in function _worker_thread@4
mongoose.exe : fatal error LNK1120: 20 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BI
N\cl.EXE"' : return code '0x2'
Stop.

Original issue reported on code.google.com by dru...@gmail.com on 4 May 2011 at 3:48

GoogleCodeExporter commented 9 years ago
Makefile is written for Visual Studio 6.
Sorry, I have no time and resources to deal with other versions of the compiler.

Original comment by valenok on 4 May 2011 at 8:02

GoogleCodeExporter commented 9 years ago
These are not Visual Studio 10 related errors. What I see is library linking 
errors which generally occur because the cyassl.lib library that I am linking 
when building mongoose.c is missing the symbols that are referenced. Your SVN 
only contains the source for mongoose.c and mongoose.h and not for the ssl 
library. But, I did find any mention for the correct version of 'cyassl.lib' to 
use in the Makefile. I am not requesting you to fix your Makefile to work with 
Visual Studio 10. I am only requesting you to fix it so that it compiles 
against the current source of 'cyassl.lib' or provide the cyassl.lib's source 
along with mongoose.

Original comment by dru...@gmail.com on 5 May 2011 at 1:38

GoogleCodeExporter commented 9 years ago
I am having this same problem

Original comment by scootere...@gmail.com on 7 Jul 2011 at 9:10

GoogleCodeExporter commented 9 years ago
Did you ever find a workaround?

Original comment by scootere...@gmail.com on 7 Jul 2011 at 9:11

GoogleCodeExporter commented 9 years ago
You should build cyassl.lib yourself from the sources provided by 
http://yassl.com,
http://yassl.com/yaSSL/Products-cyassl.html

Original comment by valenok on 7 Jul 2011 at 9:59

GoogleCodeExporter commented 9 years ago
Yes, that's exactly what I did. It appears that the only sources available 
there are newer than the ones that mongoose was written against at least for 
windows.

Original comment by scootere...@gmail.com on 8 Jul 2011 at 3:10

GoogleCodeExporter commented 9 years ago
I still haven't found a solution, compiled without SSL and using that. I 
requested author to share his cyassl sources or update mongoose to use the 
latest, but it seems like he has no time to do that. 
Doesn't that render this project useless? I want to embed a webserver in my 
application with SSL, but cannot. Sure, I can use the compiled sources to run a 
separate webserver but I find Apache or Lighthttpd much more efficient for that 
purposes.

Original comment by dru...@gmail.com on 8 Jul 2011 at 4:14

GoogleCodeExporter commented 9 years ago
OK thanks for the tip about compiling without SSL support as a workaround, 
though I agree with you, SSL is pretty important.

Note: I had to change the /Gz link flag to /Gd for the mongoose symbols to be 
exported properly.

Original comment by scootere...@gmail.com on 8 Jul 2011 at 8:34

GoogleCodeExporter commented 9 years ago
oops, /Gz and /Gd are compiler options, not linker options

Original comment by scootere...@gmail.com on 8 Jul 2011 at 9:01

GoogleCodeExporter commented 9 years ago
So are there any plans to support the latest yassl api so we can use mongoose 
with SSL on windows?

Original comment by scootere...@gmail.com on 20 Jul 2011 at 4:03

GoogleCodeExporter commented 9 years ago
I've downloaded current cyassl sources cyassl-2.0.0rc2, and modified Makefile 
to work with them.
See 
https://code.google.com/p/mongoose/source/detail?r=bfd15b3ac9d8adebedada8b212c31
5b89a491724 for details.

Build looks like this: modify Makefile to point to where cyassl sources are 
extracted (don't build though), then:
del *.obj
nmake cyassl
nmake windows

Let me know if you have any troubles.

Original comment by valenok on 21 Jul 2011 at 8:51

GoogleCodeExporter commented 9 years ago
Thanks valenok!

Original comment by scootere...@gmail.com on 22 Jul 2011 at 7:50

GoogleCodeExporter commented 9 years ago
Hi, I was able to get this to compile with VS 2008 (9.0), with the following 
gyrations.

I downloaded cyassl-2.0.0rc2 and added it to the mongoose folder under C:\ like 
so:

c:\mongoose-3.0

10/09/2011  09:59 PM    <DIR>          cyassl-2.0.0rc2
10/09/2011  09:59 PM    <DIR>          mongoose

I did not compile cyassl using their provided VS solution. I used the Visual 
Studio 2008 Command Prompt (gets your nmake.exe paths, etc).

The biggie was I had to make the following modifications to the Makefile to get 
rid of the external resolution errors, which included adding a couple missing 
.c files to CYASRC. Also, I had to change the forward slashes to a backslash to 
make the compiler happy.

Here's a diff of my Makefile  vs. the one downloaded in the mongoose source:
============================================
+++ /c/mongoose-3.0/mongoose/Makefile   2011-10-09 21:57:49 -0600
@@ -57,8 +57,9 @@ solaris:
 #  o  Set VC variable below to where VS 6.0 is installed on your system
 #  o  Run "PATH_TO_VC6\bin\nmake windows"

-VC=    z:
-CYA=   y:
+# Using Visual Studio 9.0, i.e. 2008
+VC=C:\PROGRA~2\MICROS~1.0\VC
+CYA=C:\mongoose-3.0\cyassl-2.0.0rc2
 #DBG=  /Zi /DDEBUG /Od
 DBG=   /DNDEBUG /O1
 CL=    cl /MD /TC /nologo $(DBG) /Gz /W3 /DNO_SSL_DL
@@ -66,33 +67,36 @@ GUILIB= user32.lib shell32.lib
 LINK=  /link /incremental:no /libpath:$(VC)\lib /subsystem:windows \
    ws2_32.lib advapi32.lib cyassl.lib

-CYAFL= /c /I $(CYA)\ctaocrypt\include /I $(CYA)\include /D_LIB
+CYAFL=/c /I $(CYA)\ctaocrypt\include /I \
+    $(CYA)\include /I $(CYA)\include\openssl /D_LIB

-CYASRC= $(CYA)/src/cyassl_int.c \
-   $(CYA)/src/cyassl_io.c \
-   $(CYA)/src/keys.c \
-   $(CYA)/src/tls.c \
-   $(CYA)/ctaocrypt/src/aes.c \
-   $(CYA)/ctaocrypt/src/arc4.c \
-   $(CYA)/ctaocrypt/src/asn.c \
-   $(CYA)/ctaocrypt/src/des3.c \
-   $(CYA)/ctaocrypt/src/dh.c \
-   $(CYA)/ctaocrypt/src/dsa.c \
-   $(CYA)/ctaocrypt/src/hc128.c \
-   $(CYA)/ctaocrypt/src/hmac.c \
-   $(CYA)/ctaocrypt/src/integer.c \
-   $(CYA)/ctaocrypt/src/md4.c \
-   $(CYA)/ctaocrypt/src/md5.c \
-   $(CYA)/ctaocrypt/src/misc.c \
-   $(CYA)/ctaocrypt/src/rabbit.c \
-   $(CYA)/ctaocrypt/src/random.c \
-   $(CYA)/ctaocrypt/src/ripemd.c \
-   $(CYA)/ctaocrypt/src/rsa.c \
-   $(CYA)/ctaocrypt/src/sha.c \
-   $(CYA)/ctaocrypt/src/sha256.c
+CYASRC= $(CYA)\src\cyassl_int.c \
+   $(CYA)\src\cyassl_io.c \
+   $(CYA)\src\keys.c \
+   $(CYA)\src\tls.c \
+   $(CYA)\ctaocrypt\src\aes.c \
+   $(CYA)\ctaocrypt\src\arc4.c \
+   $(CYA)\ctaocrypt\src\asn.c \
+   $(CYA)\ctaocrypt\src\des3.c \
+   $(CYA)\ctaocrypt\src\dh.c \
+   $(CYA)\ctaocrypt\src\dsa.c \
+   $(CYA)\ctaocrypt\src\hc128.c \
+   $(CYA)\ctaocrypt\src\hmac.c \
+   $(CYA)\ctaocrypt\src\integer.c \
+   $(CYA)\ctaocrypt\src\md4.c \
+   $(CYA)\ctaocrypt\src\md5.c \
+   $(CYA)\ctaocrypt\src\ctc_misc.c \
+   $(CYA)\ctaocrypt\src\rabbit.c \
+   $(CYA)\ctaocrypt\src\random.c \
+   $(CYA)\ctaocrypt\src\ripemd.c \
+   $(CYA)\ctaocrypt\src\rsa.c \
+   $(CYA)\ctaocrypt\src\sha.c \
+   $(CYA)\ctaocrypt\src\cyassl_memory.c \
+   $(CYA)\ctaocrypt\src\pwdbased.c \
+   $(CYA)\ctaocrypt\src\sha256.c

 cyassl:
-   $(CL) $(CYA)/src/ssl.c $(CYA)/ctaocrypt/src/coding.c \
+   $(CL) $(CYA)\src\ssl.c $(CYA)\ctaocrypt\src\coding.c \
        $(CYAFL) /DOPENSSL_EXTRA
    $(CL) $(CYASRC) $(CYAFL)
    lib *.obj /out:cyassl.lib
============================================

After those changes, the following commands worked fine.

del *.obj
nmake cyassl
nmake windows

Original comment by arbinger...@gmail.com on 10 Oct 2011 at 4:15