Search code examples
linuxnsis

NSIS Error "LicenseLangString: wchar_t conversion failed!" after Debian and NSIS Update


I create Windows installers under Linux with the help of the program "makensis". Recently I updated the Linux machine from Debian 9 to Debian 11, which brought an upgrade of NSIS from version 2.51 to 3.04..

Since then my script to create the installer does not compile anymore. The script is generated from a build environment and I know that other people have it running on Debian 11, so it seems to be due to my environment rather than syntactical errors in the script.

If I test install NSIS 2.51 from Debian 9, the script runs without problems.

The script should create installers in English and German, if I comment out the German entries, it also works.

I have checked the syntax several times and am now at a loss.

Output of the error (shortened):

makensis -V4 ./work/XXX/XXX.nsi

MakeNSIS v3.06.1-1 - Copyright 1999-2020 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.

Processing config: /etc/nsisconf.nsh

....

!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
LangString: "INWpTitle" 1033 "Installation of XXX"
LangString: "INWpTitle" 1031 "Installation der XXX"
LangString: "INWpText" 1033 "This Wizard will be guiding you through the installation of XXX.

Before installation BaseCamp must be closed for allowing installation of the map data.

Choose Next for starting the installation."
LangString: "INWpText" 1031 "Dieser Assistent wird Sie durch die Installation der XXX begleiten.

Vor der Installation muss das Programm BaseCamp geschlossen werden damit Kartendateien ersetzt werden koennen.

Klicken Sie auf Weiter um mit der Installation zu beginnen."
LicenseLangString: "licenseFile" 1033 "XXX.nsis.license.en"
LicenseLangString: wchar_t conversion failed!
Error in script "./work/XXX/XXX.nsi" on line 114 -- aborting creation process

Content of XXX.nsi

105 !insertmacro MUI_LANGUAGE "English"
106 !insertmacro MUI_LANGUAGE "German"
...

113 LicenseLangString licenseFile ${LANG_ENGLISH} "XXX.nsis.license.en"
114 LicenseLangString licenseFile ${LANG_GERMAN} "XXX.nsis.license.de" 

Solution

  • On non-Windows systems, iconv is used to convert the license file in NSIS 3 and there is something in that file it does not like.

    You can

    • A) Convert the license file to RTF format.

    • B) Convert the license file to UTF-8 or UTF-16LE and make sure the file starts with a BOM/Signature.