Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Failing on Windows (x64, Windows 10, VS 2015) #76

Closed
mikeptweet opened this issue Dec 14, 2015 · 18 comments · Fixed by #77
Closed

Build Failing on Windows (x64, Windows 10, VS 2015) #76

mikeptweet opened this issue Dec 14, 2015 · 18 comments · Fixed by #77

Comments

@mikeptweet
Copy link

"C:\Haywire\haywire.sln" (default target) (1) ->
"C:\Haywire\haywire_hello_world.vcxproj.metaproj" (default target) (4) ->
"C:\Haywire\haywire_hello_world.vcxproj" (default target) (7) ->
(Link target) ->
program.obj : error LNK2019: unresolved external symbol opt_config_init refer
enced in function main [C:\Haywire\haywire_hello_world.vcxproj]
program.obj : error LNK2019: unresolved external symbol opt_config_free refer
enced in function main [C:\Haywire\haywire_hello_world.vcxproj]
program.obj : error LNK2019: unresolved external symbol opt_args_free referen
ced in function main [C:\Haywire\haywire_hello_world.vcxproj]
program.obj : error LNK2019: unresolved external symbol opt_config_parse refe
renced in function main [C:\Haywire\haywire_hello_world.vcxproj]
program.obj : error LNK2019: unresolved external symbol opt_flag_bool referen
ced in function main [C:\Haywire\haywire_hello_world.vcxproj]
program.obj : error LNK2019: unresolved external symbol opt_flag_int referenc
ed in function main [C:\Haywire\haywire_hello_world.vcxproj]
program.obj : error LNK2019: unresolved external symbol opt_flag_string refer
enced in function main [C:\Haywire\haywire_hello_world.vcxproj]
C:\Haywire\builds\windows\debug\haywire_hello_world\haywire_hello_world.exe :
fatal error LNK1120: 7 unresolved externals [C:\Haywire\haywire_hello_world.vc
xproj]

134 Warning(s)
8 Error(s)
@nmdguerreiro
Copy link
Contributor

It looks like the hello world source set doesn't include opt.c. I don't
have access to any Windows machines to confirm though.
On Mon, 14 Dec 2015 at 20:59, Mike Parsons notifications@github.com wrote:

"C:\Haywire\haywiresln" (default target) (1) ->
"C:\Haywire\haywire_hello_worldvcxprojmetaproj" (default target) (4) ->
"C:\Haywire\haywire_hello_worldvcxproj" (default target) (7) ->
(Link target) ->
programobj : error LNK2019: unresolved external symbol opt_config_init
refer
enced in function main [C:\Haywire\haywire_hello_worldvcxproj]
programobj : error LNK2019: unresolved external symbol opt_config_free
refer
enced in function main [C:\Haywire\haywire_hello_worldvcxproj]
programobj : error LNK2019: unresolved external symbol opt_args_free
referen
ced in function main [C:\Haywire\haywire_hello_worldvcxproj]
programobj : error LNK2019: unresolved external symbol opt_config_parse
refe
renced in function main [C:\Haywire\haywire_hello_worldvcxproj]
programobj : error LNK2019: unresolved external symbol opt_flag_bool
referen
ced in function main [C:\Haywire\haywire_hello_worldvcxproj]
programobj : error LNK2019: unresolved external symbol opt_flag_int
referenc
ed in function main [C:\Haywire\haywire_hello_worldvcxproj]
programobj : error LNK2019: unresolved external symbol opt_flag_string
refer
enced in function main [C:\Haywire\haywire_hello_worldvcxproj]
C:\Haywire\builds\windows\debug\haywire_hello_world\haywire_hello_worldexe
:
fatal error LNK1120: 7 unresolved externals
[C:\Haywire\haywire_hello_worldvc
xproj]

134 Warning(s)
8 Error(s)


Reply to this email directly or view it on GitHub
#76.

@mikeptweet
Copy link
Author

I got it compiled by including opt.c in the visual studio project, however when I run the program and fire off a request, it immediately exits. See the attached gif.

haywire

@nmdguerreiro
Copy link
Contributor

If you compile in debug mode, do you get an error message when you run it?

@mikeptweet
Copy link
Author

Nope ... nothing. The same thing happens if I try to connect via the
browser. The server ends immediately.

On Wed, Dec 16, 2015 at 4:43 AM, Nuno Guerreiro notifications@github.com
wrote:

If you compile in debug mode, do you get an error message when you run it?


Reply to this email directly or view it on GitHub
#76 (comment).

@nmdguerreiro
Copy link
Contributor

I wonder what
https://github.com/kellabyte/Haywire/blob/master/src/haywire/http_server.c#L203
is
actually returning in that case. Could you print the result of that call?

On Wed, Dec 16, 2015 at 10:18 AM Mike Parsons notifications@github.com
wrote:

Nope ... nothing. The same thing happens if I try to connect via the
browser. The server ends immediately.

On Wed, Dec 16, 2015 at 4:43 AM, Nuno Guerreiro notifications@github.com
wrote:

If you compile in debug mode, do you get an error message when you run
it?


Reply to this email directly or view it on GitHub
#76 (comment).


Reply to this email directly or view it on GitHub
#76 (comment).

