Archive: Building NSIS on Linux


Building NSIS on Linux
Hi Guys,

I was immensely pleased to see that I could, in theory,
build NSIS installers under a Linux/POSIX gnu build infrastructure with a mingw cross-compiler... If only...

I'd appreciate any help:

SCons v0.96.91.D001
i386-mingw32msvc-gcc (GCC) 3.4.1 (mingw special)
i386-mingw32msvc-g++ (GCC) 3.4.1 (mingw special)
etc

So I simply:

'scons' and fairly immediately a problem:

i386-mingw32msvc-g++ -s -mwindows -Wl,--file-alignment,512 -Wl,-Map,build/release/BgImage/BgImage.map -Wl,-e_DllMain@12 -nostdlib -Wl,--exclude-libs,msvcrt.a -shared -o build/release/BgImage/BgImage.dll build/release/BgImage/BgImage.o SCons/Config/memcpy.c SCons/Config/memset.c -lkernel32 -luser32 -lgdi32 -lwinmm -Wl,--out-implib,build/release/BgImage/BgImage.lib -Wl,--output-def,build/release/BgImage/BgImage.def
Creating library file: build/release/BgImage/BgImage.lib
build/release/BgImage/BgImage.o(.eh_frame+0x11):BgImage.cpp: undefined reference to `___gxx_personality_v0'
collect2: ld returned 1 exit status
scons: *** [build/release/BgImage/BgImage.dll] Error 1
scons: building terminated because of errors.

So I see '-nostdlib' (and without really knowing what I'm doing, but knowing it's a symbol that the standard library provides), I remove this switch from SCons/Config/gnu:

defenv['NODEFLIBS_FLAG'] = '-Wl,--exclude-libs,msvcrt.a'

Progress... Lots of progress...

i386-mingw32msvc-gcc -o build/release/System/Source/System.o -c -Os -Wall -DSYSTEM_EXPORTS Contrib/System/Source/System.c
In file included from Contrib/System/Source/System.c:4:
Contrib/System/Source/stdafx.h:13:27: warning: no newline at end of file
Contrib/System/Source/System.c:8:20: crtdbg.h: No such file or directory
Contrib/System/Source/System.c: In function `PrepareProc':
Contrib/System/Source/System.c:372: warning: cast to pointer from integer of different size
Contrib/System/Source/System.c:636: warning: cast to pointer from integer of different size
Contrib/System/Source/System.c:665: warning: cast to pointer from integer of different size
Contrib/System/Source/System.c:688: warning: cast to pointer from integer of different size
Contrib/System/Source/System.c: In function `ParamsIn':
Contrib/System/Source/System.c:770: warning: cast to pointer from integer of different size
Contrib/System/Source/System.c: At top level:
Contrib/System/Source/System.c:872: warning: `naked' attribute directive ignored
Contrib/System/Source/System.c: In function `CallProc':
Contrib/System/Source/System.c:876: error: `_asm' undeclared (first use in this function)
Contrib/System/Source/System.c:876: error: (Each undeclared identifier is reported only once
Contrib/System/Source/System.c:876: error: for each function it appears in.)

and now lots of asm related warnings, proc undeclared, syntaxt error before push, unexpected tokens, errors before tokens, you get the idea...

scons: *** [build/release/System/Source/System.o] Error 1
scons: building terminated because of errors.

Now I'm pretty much stuck. Can anyone shed some light on how I can correctly perform the cross-compile? Do I have a screwed up or partial cross-compile environment (we use it for a seperate C project cross-compile no problems)?

Any help, greatly, greatly appreciated!


System can't be built with MinGW because its source code contains assembly code in MSVC syntax. You should use:

scons SKIPPLUGINS=System
I'll add a note about it to the documentation, as it seems it won't be solved soon.

Please submit a bug report about ___gxx_personality_v0 and I'll take a look it later, hopefully this week.

Thanks for the response!

I'll post the bug report.

So I only needed System to make a call to allow only a single instance of the installer.

Function .onInit
; Only allow a single instance of the installer
System::Call 'kernel32::CreateMutexA(...)

What's the best way round this? If I really need System, should I:

a) cross-compile entire system but grab System from nightly build and slot that in?

b) Forget cross-compilation, compile makensis and drop that into the nightly build?

c) Use WINE

Many thanks!


The best option is to forget cross-compilation, compile only makensis from source release and drop it in the zip release. Release binaries are compiled with MSVC6 which produces smaller results than both MinGW and MSVC Toolkit which is used for the nightly build.