Skip to content
⌘ NSIS Forum Archive

Building on linux , no install.log

18 posts

pkonduru#

Building on linux , no install.log

Hi All,
We were building an NSIS installer on a linux container using the NSIS logging build(2.46). Everything was working fine till now with the installer generating an install.log file when it is run. We updated our base container image with new JDK and now the installer that is being built is no longer producing the install.log. I don't see how the JDK and NSIS are tied together. This is what I use to build the NSIS in the linux container.

RUN mkdir /tmp/nsis &&\
yum install -y ca-certificates &&\
wget https://jaist.dl.sourceforge.net/pro...sis-3.02.1.zip -P /tmp/nsis/ &&\
wget https://jaist.dl.sourceforge.net/pro....1-src.tar.bz2 -P /tmp/nsis/ &&\
yum install -y scons glibc-devel glibc-devel.i686 &&\
unzip /tmp/nsis/nsis-3.02.1.zip -d /usr/local/ &&\
mv /usr/local/nsis-* /usr/local/nsis &&\
tar -xvf /tmp/nsis/nsis-3.02.1-src.tar.bz2 -C /usr/local/src/ &&\
mv /usr/local/src/nsis-* /usr/local/src/nsis &&\
cd /usr/local/src/nsis &&\
echo "#define NSIS_CONFIG_LOG" >> /usr/local/src/nsis/Source/exehead/config.h &&\
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/usr/local/nsis/bin install-compiler &&\
ln -s /usr/local/nsis/bin/makensis /usr/local/bin/makensis &&\
yum clean all &&\
rm -rf /var/cache/yum &&\
rm -rf /tmp/*

### we basically add the custom dialogs and plugins from our NSIS logging build here.
COPY 2.46.zip /tmp/
RUN mkdir /usr/local/nsis/p4thirdparty &&\
cd /usr/local/nsis/p4thirdparty &&\
unzip /tmp/2.46.zip &&\
cp -f Plugins/*.dll ../Plugins/x86-ansi/ &&\
cp -f Plugins/x86-ansi/*.dll ../Plugins/x86-ansi/ &&\
cp -rf Examples/* ../Examples/ &&\
cp -rf Stubs/* ../Stubs/ &&\
cp -rf Include/* ../Include/ &&\
cp -rf Contrib/* ../Contrib/ &&\
rm -rf /tmp/* &&\
rm -rf /usr/local/nsis/p4thirdparty
Anders#
The docs tell you to pass NSIS_CONFIG_LOG=yes to scons as a parameter.

Anyway, we don't support mixing different versions. If you want NSIS 3 you also have to find stubs and plugins that match the exact version. If you don't care about Unicode you could compile 2.xx instead I guess.

Not sure why the JDK would trigger this, we don't use Java at all.
pkonduru#
Thank you Anders for the reply. This code has remained unchanged for over 2 years now. I am trying to debug why it wouldn't generate a log suddenly now. I will certainly try to pass that parameter and keep the NSIS versions similar and see how it goes.
pkonduru#
Error building the nsis src from 2.46

Hi Anders,

So I changed the code to use nsis 2.46, so this is what I am basically doing:
The {docker_image_nsis_thirdparty_zip} is basically my nsis-2.46.zip with the logging build. the {docker_image_nsis_src_download_url} is the url for the nsis-2.46 source code that I get from here:


COPY {{ docker_image_nsis_thirdparty_zip }} /tmp/
RUN mkdir /tmp/nsis &&\
yum install -y ca-certificates &&\
wget {{ docker_image_nsis_src_download_url }} -P /tmp/nsis/ &&\
yum install -y scons glibc-devel glibc-devel.i686 &&\
unzip /tmp/{{ docker_image_nsis_thirdparty_zip }} -d /usr/local/nsis/ &&\
tar -xvf /tmp/nsis/{{ docker_image_nsis_src_download_url|basename }} -C /usr/local/src/ &&\
mv /usr/local/src/nsis-* /usr/local/src/nsis &&\
cd /usr/local/src/nsis &&\
echo "#define NSIS_CONFIG_LOG" >> /usr/local/src/nsis/Source/exehead/config.h &&\
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_LOG=yes NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/usr/local/nsis/bin install-compiler &&\
ln -s /usr/local/nsis/bin/makensis /usr/local/bin/makensis &&\
yum clean all &&\
rm -rf /var/cache/yum &&\
rm -rf /tmp/*


When I run this on RHEL, this is the error I get, when running the scons command:

g++ -o Source/ResourceVersionInfo.o -c -Wno-non-virtual-dtor -Wall -O2 -m32 "-DNSISCALL= __attribute__((__stdcall__))" -D_WIN32_IE=0x0500 -Ibuild/release/config Source/ResourceVersionInfo.cpp
g++ -o Source/script.o -c -Wno-non-virtual-dtor -Wall -O2 -m32 "-DNSISCALL= __attribute__((__stdcall__))" -D_WIN32_IE=0x0500 -Ibuild/release/config Source/script.cpp
In file included from Source/script.cpp:22:0:
Source/util.h: In instantiation of 'void __free_with_close:😳perator()(T&) [with T = int]':
Source/util.h:114:32: required from 'ResourceManager<_RESOURCE, _FREE_RESOURCE>::~ResourceManager() [with _RESOURCE = int; _FREE_RESOURCE = __free_with_close]'
Source/script.cpp:6460:1: required from here
Source/util.h:128:59: error: 'close' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
template <typename T> void operator()(T& x) { freefunc(x); } \
^
Source/util.h:145:1: note: in expansion of macro 'RM_DEFINE_FREEFUNC'
RM_DEFINE_FREEFUNC(close);
^
In file included from Source/script.cpp:46:0:
/usr/include/unistd.h:353:12: note: 'int close(int)' declared here, later in the translation unit
extern int close (int __fd);
^
scons: *** [Source/script.o] Error 1
scons: building terminated because of errors.
Anders#
2.46 is 13 years old and not something we support nor recommend using, especially if you don't pair it with a compiler from the same era. I'll try to look at the code later but perhaps it's time to move to 3.x?
Anders#
Originally Posted by pkonduru View Post

When I run this on RHEL, this is the error I get, when running the scons command:
Try adding

#include <unistd.h>

near the top of /Source/util.h after the other #includes...
pkonduru#
Thank you Anders, I tried that but it gave this error.
First, here is my script:

COPY {{ docker_image_nsis_thirdparty_zip }} /tmp/
RUN mkdir /tmp/nsis &&\
yum install -y ca-certificates &&\
wget {{ docker_image_nsis_src_download_url }} -P /tmp/nsis/ &&\
yum install -y scons glibc-devel glibc-devel.i686 &&\
unzip /tmp/{{ docker_image_nsis_thirdparty_zip }} -d /usr/local/nsis/ &&\
tar -xvf /tmp/nsis/{{ docker_image_nsis_src_download_url|basename }} -C /usr/local/src/ &&\
mv /usr/local/src/nsis-* /usr/local/src/nsis &&\
cd /usr/local/src/nsis &&\
echo "#define NSIS_CONFIG_LOG" >> /usr/local/src/nsis/Source/exehead/config.h &&\
echo "#include <unistd.h>" >> /usr/local/src/nsis/Source/util.h &&\
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_LOG=yes NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/usr/local/nsis/bin install-compiler &&\
ln -s /usr/local/nsis/bin/makensis /usr/local/bin/makensis &&\
yum clean all &&\
rm -rf /var/cache/yum &&\
rm -rf /tmp/*


This is the error I get:

g++ -o Source/script.o -c -Wno-non-virtual-dtor -Wall -O2 -m32 "-DNSISCALL= __attribute__((__stdcall__))" -D_WIN32_IE=0x0500 -Ibuild/release/config Source/script.cpp
In file included from Source/script.cpp:22:0:
Source/util.h: In instantiation of 'void __free_with_close:😳perator()(T&) [with T = int]':
Source/util.h:114:32: required from 'ResourceManager<_RESOURCE, _FREE_RESOURCE>::~ResourceManager() [with _RESOURCE = int; _FREE_RESOURCE = __free_with_close]'
Source/script.cpp:6460:1: required from here
Source/util.h:128:59: error: 'close' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
template <typename T> void operator()(T& x) { freefunc(x); } \
^
Source/util.h:145:1: note: in expansion of macro 'RM_DEFINE_FREEFUNC'
RM_DEFINE_FREEFUNC(close);
^
In file included from Source/util.h:159:0,
from Source/script.cpp:22:
/usr/include/unistd.h:353:12: note: 'int close(int)' declared here, later in the translation unit
extern int close (int __fd);
^
scons: *** [Source/script.o] Error 1
scons: building terminated because of errors.
pkonduru#
error log

I added the line at the beginning using this:

sed -i '17i#include <unistd.h>' /usr/local/src/nsis/Source/util.h

basically add at line 17 where the file starts after the comments.
This is the errors I got. I am attaching afile with the errors as it is not letting me post it as text.
pkonduru#edited
Hi Anders,
I upgraded my nsis to 3.08 and everything went fine while building the source code on linux using scons. But when I am building my .nsi file on the linux machine this is the error that I see. Any pointers on what can be done?

$ makensis -V3 -DVERSION_MAJOR=$VERSION_MAJOR -DVERSION_MINOR=$VERSION_MINOR -DVERSION_RELEASE=$VERSION_RELEASE -DBUILD_NUMBER=$CI_PIPELINE_ID -DEXTERNAL_VER="$EXTERNAL_VER" -DINSTALLER_EXT_VER="$INSTALLER_EXT_VER" $CI_PROJECT_DIR/WI/FoundationSetup.nsi
Error: reading stub "/usr/local/nsis/Stubs/zlib-x86-unicode"
Error initalizing CEXEBuild: error setting default stub


By the way this what I have done to build nsis on linux:
Where {docker_image_nsis_thirdparty_zip } is the nsis-3.08 build with the logging components inside.
{ docker_image_nsis_src_download_url } is where I get the source code for nsis-3.08 from:



COPY {{ docker_image_nsis_thirdparty_zip }} /tmp/
RUN mkdir /tmp/nsis &&\
yum install -y ca-certificates &&\
wget {{ docker_image_nsis_src_download_url }} -P /tmp/nsis/ &&\
yum install -y scons glibc-devel glibc-devel.i686 &&\
unzip /tmp/{{ docker_image_nsis_thirdparty_zip }} -d /usr/local/nsis/ &&\
tar -xvf /tmp/nsis/{{ docker_image_nsis_src_download_url|basename }} -C /usr/local/src/ &&\
mv /usr/local/src/nsis-* /usr/local/src/nsis &&\
cd /usr/local/src/nsis &&\
echo "#define NSIS_CONFIG_LOG" >> /usr/local/src/nsis/Source/exehead/config.h &&\
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_LOG=yes NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/usr/local/nsis/bin install-compiler &&\
ln -s /usr/local/nsis/bin/makensis /usr/local/bin/makensis &&\
yum clean all &&\
rm -rf /var/cache/yum &&\
rm -rf /tmp/*
Anders#
To ask a stupid question, does "/usr/local/nsis/Stubs/zlib-x86-unicode" exist? If not then you need to grab those files from https://sourceforge.net/projects/nsi...-fra&download= (https://nsis.sourceforge.io/Special_Builds#)
pkonduru#
aah, I see what you are saying, basically in the nsis-3.08-log.zip there is no separate folder zlib-x86-unicode. All the files are under Stubs. Should I create a folder zlib-x86-unicode and put all the unicode files in there?
or are you asking if that file exists? It does exist in my stubs folder.
pkonduru#
Do you think I should add these to the SCONS command "build_static=1 build_dynamic=0 UNICODE=yes"?
Anders#
zlib-x86-unicode is a filename. The files in the .zip stub folder go in the stubs folder /usr/local/nsis/Stubs. The stubs and plug-ins are not built because you are asking scons not to build them (not unusual on linux but you still need the file from somewhere).
pkonduru#
I do have the file under usr/local/nsis/stubs. I think the prefix directory that I pass to scons usr/local/nsis/bin the directory was not correct. When I unzipped the 3.08.zip it created another folder 3.08 and contents are under that. So basically there is nothing under usr/local/nsis/bin but under /usr/local/nsis/3.08/bin does. Let me update my script and see how it goes.
thank you for your help Anders!
pkonduru#
(solved) Finally!

Thanks Anders for the help!
The issue was that the nsis-3.08.zip when extracted was creating another sub-directory under which all the files were. Moving them to the right directory fixed it. For anyone looking to build NSIS 3.08 on linux, here's what I did. This is my ansible script but basically shell command that I ran on the linux box(RHEL).

docker_image_nsis_thirdparty_zip -- this refers to the actual nsis-3.08.zip file from the downloads.
docker_image_nsis_src_download_url --this refers to the nsis-3.08 src code from the downloads .



COPY {{ docker_image_nsis_thirdparty_zip }} /tmp/
RUN mkdir /tmp/nsis &&\
yum install -y ca-certificates &&\
wget {{ docker_image_nsis_src_download_url }} -P /tmp/nsis/ &&\
yum install -y scons glibc-devel glibc-devel.i686 &&\
unzip /tmp/{{ docker_image_nsis_thirdparty_zip }} -d /usr/local/ &&\
mv /usr/local/3.08 /usr/local/nsis &&\
tar -xvf /tmp/nsis/{{ docker_image_nsis_src_download_url|basename }} -C /usr/local/src/ &&\
mv /usr/local/src/nsis-* /usr/local/src/nsis &&\
cd /usr/local/src/nsis &&\
echo "#define NSIS_CONFIG_LOG" >> /usr/local/src/nsis/Source/exehead/config.h &&\
scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all NSIS_CONFIG_LOG=yes NSIS_CONFIG_CONST_DATA_PATH=no PREFIX=/usr/local/nsis/bin install-compiler &&\
ln -s /usr/local/nsis/bin/makensis /usr/local/bin/makensis &&\
yum clean all &&\
rm -rf /var/cache/yum &&\
rm -rf /tmp/*