Old 11th September 2015, 14:57   #1
JoeStrout
Junior Member
 
Join Date: Sep 2015
Posts: 1
How to build on Mac (mainly: where to find zlib?)

I'm trying to use NSIS to build Windows installers on my Mac. It appears to be one of the few tools out there that can do this (though I'm open to other suggestions if you have 'em).

I'm stuck on finding zlib for Win32, which it appears to require. I tried downloading the Binaries package from http://gnuwin32.sourceforge.net/packages/zlib.htm, and setting my ZLIB_W32 environment variable to point to the directory where I unzipped that, but scons still aborts with "zlib (win32) is missing!". I also tried pointing ZLIB_W32 to the zlib/bin directory, but get the same result.

I rechecked the build documentation, which doesn't have anything about this in the POSIX section, but does mention that "for Windows" I should get the zlib-1.2.7 prebuilt package linked here. So I downloaded that, unzipped it into my devtools directory, and updated my ZLIB_W32 environment variable to point to it. Then tried scons again... same result:

code:
(07:50:23)JoeMBPro:nsis-3.0b2-src> scons SKIPUTILS="NSIS Menu"
scons: Reading SConscript files ...
Delete("nsis-11-Sep-2015.cvs")
Delete(".instdist")
Delete(".test")
Using GNU tools configuration
Checking for linker flag $MAP_FLAG... no
Checking for linker flag -s... yes
Checking for linker flag $MAP_FLAG... no
Checking for linker flag -s... yes
Checking for memcpy requirement... yes
Checking for memset requirement... yes
Checking for linker flag -pthread... yes
Checking for __BIG_ENDIAN__... no
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
Checking for C library gdi32... no
Checking for C library user32... no
Checking for C library pthread... yes
Checking for C library iconv... yes
Checking for C library shlwapi... no
Checking for C library z... yes
Checking for C library iconv... yes
Checking for C library z... yes
Checking for C library zdll... no
Checking for C library z... no
zlib (win32) is missing!
(07:50:41)JoeMBPro:nsis-3.0b2-src> ls -l $ZLIB_W32
total 712
drwxr-xr-x@ 12 jstrout staff 408 Sep 11 07:47 .
drwxr-xr-x 9 jstrout staff 306 Sep 11 07:49 ..
-rw-r--r--@ 1 jstrout staff 164 Nov 10 2012 BUILD.txt
-rw-r--r--@ 1 jstrout staff 73286 May 2 2012 ChangeLog
-rw-r--r--@ 1 jstrout staff 17921 Mar 2 2006 DLL_FAQ.txt
-rw-r--r--@ 1 jstrout staff 4868 Feb 19 2012 README-WIN32.txt
drwxr-xr-x@ 4 jstrout staff 136 Nov 10 2012 include
drwxr-xr-x@ 6 jstrout staff 204 Nov 10 2012 lib
drwxr-xr-x@ 10 jstrout staff 340 Nov 10 2012 test
-rw-r--r--@ 1 jstrout staff 8760 May 2 2012 zlib.3.pdf
-rw-r--r--@ 1 jstrout staff 81964 Nov 10 2012 zlib1.dll
-rw-r--r--@ 1 jstrout staff 156672 Nov 10 2012 zlib1.pdb



What am I doing wrong here?

Note that I have searched this forum for "Mac" (no matches), and googled around for more detailed instructions on how to build this thing on OS X, but turned up nothing. Any tips would be very appreciated.
JoeStrout is offline   Reply With Quote
Old 11th September 2015, 22:01   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,457
You could try checking config.log in the root of the nsis source tree.

It sometimes also helps to delete .sconsign.dblite, .sconf_temp and build.

There are some threads about Mac on our bug tracker, you could check those.

Hopefully someone with more POSIX experience will chime in...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th September 2015, 11:32   #3
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
The problem is known, but you don't have to build your own NSIS binaries if you're fine with v2.46. That's available on both, Homebrew and Mac Ports.

If for some reason, you have to build NSIS binaries, does this only happen when building 3.0? Would be great if this could be solved (by someone better with POSIX experience) to get the beta running on both package managers.

