I was supposed to create a Windows installer recently, but I just hate using Windows. NSIS was the chosen installer creator. I was lucky to be able to compile the NSIS installer on Linux.
The installer just ran without any glitches on wine. So testing the installer as not an issue as well.
Let me guide you through installing NSIS on Linux and how to use it on Linux.
Requires
- Python
- SCons
Steps
- Download both the release and the source of x.xx.
- Extract both into one parent parent directory
- Change to the source directory
- Compile makensis using scon
- Copy makensis to the release
- Change to the <parent>
- Install – Copy makensis to the install location
- Create the link from the bin directory to the makensis such that
makensis is accessible from the command line.
nsis-x.xx.zip nsis-x-xx-src.tar.gz
<parent>
|
+-- nsis-x.xx
+-- nsis-x.xx-src
$ cd nsis-x.xx-src
$ scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all
$ cp build/release/makensis/makensis ../nsis-x.xx/makensis
$ cd ..
$ sudo cp -r nsis-x.xx/* /usr/local/share/nsis/
$ sudo link /usr/local/share/nsis/makensis /usr/bin/makensis
Thanks, that works as far as it goes… but I’m getting this:
2 warnings:
File /a is disabled for non Win32 platforms. (pcdinst.nsi:81)
File /a is disabled for non Win32 platforms. (pcdinst.nsi:82)
It works anyway! Just letting everybody know to watch out for this…
Hi,
I Just want to know whether can we create a installer package for linux using NSIS.
See http://nsis.sourceforge.net/Main_Page, NSIS for making Windows Installers
Hi,
Thanks for the above reply.But in some sites they have told that we can have a makensis compiler for Linux with the help of windows source. I tried i got a compiler for Linux. With the help of that is it possible to create installer package for linux
You can make the installed on Linux but you can’t use it on Linux (without Wine or similar). Using NSIS compiler (makensis) on Linux is what this blog post is about.
At best you are confused.
Hi,
While running the below command im getting some exception.
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all
Can you please post the exception?
Hi,
Please find the error
scons: Reading SConscript files …
Mkdir(“build/release/config”)
scons: *** build/release/config: File exists
Delete(“nsis-28-Oct-2009.cvs”)
Delete(“.instdist”)
Delete(“.test”)
Using GNU tools configuration
Checking for compiler flag -m32… (cached) yes
Checking for linker flag -m32… (cached) yes
Checking for linker flag $MAP_FLAG… (cached) yes
Checking for linker flag -s… (cached) yes
Checking for linker flag $MAP_FLAG… (cached) yes
Checking for compiler flag -m32… (cached) yes
Checking for linker flag -m32… (cached) yes
Checking for linker flag -s… (cached) yes
Checking for compiler flag -m32… (cached) yes
Checking for linker flag -m32… (cached) yes
Checking for memcpy requirement… (cached) yes
Checking for memset requirement… (cached) yes
Checking for linker flag -pthread… (cached) yes
Checking for __BIG_ENDIAN__… (cached) no
Checking for C library gdi32… (cached) no
Checking for C library user32… (cached) no
Checking for C library pthread… (cached) yes
Checking for C library iconv… (cached) no
Checking for C library dl… (cached) yes
Checking for C library gdi32… (cached) no
Checking for C library iconv… (cached) no
Checking for C library pthread… (cached) yes
Checking for C library user32… (cached) no
Checking for C++ library cppunit… (cached) no
scons: done reading SConscript files.
scons: Building targets …
gcc -o build/release/ExDLL/pluginapi.o -c -Os -Wall -fno-strict-aliasing “-DNSISCALL= __attribute__((__stdcall__))” -ISource/exehead Contrib/ExDLL/pluginapi.c
Contrib/ExDLL/pluginapi.c:1:21: error: windows.h: No such file or directory
In file included from Contrib/ExDLL/pluginapi.h:8,
from Contrib/ExDLL/pluginapi.c:3:
Source/exehead/api.h:37: error: expected declaration specifiers or ‘…’ before ‘*’ token
Source/exehead/api.h:37: warning: type defaults to ‘int’ in declaration of ‘UINT_PTR’
Source/exehead/api.h:37: error: ‘UINT_PTR’ declared as function returning a function
Source/exehead/api.h:66: error: expected declaration specifiers or ‘…’ before ‘HWND’
Source/exehead/api.h:68: warning: parameter names (without types) in function declaration
Contrib/ExDLL/pluginapi.c: In function ‘popstring’:
Contrib/ExDLL/pluginapi.c:16: warning: implicit declaration of function ‘lstrcpyA’
Contrib/ExDLL/pluginapi.c:18: warning: implicit declaration of function ‘GlobalFree’
Contrib/ExDLL/pluginapi.c:18: error: ‘HGLOBAL’ undeclared (first use in this function)
Contrib/ExDLL/pluginapi.c:18: error: (Each undeclared identifier is reported only once
Contrib/ExDLL/pluginapi.c:18: error: for each function it appears in.)
Contrib/ExDLL/pluginapi.c:18: error: expected ‘)’ before ‘th’
Contrib/ExDLL/pluginapi.c: In function ‘popstringn’:
Contrib/ExDLL/pluginapi.c:27: warning: implicit declaration of function ‘lstrcpynA’
Contrib/ExDLL/pluginapi.c:29: error: ‘HGLOBAL’ undeclared (first use in this function)
Contrib/ExDLL/pluginapi.c:29: error: expected ‘)’ before ‘th’
Contrib/ExDLL/pluginapi.c: In function ‘pushstring’:
Contrib/ExDLL/pluginapi.c:37: warning: implicit declaration of function ‘GlobalAlloc’
Contrib/ExDLL/pluginapi.c:37: error: ‘GPTR’ undeclared (first use in this function)
Contrib/ExDLL/pluginapi.c: In function ‘getuservariable’:
Contrib/ExDLL/pluginapi.c:45: error: ‘NULL’ undeclared (first use in this function)
Contrib/ExDLL/pluginapi.c: In function ‘setuservariable’:
Contrib/ExDLL/pluginapi.c:51: error: ‘NULL’ undeclared (first use in this function)
Contrib/ExDLL/pluginapi.c: In function ‘pushint’:
Contrib/ExDLL/pluginapi.c:189: warning: implicit declaration of function ‘wsprintf’
scons: *** [build/release/ExDLL/pluginapi.o] Error 1
scons: building terminated because of errors.
Hi,
May i know the reason for this exception
I don’t have access to a 32 bit installation right now, can you try with the following from the nsis source directory.
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip install-compiler
scons NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip /path/to/extracted/zip/LibraryLocal
Hi Mohanjith,
Even I am also getting the same error as Umesh. I tried with above options but it didn’t work.
Please can you suggest any other solution.
Hi ,I am trying to run the scons on solaris ,but it throws me below error.please help.
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/home/amhatre4/nsis/nsis-2.46/ install-compiler
File “/home/amhatre4/nsis/scons-2.0.1/script/scons”, line 140
temp = [os.path.join(x, ‘lib’) for x in prefs]
^
SyntaxError: invalid syntax
If you encounter issues with Stubs not found
You can use the script hereunder (save it as nsis-install.sh, then make it executable “chmod a+x nsis-install.sh”, then just launch it ./nsis-install.sh). You may get prompted to remove a directory if it already exists (make sure that it is not a problem to remove it or adapt the script to use another location)
#!/bin/bash
#
# Author: Guillaume Polet
#
# Copyright: Public domain. You may copy, redistribute, modify this file
# without any further obligation.
# This files comes with absolutely no WARRANTY of ANY kind! The author shall
# not be responsible for ANY DAMAGE or PROBLEM of ANY kind that could have
# been caused by this file. Use this file at your OWN risk!
#
# Ok this script may suck but it works! Feel free to optimize it, and if you are a cool dude, put it back online.
# A few vars to adapt if you want
ROOT_DIR=/usr/local/share
NSIS_DIR=nsis
NSIS_ABS_DIR=$ROOT_DIR/$NSIS_DIR
NSIS_VER=2.46
NSIS_SRC_FILE=nsis-$NSIS_VER-src.tar.bz2
NSIS_BIN_FILE=nsis-$NSIS_VER.zip
# First go to where we will unzip the sources
TMP=$(mktemp -d /tmp/nsis.XXXXXXXXXX) || { echo “Failed to create temp dir”; exit 1; }
cd $TMP
wget http://ovh.dl.sourceforge.net/project/nsis/NSIS%202/$NSIS_VER/$NSIS_SRC_FILE
tar xvjf $NSIS_SRC_FILE
# Then we grab the binaries and install it
mkdir -p $ROOT_DIR
cd $ROOT_DIR
if [ -d “$NSIS_ABS_DIR” ]; then
echo “$NSIS_ABS_DIR already exists, would you like to remove all of its content? (No undo possible!!!) (Y/N)”
read empty_dir
if [[ $empty_dir == “Y” || $empty_dir == “Yes” ]]; then
rm -Rf $NSIS_ABS_DIR
else
echo “directory not empty, cannot proceed.”
exit 1
fi
fi
wget http://kent.dl.sourceforge.net/project/nsis/NSIS%202/$NSIS_VER/$NSIS_BIN_FILE
unzip $NSIS_BIN_FILE
# Rename the binary folder
mv nsis-$NSIS_VER $NSIS_DIR
cd $TMP/nsis-$NSIS_VER-src
# We compile the program.
# The PREFIX argument provides an absolute path against which a bunch of
# relative path will be concatenated during build to install a bunch of stuff
#
# The PREFIX_BIN indicates where the built binary will be copied
#
# The PREFIX_DATA argument is very important as it gives an absolute path
# against which relative path for plugins, includes, stubs, contrib,
# win32 binaries–>this path will be coded in the built binary
#
# The VERSION argument is just for output of the makensis command when running
# it without arguments
#
# Use scons -h to see all arguments possible (there are tons of them)
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all PREFIX=$NSIS_ABS_DIR PREFIX_BIN=$NSIS_ABS_DIR PREFIX_DATA=$NSIS_ABS_DIR VERSION=$NSIS_VER install-compiler
# Finally, we install the built file in /usr/bin to make it available from the command line
echo “Installing $NSIS_ABS_DIR/makensis into /usr/bin/makensis”
ln -sf $NSIS_ABS_DIR/makensis /usr/bin/makensis
# Let’s clean-up a bit
cd $ROOT_DIR/
rm $NSIS_BIN_FILE
rm -Rf $TMP
To run the script above, you may need the following libraries:
ia32-libs
lib32stdc++6
libc6-dev-i386
gcc-multilib
g++-multilib
libstdc++5
and gcc, g++ and scons
cons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/path/to/extracted/zip install-compiler
If i give this comment,i got following error
scons: *** No SConstruct file found.
File “/usr/lib/scons/SCons/Script/Main.py”, line 904, in _main
can you guys help me? how to solve this?