@mikeptweet
Copy link
Author

I set up the debugger in Visual Studio and it breaks here (strlen.asm)

[image: Inline image 1]

On Wed, Dec 16, 2015 at 5:25 AM, Nuno Guerreiro notifications@github.com
wrote:

I wonder what

https://github.com/kellabyte/Haywire/blob/master/src/haywire/http_server.c#L203
is
actually returning in that case. Could you print the result of that call?

On Wed, Dec 16, 2015 at 10:18 AM Mike Parsons notifications@github.com
wrote:

Nope ... nothing. The same thing happens if I try to connect via the
browser. The server ends immediately.

On Wed, Dec 16, 2015 at 4:43 AM, Nuno Guerreiro <
notifications@github.com>
wrote:

If you compile in debug mode, do you get an error message when you run
it?


Reply to this email directly or view it on GitHub
<#76 (comment)
.


Reply to this email directly or view it on GitHub
#76 (comment).


Reply to this email directly or view it on GitHub
#76 (comment).

@mikeptweet
Copy link
Author

Here is where the error occurs ... getting the strlen(current_time)

[image: Inline image 1]

On Wed, Dec 16, 2015 at 5:38 AM, Mike Parsons mike.r.parsons@gmail.com
wrote:

I set up the debugger in Visual Studio and it breaks here (strlen.asm)

[image: Inline image 1]

On Wed, Dec 16, 2015 at 5:25 AM, Nuno Guerreiro notifications@github.com
wrote:

I wonder what

https://github.com/kellabyte/Haywire/blob/master/src/haywire/http_server.c#L203
is
actually returning in that case. Could you print the result of that call?

On Wed, Dec 16, 2015 at 10:18 AM Mike Parsons notifications@github.com
wrote:

Nope ... nothing. The same thing happens if I try to connect via the
browser. The server ends immediately.

On Wed, Dec 16, 2015 at 4:43 AM, Nuno Guerreiro <
notifications@github.com>
wrote:

If you compile in debug mode, do you get an error message when you run
it?


Reply to this email directly or view it on GitHub
<
https://github.com/kellabyte/Haywire/issues/76#issuecomment-165049690>.


Reply to this email directly or view it on GitHub
<#76 (comment)
.


Reply to this email directly or view it on GitHub
#76 (comment).

@mikeptweet
Copy link
Author

Sorry ... here's the screenshot

error

@nmdguerreiro
Copy link
Contributor

Humm, that's weird. I just checked the documentation on MSDN and ctime is supposed to return a null terminated string, so strlen shouldn't have an issue.

Note that current_datetime.length is initialized until the next line runs. Does strlen cause a segmentation fault or does it return?

@mikeptweet
Copy link
Author

It causes a segmentation fault and the program exits

On Wed, Dec 16, 2015 at 6:43 AM, Nuno Guerreiro notifications@github.com
wrote:

Humm, that's weird. I just checked the [image: documentation on MSDN]
https://camo.githubusercontent.com/0fa69a427078eefe730a0aedb180c20a47237e62/68747470733a2f2f6d73646e2e6d6963726f736f66742e636f6d2f656e2d75732f6c6962726172792f35397735786364792e61737078
and ctime is supposed to return a null terminated string, so strlen
shouldn't have an issue.

Note that current_datetime.length is initialized until the next line
runs. Does strlen cause a segmentation fault or does it return?


Reply to this email directly or view it on GitHub
#76 (comment).

@nmdguerreiro
Copy link
Contributor

And what's the value of current_time btw? I wonder if that is returning NULL.

@mikeptweet
Copy link
Author

Error Reading Character Of Strings
Unable to read memory

On Wed, Dec 16, 2015 at 9:32 AM, Nuno Guerreiro notifications@github.com
wrote:

And what's the value of current_time btw?


Reply to this email directly or view it on GitHub
#76 (comment).

@mikeptweet
Copy link
Author

If you need a Windows Environment to test on ... just load up this Hands On Lab from Microsoft and it gives you a full blown remote Windows - Visual Studio 2015 environment all avilable from a web browser

https://vlabs.holsystems.com/vlabs/technet?eng=VLabs&auth=none&src=vlabs&altadd=true&labid=21201&lod=true

@nmdguerreiro
Copy link
Contributor

Sweet!

@nmdguerreiro
Copy link
Contributor

@mikeptweet - I ran build.bat to generate the solution files and I didn't have to add any additional sources. After that I was able to reproduce the error. I fixed it by adding:

#include <time.h>

at the top of http_response_cache.c.

Can you try doing that and running again just to confirm?

@nmdguerreiro
Copy link
Contributor

Opened #77 to fix it. Without the header, the current time is returns as negative and that causes ctime to return an invalid string.

kellabyte added a commit that referenced this issue Dec 16, 2015
Adding time.h to fix error on Windows. Fixes #76
@mikeptweet
Copy link
Author

Bingo ... thanks a bunch :-)

@nmdguerreiro
Copy link
Contributor

Happy to help :-)
On Wed, 16 Dec 2015 at 18:03, Mike Parsons notifications@github.com wrote:

Bingo ... thanks a bunch :-)


Reply to this email directly or view it on GitHub
#76 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants