Skip to content
⌘ NSIS Forum Archive

Problems building NSIS

62 posts

Wayne Goode#

Problems building NSIS

I'm trying to build NSIS, but I'm having problems. There are three different errors depending on which version of Visual Studio I specify.

DownloadedFiles are at
  • C:\dev\NSIS
  • C:\Python27
  • C:\Python27\Lib\site-packages\scons-2.3.4
  • C:\dev\zlib-1.2.8

Other

I build it by cleaning the directory and then using a command line of scons. I tried this using various versions of Visual Studio. By default, it is 12.0. I set MSVS_VERSION to build with other versions.

The results:
  1. 6.0, 7.0, 7.1: "Couldn't find a good version of libcp.lib"
  2. 8.0, 9.0: "zlib (win32) is missing!"
  3. 10.0, 12.0: "error LNK2019: unresolved external symbol __hypot referenced in function _hypot" & "error LNK2001: unresolved external symbol __fltused"

I also built it with the "MSTOOLKIT=yes" with the same results. I pointed MSSDK to the SDK that matched MSVS_VERSION. I tried it with:

MSSDK=C:\Program Files\Microsoft SDKs\Windows\version
MSSDK=C:\Program Files (x86)\Microsoft SDKs\Windows\version

#1 I have not researched this error yet.
#2 I found a few posts about this, but none provided a solution. I've checked that zlib.h, zdll.lib and zlib1.lib are where they are expected.
#3 The unresolved __hypot is because of a change in the library starting with VS 2010. I suspect that __fltused is a similar problem.

I have tried this on a second computer with a similar setup. The results are the same.

Output #1

scons: Reading SConscript files ...
Delete("nsis-29-Mar-2015.cvs")
Delete(".instdist")
Delete(".test")
Using Microsoft tools configuration (7.1)
*** Couldn't find a good version of libcp.lib

Output #2
scons: Reading SConscript files ...
Delete("nsis-29-Mar-2015.cvs")
Delete(".instdist")
Delete(".test")
Using Microsoft tools configuration (9.0)
Checking for memset requirement... yes
Checking for memcpy requirement... yes
Checking for C library gdi32... no
Checking for C library user32... no
Checking for C library pthread... no
Checking for C library iconv... no
Checking for C library shlwapi... no
Checking for C library version... no
Checking for C library zdll... no
Checking for C library z... no
zlib (win32) is missing!

Output for #3
scons: Reading SConscript files ...
Delete("nsis-29-Mar-2015.cvs")
Delete(".instdist")
Delete(".test")
Using Microsoft tools configuration (12.0)
Checking for memset requirement... yes
Checking for memcpy requirement... no
Checking for C library gdi32... yes
Checking for C library user32... yes
Checking for C library pthread... no
Checking for C library iconv... no
Checking for C library shlwapi... yes
Checking for C library version... yes
Checking for C library zdll... yes
Checking for C library zdll... yes
Checking for C library zdll... yes
Checking for C library dl... no
Checking for C library gdi32... yes
Checking for C library iconv... no
Checking for C library pthread... no
Checking for C library user32... yes
Checking for C library version... yes
Checking for C library zdll... yes
Checking for C++ library cppunit... no
scons: done reading SConscript files.
scons: Building targets ...
Install file: "Contrib\ExDLL\pluginapi.h" as "build\urelease\api\nsis\pluginapi.h"
Install file: "Source\exehead\api.h" as "build\urelease\api\nsis\api.h"
Install file: "Contrib\ExDLL\nsis_tchar.h" as "build\urelease\api\nsis\nsis_tchar.h"
<lots of cl commands>
link /nologo /map /subsystem:windows,5.01 /entry:NSISWinMainNOCRT /NODEFAULTLIB /OUT:build\urelease\MakeLangId\MakeLangId.exe kernel32.lib user32.lib comctl32.lib build\urelease\MakeLangId\MakeLangId.obj build\urelease\MakeLangId\resource-rc.res build\urelease\MakeLangId\memset.obj
MakeLangId.obj : error LNK2019: unresolved external symbol __hypot referenced in function _hypot
MakeLangId.obj : error LNK2001: unresolved external symbol __fltused
build\urelease\MakeLangId\MakeLangId.exe : fatal error LNK1120: 2 unresolved externals
scons: building terminated because of errors.
Anders#
Showing us the exact scons command used would help.

Which SDK are you using with VC toolkit 2003? Platform SDK 2003 Feb. is probably your best bet.

1) SCons is probably not able to find the lib?
2) Are you sure ZLIB_W32 is set correctly? Use File Monitor/Process Monitor to make sure SCons is actually looking in the right place.
3) Newer versions of VS are probably doing something stupid. MakeLangId does not use floating point numbers nor any other CRT function.



I can build with VCTK2003 but I'm using a backdoor to override the Scons VS detection:
cd trunk
set ZLIB_W32=c:\....\dep\zlib-win32
scons MSVC_USE_SCRIPT=None MSTOOLKIT=yes MSVS_VERSION=7.1 DOCTYPES=htmlsingle VERSION= VER_MAJOR=3 VER_MINOR= VER_REVISION=4 VER_BUILD=1 PREFIX=c:\....\NSIS SKIPUTILS="NSIS Menu" SKIPPLUGINS=System install
I'm using SCons v1.2.0.r3842 because newer versions never work correctly for me. (Having multiple SDK's and versions of VS on the same machine is not a good idea when trying to fix these build errors)

When using MSVC_USE_SCRIPT=None the PATH, INCLUDE and LIB environment variables have to be set correctly (Use the shortcuts created by the Platform SDK: Windows 2000/XP Release 32-bit etc). Specifically it needs to be able to find cl.exe, link.exe and lib.exe in %PATH% and Windows.h in %INCLUDE%.

I'm using SKIPPLUGINS=System because I did not have the MASM assembler (ml.exe) in %PATH%.

The contents of my zlib folder:
\zlib-win32\zlib1.dll
\zlib-win32\include\zconf.h
\zlib-win32\include\zlib.h
\zlib-win32\lib\zdll.lib
\zlib-win32\lib\zlib.lib
(I may have built these myself, I don't remember)



I would generally not recommend that people use MSVC_USE_SCRIPT but it can be helpful if you cannot get SCons to operate correctly. It seems to be a rather undocumented parameter and depends on your SCons version. If you also use MSTOOLKIT=yes then it will use our custom implementation of this feature (YMMV).



It is important that you delete .sconsign.dblite and the .sconf_temp directory when trying to fix the libcp.lib and zlib errors because SCons caches config data. Checking config.log might also provide some clues...
MyPC8MyBrain#
im in the same alley struggling to get NSIS to compile without errors,
assuming i have nothing installed; can someone please sort these out for me,
which of these do i want to use to get a successful build?

TIA,
Chris

Anders#
You have the service pack and processor pack for Visual Studio 6 but not Visual Studio itself which is rather strange.

First install python, then scons.

Then you need to choose between 2003TK and 2005. When you try to build scons is going to complain about missing zlib and wxwidgets so set those variables and then report back if you get errors...
MyPC8MyBrain#
Thank you Andres,
I am actually trying again on a new virgin PC because I was getting errors on my other machine,
I do use it for other development; I already have VS2012; I have all path in place on both machines;
with Python installed scones v1.20 and wxMSW v2.8; I am getting a warring on both machines,
and on both compilation stops due to fatal errors,

the one machine W7 has VS2012 with latest scones build and newer wxMSW
I got similar errors as OP described; on my other box its xp,
I’m setting up now VS6 with SP5 and proc pack with older scones and wxMSW to see if this helps,

No switches were initially used; though I have tried several with no joy,

TIA
Chris


(log attached)
Anders#
Try adding SKIPUTILS=MakeLangId as a scons parameter. (MakeLangId is a simple program and does not use floats but as you can see, it is rather hard to keep all visual studio versions happy at the same time)
MyPC8MyBrain#
Thank you very much Andres,
i did as instructed; something kept going; but ended up again not completing again,

log attached

TIA
Chris
JasonFriday13#
Also add nsis menu to the scons list, so: SKIPUTILS="MakeLangId","NSIS Menu". The Menu is the thing you see when you click the NSIS icon on the desktop or in the start menu.
MyPC8MyBrain#
kept going again; only this time i got... allot of windows popup VS pages as well as url's
this is one nutty process to figure out 🙂

thank you for all you help guys; i do appreciate this,
(log attached)

ATB
Chris
JasonFriday13#
What's the directory you are running scons in? And what's the command line you are using?

I've compiled nsis multiple times on windows and linux, and I've never seen a log like that last one.
MyPC8MyBrain#
i think the buffer was enough to hold all the log;
the first line should have the command i run as well

i run from -> d:\dev\nsis\
in this last run i had -> scons SKIPUTILS="MakeLangId","NSIS Menu"

other directories needed are here and referenced in path
d:\dev\wxWidgets\
d:\dev\zlib-1.2.7\
C:\Python27\
in this last run i had

im not sure yet if im doing something to add to this odd behavior;
scons doesn't like to work nicely on my Win7 pc for some odd reason,

i run it few times from a normal command window;
until it just refused to be recognized; jut like that!
no changes made other then close and open a new command window;

it didn't matter that i removed and installed it back; python is in path as needed,
i added direct path reference to \site packages\scons\
i did just about everything i can think of to make sure everything is visible;
yet scons remained un recognized; i had to pull VS command and work through it,


ATB
Chris
JasonFriday13#
You installed python in it's default directory right? Which would be C:\Python27? Add C:\Python27\scripts into the environment's system path. Then in a command window all you have to do is change to the nsis directory and run your scons command.
MyPC8MyBrain#
C:\Python27\scripts is already in there; python is in its default path C:\Python27\
(i see scones files in scripts folder but with no extensions)
scones doesn't let you change install path anyway,
MyPC8MyBrain#
this is what i have in path

C:\Python27\
C:\Python27\Scripts
C:\Python27\Lib\site-packages\scons-2.4.1\SCons
%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64
D:\Program Files\FWTools2.4.7\bin
C:\Program Files\TortoiseSVN\bin
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files (x86)\HTML Help Workshop; 
JasonFriday13#
So from a new command window are you doing this:

D: (enter)
cd dev\nsis (enter)
scons (enter)

If not, do it this way and let me know what happens.
MyPC8MyBrain#
i cant explain why; as you see a standard run cmd shell is working now,
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
D:\Users\Administrator>cd d:\
d:\>cd dev\nsis
d:\dev\nsis>scons
scons: Reading SConscript files ...
Delete("nsis-26-Nov-2015.cvs")
Delete(".instdist")
Delete(".test")
Using Microsoft tools configuration (12.0)
Checking for memset requirement... (cached) yes
Checking for memcpy requirement... (cached) no
Checking for C library gdi32... (cached) yes
Checking for C library user32... (cached) yes
Checking for C library pthread... (cached) no
Checking for C library iconv... (cached) no
Checking for C library shlwapi... (cached) yes
Checking for C library version... (cached) yes
Checking for C library zdll... (cached) yes
Checking for C library zdll... (cached) yes
Checking for C library zdll... (cached) yes
Checking for C library dl... (cached) no
Checking for C library gdi32... (cached) yes
Checking for C library iconv... (cached) no
Checking for C library pthread... (cached) no
Checking for C library user32... (cached) yes
Checking for C library version... (cached) yes
Checking for C library zdll... (cached) yes
Checking for C++ library cppunit... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
link /nologo /map /subsystem:windows,5.01 /entry:NSISWinMainNOCRT /NODEFAULTLIB /OUT:build\urelease\MakeLangId\MakeLangId.exe kernel32.lib user32.lib comctl32.lib build\urelease\MakeLangId\MakeLangId.obj build\urelease\MakeLangId\resource-rc.res build\urelease\MakeLangId\memset.obj
MakeLangId.obj : error LNK2019: unresolved external symbol __hypot referenced in function _hypot
MakeLangId.obj : error LNK2001: unresolved external symbol __fltused
build\urelease\MakeLangId\MakeLangId.exe : fatal error LNK1120: 2 unresolved externals
scons: *** [build\urelease\MakeLangId\MakeLangId.exe] Error 1120
scons: building terminated because of errors.
d:\dev\nsis> 
i still had the window open from the time it refused to run from a normal window;
no changes made since!

D:\dev\nsis>scons
'scons' is not recognized as an internal or external command,
operable program or batch file.
D:\dev\nsis> 
Anders#
Why do you even need to build NSIS? If you cannot piece together the information you have already gotten to get past the MakeLangId problem then I don't understand how you are going to be able to make any meaningful changes to the source...
JasonFriday13#
Alright, close that window that failed. Now use your original scons command line on the new window.

Because the command window doesn't pickup changes in the environment, it's advised to only have one command window open at any time, and close and open a new window after each change. On ubuntu it doesn't matter, I can have one command window open and I can add and remove path variables and programs, and the command window can still pick them up, and it remembers every command you type into it 🙂.

[edit] Just saw Ander's reply, that's a good point, I didn't have this much trouble compiling NSIS, I use VS2008 and I skip the help file and NSIS Menu. I've done this on windows 7 and windows 10.

I noticed VS version 12 in the scons output, do you have VS2013/VS2015 installed by any chance?
MyPC8MyBrain#
W00T -> scons: done building targets.
what a silly thing to cause this odd behavior; good catch there Jason!

trying a fresh build now 🙂

ATB
Chris
MyPC8MyBrain#
why am i getting ->
File: "..\NSIS.exe" -> no files found.

when trying to compile an exe or archive?
scons dist-installer SKIPUTILS="MakeLangId","NSIS Menu"?

TIA
Chris
Anders#
Originally Posted by MyPC8MyBrain View Post
why am i getting ->
File: "..\NSIS.exe" -> no files found.
Because you skipped NSIS menu when you built NSIS. You will not be able to compile the official NSIS installer without it but you can compile all other scripts...
MyPC8MyBrain#
Thank you Jason, i end up with no exe after compiling,
any idea why im getting these errors to start with; is it the src files or my environment?

TIA
Chris
MyPC8MyBrain#
im curious now about this 2GB limit,
have you stumbled on this before? why isnt this implemented in NSIS standard builds today?

(blog https://ywjheart.wordpress.com/2012/...-the-2gb-limit)

ATB
Chris
MyPC8MyBrain#
Originally Posted by Anders View Post
Why do you even need to build NSIS?
trying to get this compiled with a private key

Originally Posted by Afrow UK View Post
You need to modify exehead\fileform.h. Insert a dummy enum value name just before EW_EXTRACTFILE (this ensures File gets a new opcode). E.g.
EW_WHYDIDNTITHINKOFTHISDOH,
EW_EXTRACTFILE,
Stu
JasonFriday13#
That code is a bit old now, mine is based on 3.0b2.

The devs have talked about it, but nothing has been set in concrete. I've been experimenting with it over the last year or two, and I have a working prototype right now.

Processed 1 file, writing output (amd64-unicode):
Processing pages... Done!
Removing unused resources... Done!
Generating language tables... Done!
Output: "C:\NSIS\bigfile.exe"
Output: "C:\NSIS\bigfile.bin"
Install: 2 pages (128 bytes), 1 section (2072 bytes), 1216 instructions (38912 bytes), 7081 strings (60042 bytes), 1 language table (270 bytes).
Datablock optimizer saved 1455 KiB (~0.0%).
Using zlib compression.
EXE header size:               64000 / 49664 bytes
Install code:                 101884 / 101880 bytes
Install data:                   7442 MiB / 7444 MiB
CRC (0x4DD627A2):                  4 / 4 bytes
Totals:
Exe size:                     165888 / 151548 bytes (109.4%)
Bin size:                       7442 MiB / 7444 MiB 
JasonFriday13#
I've been thinking about it, but really I don't want to. The trunk build has had some major changes done to it since my fork, and I don't really want to maintain a fork that's probably going to be discarded in the future anyway (because technology keeps moving on).
MyPC8MyBrain#
why would it be discard in future releases; this is crucial today!
if anything this should be further enhanced and supported, im shocked to find out this 2GB limit,
everyone moving towards 64bit more ram; more speeds; while NSIS is stuck with FAT16 limits?
shocked, stunned, extremely disappointed; i will likely be looking for another solution 🙁 ,

did you manage to fix the few loss end he originally left with compression and such?