Old 24th July 2016, 11:42   #1
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
NSISdl doesn't work in compiled version

Hello.

I've compiled NSIS with commands
code:

scons SKIPUTILS="NSIS Menu"
scons PREFIX="C:\temp\NSIS" install



and when I runned compiled version of the NSIS with script
code:


Section "Download Updater"
CreateDirectory $INSTDIR

StrCpy $2 "$INSTDIR\currentLauncherURL.dat"

NSISdl::download http://files.lifesim******builds/stable/Windows_x32/currentLauncherURL.txt $2
Pop $0
StrCmp $0 success success
SetDetailsView show
DetailPrint "download failed: $0"
MessageBox MB_OK "Download failed: $0"
Abort
success:
FileOpen $4 $2 r
FileRead $4 $5 ; we read until the end of line (including carriage return and new line) and save it to $1
FileClose $4 ; and close the file

StrCpy $2 "$INSTDIR\LifeSimLauncher.exe"
NSISdl::download $5 $2
Pop $0
StrCmp $0 success success2
SetDetailsView show
DetailPrint "download failed: $0"
MessageBox MB_OK "Download failed: $0"
Abort
success2:
; Exec '"$2"'
Quit


SectionEnd


It's fails with error
---------------------------
LifeSim - Life Simulator Game Setup
---------------------------
Download failed: connecting to host
---------------------------
ОК
---------------------------

But this script works correctly with precompiled version, that I downloaded from NSIS sf website.

I tried source from https://sourceforge.net/p/nsis/code/...S/tags/v30rc2/ and from https://sourceforge.net/p/nsis/code/...ee/NSIS/trunk/ .

Why it doesn't work in version, that compiled from sources?

Thank you!
ArtUrlWWW is offline   Reply With Quote
Old 24th July 2016, 14:21   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
Compiler version?

Try adding some calls to OutputDebugString in connection.cpp and run in it in a debugger so you can find the reason why connect() fails...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th July 2016, 19:52   #3
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
Using Microsoft tools configuration (14.0).
I use MS VS 2015.
But I can't understand, how to debug it?.. There are no *.sln solutions for MS VS, and project compiled with (through) Python script - so weird... Why you use third-party scripts and python, but you do not include *.sln files for the project? It can be useful for Windows users.
ArtUrlWWW is offline   Reply With Quote
Old 24th July 2016, 20:00   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
We use Scons to build because it supports Windows and posix. We also (try to) support every version of VS from 6 to 2015 but there are no VS project files.

You can also use DebugView from Sysinternals to view OutputDebugString messages if you cannot figure out how to run a .exe in the debugger...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 24th July 2016, 20:10   #5
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
OK, may be you can recommend versions of the MS VS, that are 100% tested? ) May be MS VS 2013?
ArtUrlWWW is offline   Reply With Quote
Old 24th July 2016, 20:15   #6
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
I found http://stackoverflow.com/questions/1...-visual-studio , but how to add breakpoints, if it's only exe, that not "linked" with the project and code? I am sorry for this silly question.
ArtUrlWWW is offline   Reply With Quote
Old 24th July 2016, 20:22   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
If you don't know how to code, why do you need to recompile? Add a MessageBox in the .nsi before the plugin call. Add "DebugBreak();" in the plugin code, compile and then attach to the running exe...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th July 2016, 07:41   #8
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
I am newbie in C++ and also in such build systems, like in NSIS ).
I can't find any examples for DebugBreak for using in NSIS code. Why to use MessageBox in nsi? What will it show? May be some message from DebugBreak, that pop'ed from plugin?

I guess, that problem is in Contrib/NSISdl/connection.cpp, at the line 142, or at the line 169...
ArtUrlWWW is offline   Reply With Quote
Old 25th July 2016, 07:50   #9
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
I checked it twice - error occurred on line 142 - I changed m_errorstr to "connecting to host number 1" and now compiled installer shows "connecting to host number 1", when I runned it.
ArtUrlWWW is offline   Reply With Quote
Old 25th July 2016, 08:24   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
After line 142, add something like this:
code:

char dbg[99];
wsprintfA(dbg, "winsock error: %d", ERRNO);
MessageBoxA(0, dbg, 0, 0);

and you should then be able to lookup which WSAE* value is reported as the cause.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th July 2016, 08:35   #11
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
Ohhh, thank you, Anders! I Googled such code, but not found it. As result, compiled installer shows error
---------------------------
Ошибка
---------------------------
winsock error: 10035
---------------------------
ОК
---------------------------

That means (from https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx )

WSAEWOULDBLOCK
10035
Resource temporarily unavailable.
This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a nonfatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK_STREAM socket, since some time must elapse for the connection to be established.

Why and how to fix that?

Thank you!
ArtUrlWWW is offline   Reply With Quote
Old 25th July 2016, 09:20   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
You could try changing line 140 to
Quote:
else if (ERRNO!=EINPROGRESS && ERRNO!=EWOULDBLOCK)
Not really sure why VS2015 would trigger this, maybe it generates slightly different code causing a tiny timing change.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 25th July 2016, 09:22   #13
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
I tried that and now I got another message - error="download incomplete"; from nsisdl.cpp, line 434.
ArtUrlWWW is offline   Reply With Quote
Old 25th July 2016, 09:36   #14
ArtUrlWWW
Junior Member
 
Join Date: Jul 2016
Posts: 9
Have you installed MS VS 2015? If no, I can provide you TeamViewer access to my PC, if you have some time to check that bug.
ArtUrlWWW is offline   Reply With Quote
Old 25th July 2016, 10:30   #15
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
No I don't have 2015 and I don't have time right now, sorry.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump