Ran into a few minor issues building makensis on Solaris. The attached patch fixes these:
1. <cstdio> doesn't define FILE*; this may be found in <fstream>.
2. munmap() and msync() must take a char* as their first argument, not a void*.
3. Without <locale.h>, LC_CTYPE is undefined.
4. The last item in an enum list must not be followed by a comma.
There is one complication, however, that must be addressed before the patch can be applied. As soon as you add <fstream> to Source/strlist.h, you get the following error when building back on Linux:
----BEGIN CRAZY COMPLICATED C++ ERROR----
g++ -o build/release/makensis/util.o -c -Wno-non-virtual-dtor -O2 -Wall -m32 -I. -Iexehead "-DNSISCALL= __attribute__((__stdcall__))" -D_WIN32_IE=0x0500 /tmp/nsis-2.42-src/Source/util.cpp
/tmp/nsis-2.42-src/Source/util.cpp: In function `int
WideCharToMultiByte(unsigned int, unsigned int, const short unsigned int*,
int, char*, int, const char*, int*)':
/tmp/nsis-2.42-src/Source/util.cpp:224: error: call of overloaded
`__iconv_adaptor(size_t (&)(void*, char**, size_t*, char**, size_t*),
void*&, char**, size_t*, char**, size_t*)' is ambiguous
/tmp/nsis-2.42-src/Source/util.cpp:186: error: candidates are:
size_t __iconv_adaptor(size_t (*)(void*, T, size_t*, char**, size_t*),
void*, char**, size_t*, char**, size_t*) [with T = char**]
/usr/include/c++/3.3/i486-linux/bits/codecvt_specializations.h:253: error:
size_t std::__iconv_adaptor(size_t (*)(void*, _T, size_t*,
char**, size_t*), void*, char**, size_t*, char**, size_t*) [with _T =
char**]
/tmp/nsis-2.42-src/Source/util.cpp: In function `int
MultiByteToWideChar(unsigned int, unsigned int, const char*, int, short
unsigned int*, int)':
/tmp/nsis-2.42-src/Source/util.cpp:260: error: call of overloaded
`__iconv_adaptor(size_t (&)(void*, char**, size_t*, char**, size_t*),
void*&, char**, size_t*, char**, size_t*)' is ambiguous
/tmp/nsis-2.42-src/Source/util.cpp:186: error: candidates are:
size_t __iconv_adaptor(size_t (*)(void*, T, size_t*, char**, size_t*),
void*, char**, size_t*, char**, size_t*) [with T = char**]
/usr/include/c++/3.3/i486-linux/bits/codecvt_specializations.h:253: error:
size_t std::__iconv_adaptor(size_t (*)(void*, _T, size_t*,
char**, size_t*), void*, char**, size_t*, char**, size_t*) [with _T =
char**]
scons: *** [build/release/makensis/util.o] Error 1
scons: building terminated because of errors.
----END CRAZY COMPLICATED C++ ERROR----
I've got nothing on that :-(
Patch against NSIS SVN
It looks like your version of headers already has a definition of __iconv_adaptor in codecvt_specializations.h. Try renaming it and see if it works.
If I rename (i.e. delete) the __iconv_adaptor definition in Source/util.cpp, the Linux build succeeds, but then the Solaris build borks out with
/opt/SUNWspro/bin/CC -o build/release/makensis/util.o -c -I. -Iexehead -DNSISCALL= -D_WIN32_IE=0x0500 /tmp/nsis-2.42-src/Source/util.cpp
"/tmp/nsis-2.42-src/Source/util.cpp", line 225: Error: The function "__iconv_adaptor" must have a prototype.
"/tmp/nsis-2.42-src/Source/util.cpp", line 261: Error: The function "__iconv_adaptor" must have a prototype.
2 Error(s) detected.
scons: *** [build/release/makensis/util.o] Error 2
scons: building terminated because of errors.
Isn't it possible to make the signature match the one in the GCC headers? (Or is this a case where there are multiple contradictory definitions of this function?)
Did you modify its definition as well?
I don't know anything about the one in the GCC headers as it doesn't exist in my version. I'd rather have our function another name anyway to prevent clashes. It's not a documented function, so I don't think it'd be smart to rely on it.
Ohh, I get what you're saying---the function is defined by NSIS, but it's basically a copy of an internal function from GCC-land. The name stayed the same, but for some reason the signatures are slightly different, thus the conflict.
After replacing all three instances of "__iconv_adaptor" with e.g. "nsis_iconv_adaptor" in Source/util.cpp, everything builds on both Linux and Solaris.
Though the Solaris compiler does give these warnings:
/opt/SUNWspro/bin/CC -o build/release/makensis/util.o -c -I. -Iexehead -DNSISCALL= -D_WIN32_IE=0x0500 /tmp/nsis-2.42-src/Source/util.cpp
"/tmp/nsis-2.42-src/Source/util.cpp", line 225: Warning (Anachronism): Formal argument iconv_func of type unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*) in call to nsis_iconv_adaptor<const char**>(unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*), _iconv_info*, char**, unsigned*, char**, unsigned*) is being passed extern "C" unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*).
"/tmp/nsis-2.42-src/Source/util.cpp", line 225: Warning (Anachronism): Using extern "C" unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*) to initialize unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*).
"/tmp/nsis-2.42-src/Source/util.cpp", line 261: Warning (Anachronism): Formal argument iconv_func of type unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*) in call to nsis_iconv_adaptor<const char**>(unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*), _iconv_info*, char**, unsigned*, char**, unsigned*) is being passed extern "C" unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*).
"/tmp/nsis-2.42-src/Source/util.cpp", line 261: Warning (Anachronism): Using extern "C" unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*) to initialize unsigned(*)(_iconv_info*,const char**,unsigned*,char**,unsigned*).
4 Warning(s) detected.
Well, not exactly. It's not a copy of GCC-land function but it is a copy of something. I guess GCC just copied it from the same place and changed something in the signature.
As for the Solaris error, it seems to be complaining about the function being passed as extern "C". I don't see why it should care, so I say we ignore this warning.
Can you submit an updated patch so I can apply it?
Patch against NSIS SVN, rev. 2
I don't see a way to quiet that warning (adding 'extern "C"' to the function-pointer-argument definition doesn't work), so I can't argue with punting it.
New patch is attached.