LuaDist / Repository

Repository of LuaDist modules available for installation using the luadist-git command line tool
www.luadist.org
243 stars 41 forks source link

luajit build failing on windows 7 32 bit tdm... though working without luadist #211

Open joshua-scholar opened 9 years ago

joshua-scholar commented 9 years ago

I'm new to luadist so I don't know how to do basic things... I can build luajit just fine from the source but when I do it from luadist install libjit I get an error.

C:\luadist_bootstrap_install\bin>luadist C:\my_lua install luajit Downloading repository information... Finding out available versions of luajit... Getting luajit-2.0.3 (source)... Building luajit-2.0.3... Error building with CMake in directory 'C:\my_lua\tmp\luajit-2.0.3-CMake-build'

I made the guess that I could get a more useful error message by going to the build directory and running make thus:

C:\luadist_bootstrap_install\bin>cd C:\my_lua\tmp\luajit-2.0.3-CMake-build

C:\my_lua\tmp\luajit-2.0.3-CMake-build>mingw32-make Built target minilua Built target buildvm Linking C shared library liblua.dll CMakeFiles\liblua.dir/objects.a(lj_clib.c.obj):lj_clib.c:(.text+0xc9): undefined reference to GetM duleHandleExA' CMakeFiles\liblua.dir/objects.a(lib_package_rel.c.obj):lib_package_rel.c:(.text+0xb75): undefined r ference toGetModuleHandleExA' collect2.exe: error: ld returned 1 exit status CMakeFiles\liblua.dir\build.make:1724: recipe for target 'liblua.dll' failed mingw32-make[2]: * [liblua.dll] Error 1 CMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/liblua.dir/all' failed mingw32-make[1]: * [CMakeFiles/liblua.dir/all] Error 2 Makefile:136: recipe for target 'all' failed mingw32-make: *\ [all] Error 2

Doing a diff between the source files directly from the luajit site that built properly and the ones luadist pulled doesn't find a difference, so I guess there is one it has to be in build flags.

I wish I knew enough to do simple things like just substitute my successful build in and tell the luadist to use it.

joshua-scholar commented 9 years ago

I don't know much about cmake... It occurs to me that another possible difference other than build flags could be if cmake chose to use one of my microsoft compilers rather than use the mingw one that's in the path.

joshua-scholar commented 9 years ago

I've found a bit more information. Since GetModuleHandleEx doesn't exist in windows prior to WindowsXP mingw's winbase.h has been changed to not define it if _WIN32_WINNT < 0x0502 If I put the following lines in winbase I get an error:

if (_WIN32_WINNT<0x0502)

error windows version _WIN32_WINNT is less than 0x0502

endif

Scanning dependencies of target liblua [ 17%] Building C object CMakeFiles/liblua.dir/src/lj_gc.c.obj In file included from C:/TDM-GCC-32/include/windows.h:50:0, from C:\my_lua\tmp\luajit-2.0.3\src\lj_dispatch.h:119, from C:\my_lua\tmp\luajit-2.0.3\src\lj_trace.h:13, from C:\my_lua\tmp\luajit-2.0.3\src\lj_gc.c:26: C:/TDM-GCC-32/include/winbase.h:6:2: error: #error windows version _WIN32_WINNT is less than 0x0502

error windows version _WIN32_WINNT is less than 0x0502

^ CMakeFiles\liblua.dir\build.make:129: recipe for target 'CMakeFiles/liblua.dir/src/lj_gc.c.obj' fail ed mingw32-make[2]: * [CMakeFiles/liblua.dir/src/lj_gc.c.obj] Error 1 CMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/liblua.dir/all' failed mingw32-make[1]: * [CMakeFiles/liblua.dir/all] Error 2 Makefile:136: recipe for target 'all' failed mingw32-make: *\ [all] Error 2

joshua-scholar commented 9 years ago

The mingw32-make succeeds if I make the following changes (and I doubt this is the right way to patch so I'd appreciate some help).

Change flags.make in two directories C:\my_lua\tmp\luajit-2.0.3-CMake-build\CMakeFiles\wluajit.dir and C:\my_lua\tmp\luajit-2.0.3-CMake-build\CMakeFiles\liblua.dir

so that C_FLAGS now includes -D_WIN32_WINNT=0x0502

joshua-scholar commented 9 years ago

Sigh... I'm not sure how I did it, I got it working once. I ran the cmake-gui from the command line a few times, but didn't change anything.. Then ran it from the start menu and it had a list of settings for the current project. I change all of the C_FLAGS entries to have -D_WIN32_WINNT=0x0502 Then I generated Then I ran "luadist /my_lua install luajit" and it worked But what I find confusing now, is that if I run the cmake gui again, it comes up blank.

joshua-scholar commented 9 years ago

Note it was uhm only the C compiler entries I changed not the assembler ones, and they only came up after I selected "advanced"