Edit: I also remembered posting this on Stack Overflow, but no solution has been found
Yathosho is offline   Reply With Quote
Old 14th September 2015, 13:19   #4
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
For the record: I don't have any zlib-related problem when building 2.46
Yathosho is offline   Reply With Quote
Old 14th September 2015, 18:51   #5
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
I'm getting the same error when compiling on an Ubuntu-based Linux distro
Yathosho is offline   Reply With Quote
Old 14th September 2015, 20:29   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,457
Quote:
Originally Posted by Yathosho View Post
I'm getting the same error when compiling on an Ubuntu-based Linux distro
I believe the nightly is built on Ubuntu (drone.Io), you can see the nightly script @ http://sourceforge.net/p/nsis/code/H...unk/nightly.sh

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th September 2015, 03:14   #7
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Try specifing the ZLIB_W32 variable on the scons command line, if that fails use 'export ZLIB_W32="path/to/folder"' before calling scons. I have a VM setup identical to the nightly build (ubuntu 12.04 with the old cross-compiler triplet).

I'm hoping to remove the requirement for windows zlib files on linux completely by adding a wxwidgets version of zip2exe, which is the only program to use it.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 15th September 2015, 10:46   #8
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
Quote:
Originally Posted by JasonFriday13 View Post
if that fails use 'export ZLIB_W32="path/to/folder"' before calling scons.
I already tried that before and all I got was a different error

Before:
Please specify folder of zlib for Win32 via ZLIB_W32

After:
zlib (win32) is missing! (Mac)
zlib (posix) is missing! (Linux)

Just to be clear, which version of zlib do you use: Windows or native; source or binary? On OS X I tried both, including a mixed setup — without success. I haven't tried that on Linux, but I guess once I understand the details how to get it running on Linux, I can manage on OS X.

PS: I will give the nightly a try when I get home!
Yathosho is offline   Reply With Quote
Old 15th September 2015, 14:38   #9
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
Ubuntu: I can't build it using the SCons command from the script, but this worked fine (after installing the dependencies, of course):

code:
scons ZLIB_W32=/tmp/zlib SKIPUTILS="NSIS Menu"


OS X: Still getting zlib (win32) is missing! after wgetting the same file as in nightly.sh
Yathosho is offline   Reply With Quote
Old 15th September 2015, 23:19   #10
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
I haven't touched a single Apple product, so you are on your own, sorry.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 16th September 2015, 15:19   #11
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
Quote:
Originally Posted by JasonFriday13 View Post
I haven't touched a single Apple product, so you are on your own, sorry.
And nobody asked you to – my questions were not Apple specific but regarding POSIX platforms in general.

Anyway, the script provided by Anders solved all my previous problems. While I'm still figuring out how to get building to work on OS X, I'm installing FreeBSD to see whether this is a general issue with BSDs.
Yathosho is offline   Reply With Quote
Old 17th September 2015, 04:02   #12
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Quote:
Originally Posted by Yathosho View Post
Anyway, the script provided by Anders solved all my previous problems. While I'm still figuring out how to get building to work on OS X, I'm installing FreeBSD to see whether this is a general issue with BSDs.
Cool. Good idea trying FreeBSD, I didn't think of that.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 30th September 2015, 17:50   #13
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
I'm not much of a help here, I have problems running FreeBSD (actually GhostBSD) in VMware. Apparently, I'm not alone with this problem, but none of the advised solutions were of help.

Apart from this, I tried building NSIS on Fedora, but ended up with the same old zlib (posix) is missing! error. If anyone with more experience would like to look into this, this is what my adapted script looks like:


code:
# get zlib library
sudo dnf install scons mingw32-nsiswrapper zlib.x86_64 cppunit-devel.x86_64
wget -O /tmp/zlib.zip "https://downloads.sourceforge.net/project/libpng/zlib/1.2.8/zlib128-dll.zip"
mkdir /tmp/zlib
unzip /tmp/zlib.zip -d /tmp/zlib

# build
scons ZLIB_W32=/tmp/zlib SKIPUTILS="NSIS Menu" test dist-zip 2>&1 | tee build.log

# alternatively try zlib.x86_64 installed with dnf
scons ZLIB_W32=/usr/share/man/mann/zlib.n.gz SKIPUTILS="NSIS Menu" test dist-zip 2>&1 | tee build-alt.log



See attachments for build logs.
Attached Files
File Type: log build.log (1.2 KB, 143 views)
File Type: log build-alt.log (1.0 KB, 150 views)
Yathosho is offline   Reply With Quote
Old 30th September 2015, 19:24   #14
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,457
Quote:
Originally Posted by Yathosho View Post
Just to be clear, which version of zlib do you use
You need both the Windows version and the native POSIX version.

Kichik says that ZLIB_W32 should be used as a scons parameter and needs to point to the Windows version that you can download from our wiki. SCons also needs to be able to find the zlib-dev package for your platform (zlib.h and z library, see AddZLib in %NSISSource%\SCons\utils.py)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st October 2015, 05:51   #15
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
^^ What he said. The zlib(posix) error is fixed by installing the zlib package and it's -dev counterpart with the source headers. I installed this first before I started compiling nsis, that's probably why I never see this error.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 1st October 2015, 10:04   #16
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
Quote:
Originally Posted by Anders View Post
You need both the Windows version and the native POSIX version.

Kichik says that ZLIB_W32 should be used as a scons parameter and needs to point to the Windows version that you can download from our wiki. SCons also needs to be able to find the zlib-dev package for your platform (zlib.h and z library, see AddZLib in %NSISSource%\SCons\utils.py)
Well, the problem then is identifying the equivalent zlib-dev package for Fedora and FreeBSD. They both have names different from the Debian packages. Fedora's DNF lists hundred of packages containing the word "zlib" and FreeBSD is a whole different story.

Anyway, I tried to localize the problems to help the OP, but I don't have too much time for this. Hopefully someone else can pick up from here.

Looking at the history for the makensis formula, I'm positive that NSIS 3.0 will be supported as soon as it goes final.
Yathosho is offline   Reply With Quote
Old 1st October 2015, 18:51   #17
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,457
Quote:
Originally Posted by Yathosho View Post
Well, the problem then is identifying the equivalent zlib-dev package for Fedora and FreeBSD. They both have names different from the Debian packages.
zlib + zlib-devel on Fedora?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 11th February 2016, 12:49   #18
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
@JoeStrout I just thought you could take a look at how Brew compiles the source, don't know why I didn't think of it earlier

https://github.com/Homebrew/homebrew...la/makensis.rb
Yathosho is offline   Reply With Quote
Old 26th February 2016, 18:06   #19
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
I finally managed to build NSIS 3.0b3 on OS X!

Kickik pointed out, that zlib is required by zip2exe, for which -imho- there's no need to be compiled on non-Windows. So you can compile using the flag
code:
SKIPUTILS="zip2exe"
or even
code:
SKIPUTILS=all
.

Here's an updated formula for Homebrew, pull request is pending
Yathosho is offline   Reply With Quote
Old 28th February 2016, 21:50   #20
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Quote:
Originally Posted by Yathosho View Post
I finally managed to build NSIS 3.0b3 on OS X!

Kickik pointed out, that zlib is required by zip2exe, for which -imho- there's no need to be compiled on non-Windows.
I've been working on a port of zip2exe to get rid of this problem, but it still isn't finished yet. I should really finish it off before NSIS 3 exits beta.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 29th February 2016, 08:10   #21
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
It sure would be nice, for the sake of offering the full feature set, but I don't see it as a requirement. It's one thing to be able to compile installers on non-Windows, but I doubt there are (m)any people who need zip2exe on non-Windows.
Yathosho is offline   Reply With Quote
Old 1st March 2016, 18:47   #22
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 916
Yeah, that's the main reason why it hasn't changed. But the reason I'm doing the port is to get rid of the requirement to have windows zlib files on non-windows platforms in the first place.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 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