Archive: Building a Windows installer package under FreeBSD invalid DOS header message


Building a Windows installer package under FreeBSD invalid DOS header message
Hello, I am trying to build a OpenVPN gui installer under FreeBSD but keep running into this error:

!define: "MUI_UNFINISHPAGE_NOAUTOCLOSE"=""
!define: "MUI_COMPONENTSPAGE_TEXT_TOP"="Select the components to install/upgrade. Stop any OpenVPN or OpenVPN GUI processes or the OpenVPN service if it is running."
!insertmacro: MUI_PAGE_LICENSE
Error while changing UI: PE file contains invalid DOS header
Error in macro MUI_INTERFACE on macroline 50
Error in macro MUI_PAGE_INIT on macroline 2
Error in macro MUI_PAGE_LICENSE on macroline 5
Error in script "openvpn-gui.nsi" on line 111 -- aborting creation process

Does anyone know which file this is complaining about or how to fix this?


It's probably complaining about Contrib/UIs/modern.exe. Can you execute that application on Windows? Which version of NSIS is that? Which processor are you using?


Thanks for the reply.

Using nsis-2.36 and I zipped up the Contrib/UIs from a recent NSIS Windows Installer executable and used WinSCP to copy the zip file to the FreeBSD host and used unzip to extract the files. I am pretty sure the windows binaries will work OK on windows.


Processor?


Here is the relevant dmesg -a information:

Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008
root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD Opteron(tm) Processor 275 (2205.01-MHz 686-class CPU)
Origin = "AuthenticAMD" Id = 0x20f12 Stepping = 2
Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
Features2=0x1<SSE3>
AMD Features=0xe2500800<SYSCALL,NX,MMX+,FFXSR,LM,3DNow!+,3DNow!>
AMD Features2=0x2<CMP>
Cores per package: 2
real memory = 1073709056 (1023 MB)
avail memory = 1037111296 (989 MB)
ACPI APIC Table: <HP 00000083>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1

Appreciate all the help so far!!


It might be complaining about the Stubs. Have you copied those from Windows as well? That check is the very first check of the EXE file and just checks the first two characters are MZ. If your processor is not big-endian, I don't see how that can go wrong unless the file is really invalid.

Do you care for some debugging? Can you tell what it compares to MZ?


Hmm, you might be on to something. I could not locate any of the stubs in the source tree since soca was instructed to not build them (it errors out when building). So this very well might be the cause of the issues. Where can I obtain the correct Stubs to populate to /usr/local/Stubs?


From the zipped up version of NSIS. See the SourceForge download page. As for the location, I'm not sure that's the right one, but it depends on how you built makensis.


The zipped up version of NSIS's stubs will work okay on FreeBSD without rebuilding?


Sure. It's just the Windows installer stub. They are read as data files by makensis.


That appears to have fixed it. Thanks a lot for your help!!