From: SourceForge.net <no...@so...> - 2010-03-23 18:43:19
|
Bugs item #2949102, was opened at 2010-02-10 15:16 Message generated for change (Comment added) made by f0rt You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=373085&aid=2949102&group_id=22049 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Build System Group: 2.0 Series Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alon Bar-Lev (alonbl) Assigned to: Amir Szekely (kichik) Summary: nsis and mingw-w64 cross compile Initial Comment: Hello, I am trying to build nsis with mingw-w64 project [1]. This project is better maintained and much more complete in many ways. Some difficulties... 1. New triplets should be added: i[3-6]86-w64-mingw32 x86_64-w64-mingw32 2. min() is not defined. 3. Includes should be at lower case. 4. Library gets: /usr/lib/gcc/i686-w64-mingw32/4.4.2/../../../../i686-w64-mingw32/sys-include/commctrl.h:14:2: error: #error _WIN32_IE setting conflicts 5. bug#1753070 at the end I cannot link and run 32bit on my machine... So I cannot test the above. Attached is a patch I created for 1-4. [1] http://mingw-w64.sourceforge.net/ ---------------------------------------------------------------------- Comment By: f0rt (f0rt) Date: 2010-03-23 19:43 Message: I cross compiled (x86_64-w64-mingw32) makensis and its surrounding utilities for Win64. The resulting installer can be downloaded from: http://f0rt.users.sourceforge.net/nsis-2.46+_64bit-setup.exe I have not tested the installer because I don't have access to a Win64 system. Please be aware that the installer does not check that the installation is performed on a Win64 system. The stubs and plug-ins were compiled with mingw32 because the generated cross compiler does only support the compilation for a 64-bit environment. echo 'int printf(const char *format, ...); int main(int c, char *v[]) { return printf ("Hello World!\n"); }' | x86_64-w64-mingw32-gcc -x c -m32 -Wall - /tmp/ccdsa25T.s: Assembler messages: /tmp/ccdsa25T.s:10: Error: suffix or operands invalid for `push' So the source code for stubs and plug-ins may yet not be compilable by w64-mingw32. http://f0rt.users.sourceforge.net/nsis_w64-mingw.patch This patch is based on alonbl's version. I adapted the handling for the _WIN32_IE define: By default the original settings for _WIN32_IE are used but the setting could be overruled by specifying the _WIN32_IE define as command line option of the compiler. (See nsis_w64-mingw_scons.patch) mingw32 expects BOOL as a return value for the DialogProc callback function. This clashes with the official specification http://msdn.microsoft.com/en-us/library/ms645469%28VS.85%29.aspx [DialogProc Function] and w64-mingw32 complains about it as well. Therefore I changed it from BOOL to INT_PTR. However the issue needs to be resolved for mingw32. GCL_HICON -> GCLP_HICON (LONG) pointer -> (LONG_PTR) pointer wsock32 -> ws2_32 NSIS Menu: ordered libs to allow compilation with w64-mingw32 and added gcc_libnsis as search path for header and library files. http://f0rt.users.sourceforge.net/nsis_w64-mingw_scons.patch Hacked gnu Scons file to work with w64-mingw32. Steps performed to build makensis and its surrounding utilities natively for Win64 (Host system Gentoo amd64): # Build cross tool chain sudo USE=-hardened crossdev --target x86_64-w64-mingw32 # Create build directory mkdir /tmp/nsis_build cd /tmp/nsis_build # Build zlib mkdir zlib cd zlib wget http://downloads.sourceforge.net/project/libpng/zlib/1.2.4/zlib-1.2.4.tar.bz2 tar xvf zlib-1.2.4.tar.bz2 cd zlib-1.2.4 sed -i.orig 's/^\(CC\|AR\|RC\)\s*=\s*\(.\+\)/\1 = x86_64-w64-mingw32-\2/g' win32/Makefile.gcc make -f win32/Makefile.gcc mkdir lib cp *.a lib mkdir include cp zconf.h zlib.h include cd .. # Build WX widgets for Win64 (specific for NSIS Menu) mkdir wxwin cd wxwin wget http://downloads.sourceforge.net/project/wxwindows/wxMSW/2.8.10/wxMSW-2.8.10.zip unzip wxMSW-2.8.10.zip wget http://f0rt.users.sourceforge.net/wxMSW_w64-mingw.patch.gz gzip -dc wxMSW_w64-mingw.patch.gz | patch -p0 cd wxMSW-2.8.10/build/msw make -f makefile.gcc SHELL=${SHELL} CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ AR=x86_64-w64-mingw32-ar RANLIB=x86_64-w64-mingw32-ranlib WINDRES=x86_64-w64-mingw32-windres CFG=nsis BUILD=release RUNTIME_LIBS=dynamic SHARED=0 UNICODE=0 WXUNIV=0 USE_OPENGL=0 USE_ODBC=0 USE_HTML=1 USE_XRC=0 cd ../../../.. # NSIS svn co https://nsis.svn.sourceforge.net/svnroot/nsis/NSIS/trunk nsis cd nsis wget http://f0rt.users.sourceforge.net/makensis_64bit.patch patch -p0 < makensis_64bit.patch wget http://f0rt.users.sourceforge.net/nsis_w64-mingw.patch patch -p0 < nsis_w64-mingw.patch wget http://f0rt.users.sourceforge.net/nsis_w64-mingw_scons.patch patch -p0 scons VERSION=2.46+ PREFIX=/usr PREFIX_CONF=/etc PREFIX_PLUGINAPI_INC=/usr/i686-mingw32/usr/include PREFIX_PLUGINAPI_LIB=/usr/i686-mingw32/usr/lib CHMDOCS=0 STRIP=yes STRIP_CP=yes STRIP_W32=yes ZLIB_W32=/tmp/nsis_build/zlib/zlib-1.2.4 WXWIN=/tmp/nsis_build/wxwin/wxMSW-2.8.10 scons VERSION=2.46+ PREFIX=/usr PREFIX_CONF=/etc PREFIX_PLUGINAPI_INC=/usr/i686-mingw32/usr/include PREFIX_PLUGINAPI_LIB=/usr/i686-mingw32/usr/lib CHMDOCS=0 STRIP=yes STRIP_CP=yes STRIP_W32=yes ZLIB_W32=/tmp/nsis_build/zlib/zlib-1.2.4 WXWIN=/tmp/nsis_build/wxwin/wxMSW-2.8.10 test-scripts cd .test makensis Examples/makensis.nsi # NSIS.chm has to be taken from a Windows installation, I commented out the inclusion of the plug-in api files ---------------------------------------------------------------------- Comment By: Alon Bar-Lev (alonbl) Date: 2010-03-21 20:57 Message: BTW: If you use Gentoo, try to build w64 cross toolchain for testing... $ ACCEPT_KEYWORDS="~amd64" emerge crossdev $ crossdev -t i686-w64-mingw32 ---------------------------------------------------------------------- Comment By: Alon Bar-Lev (alonbl) Date: 2010-03-21 20:51 Message: OK. It does not compile under win64... :) example GWL_WNDPROC usage that should be converted to GWLP_WNDPROC. ---------------------------------------------------------------------- Comment By: f0rt (f0rt) Date: 2010-03-21 18:02 Message: The patch for bug #1753070 should enable that makensis (NSIS script compiler) and portable utilities can be built natively for 64-bit systems (Win64, Debian amd64, Gentoo amd64, ...) So far I have not taken into consideration to build the plug-ins and stubs for native Win64. ---------------------------------------------------------------------- Comment By: Alon Bar-Lev (alonbl) Date: 2010-03-21 12:09 Message: Attached is a rebase of the patch. It is still needed even with the win64 patch. Please notice that there are two mingw branches today. The w32 (old) branch and the w64 (new) branch. The w64 is capable of compiling both 32bit and 64bit, and can replace the w32 branch that is in deep sleep. Both mingw versions will work with recent _WIN32_IE. BTW: You currently compiling the windows binaries as 32bit, nothing to gain if compiling as 64bit? ---------------------------------------------------------------------- Comment By: f0rt (f0rt) Date: 2010-03-20 10:02 Message: > 5. bug#1753070 at the end I cannot link and run 32bit on my machine... > So I cannot test the above. It would be great if could try out the patch for bug #1753070 and report back your results. ---------------------------------------------------------------------- Comment By: Alon Bar-Lev (alonbl) Date: 2010-02-27 20:23 Message: _WINRESRC_ is used for .rc include only, nobody should set this for compile. As I wrote before, the w64api is no backwards compatible with very old MS API, so they fail if you try to use this API. nsis does not use anything from the old API as it compiles successfully. ---------------------------------------------------------------------- Comment By: Amir Szekely (kichik) Date: 2010-02-27 20:07 Message: Maybe undefining _WINRESRC_ is a better solution? Can you attach the whole file? I can't understand yet why this error exists. ---------------------------------------------------------------------- Comment By: Alon Bar-Lev (alonbl) Date: 2010-02-21 09:16 Message: Yes it is mingw-w64 and not mingw32 issue. mingw-w64 can be compiled as 32bit or 64bit, and its win32 api is much more up-to-date and usable. So it worth the effort of supporting it. From: commctrl.h #ifndef _WINRESRC_ #ifndef _WIN32_IE #define _WIN32_IE 0x0501 #else #if (_WIN32_IE < 0x0501) #error _WIN32_IE setting conflicts #endif #endif #endif ---------------------------------------------------------------------- Comment By: Amir Szekely (kichik) Date: 2010-02-20 22:46 Message: My MinGW header files work fine. It's something with the 64-bit version. What exactly is the trigger for this error if not a pre-existing definition of _WIN32_IE? ---------------------------------------------------------------------- Comment By: Alon Bar-Lev (alonbl) Date: 2010-02-20 18:04 Message: The problem is not that the header defines its own value, but the header does not compatible with older interface. I prefer autotools build system, and not fully understand nsis... But you can probably define this to different values if compiling using MSC or MinGW, right? Or in source: #ifdef _MSC_VER #define _WIN32_IE <whatever> #else #define _WIN32_IE <whatever> #endif What do you prefer? ---------------------------------------------------------------------- Comment By: Amir Szekely (kichik) Date: 2010-02-20 17:31 Message: Thanks for the patch. I'm a bit afraid of the _WIN32_IE change. The resulting installer should work on Windows 95 and above. That kind of change might make that impossible. I am fully aware of all that stands behind and against this, but an obscure compiler compatibility is not a reason to drop it. Besides, it looks more of a bug in the headers as _WIN32_IE is supposed to modify their behavior. The header should not define it on its own. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=373085&aid=2949102&group_id=22049 |