Wohlstand / LuaJIT-Example-Android

Simplest example on how to run LuaJIT on android
MIT License
6 stars 0 forks source link

Problems with build on Windows #1

Open Antokolos opened 1 year ago

Antokolos commented 1 year ago

Hello! Couple days ago I installed Android SDK command line tools from here: https://developer.android.com/studio#command-tools Then I cloned the repository and launched the build via gradlew build command Build failed with the following error

[2/77] Generating buildvm_arch.h
  FAILED: src/buildvm_arch.h
  cmd.exe /C "cd /D C:\work\Android\LuaJIT-Example-Android\app\.cxx\cmake\debug\armeabi-v7a\external\luajit\src\LuaJIT_local-build\src && C:\work\Android\LuaJIT-Example-Android\app\.cxx\cmake\debug\armeabi-v7a\external\luajit\src\LuaJIT_local-build\src\minilua\minilua.exe C:/work/Android/LuaJIT-Example-Android/libs/luajit/src/../dynasm/dynasm.lua -D FPU -D ENDIAN_LE -D FFI -D JIT -D DUALNUM -D VER= -o C:/work/Android/LuaJIT-Example-Android/app/.cxx/cmake/debug/armeabi-v7a/external/luajit/src/LuaJIT_local-build/src/buildvm_arch.h C:/work/Android/LuaJIT-Example-Android/libs/luajit/src/vm_arm.dasc"
  'C:\work\Android\LuaJIT-Example-Android\app\.cxx\cmake\debug\armeabi-v7a\external\luajit\src\LuaJIT_local-build\src\minilua\minilua.exe' is not recognized as an internal or external command,
  operable program or batch file.
  ninja: build stopped: subcommand failed.
  ninja: build stopped: subcommand failed.

the reason of the error is the following: minilua.exe is located in folder C:\work\Android\LuaJIT-Example-Android\app.cxx\cmake\debug\armeabi-v7a\external\luajit\src\LuaJIT_local-build\src\minilua\ Debug \minilua.exe If the following patch will be applied:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 16b41fbf..fe98e41d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,7 +24,7 @@ set(MINILUA_EXE minilua)
 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
   set(MINILUA_EXE minilua.exe)
 endif()
-set(MINILUA_PATH ${CMAKE_CURRENT_BINARY_DIR}/minilua/${MINILUA_EXE})
+set(MINILUA_PATH ${CMAKE_CURRENT_BINARY_DIR}/minilua/Debug/${MINILUA_EXE})

 # Build the minilua for host platform
 if (NOT CMAKE_CROSSCOMPILING)

Then the build will fail with the following error:

MSBuild version 17.3.0+f67e3d35e for .NET Framework
    Checking Build System
    Building Custom Rule C:/work/Android/LuaJIT-Example-Android/libs/luajit/src/host/cmake/buildvm/CMakeLists.txt
  cl : command line  warning D9002: ignoring unknown option '-m32' [C:\work\Android\LuaJIT-Example-Android\app\.cxx\cmake\debug\armeabi-v7a\external\luajit\src\LuaJIT_local-build\src\buildvm\buildvm.vcxproj]
    buildvm.c
  C:\work\Android\LuaJIT-Example-Android\libs\luajit\src\lj_ircall.h(368,1): fatal  error C1189: #error:  "Missing fp64 helper definitions for this compiler" [C:\work\Android\LuaJIT-Example-Android\app\.cxx\cmake\debug\armeabi-v7a\external\luajit\src\LuaJIT_local-build\src\buildvm\buildvm.vcxproj]
Antokolos commented 1 year ago

P.S.: buildvm.exe also goes to Debug folder, so the following correction is necessary too: set(BUILDVM_PATH ${CMAKE_CURRENT_BINARY_DIR}/buildvm/Debug/${BUILDVM_EXE})

Wohlstand commented 1 year ago

You will need to install MinGW-w64 separately and ensure it will be in the PATH environment. LuaJIT requires the host compiler to run certain utilities on the host to generate the data to embed into the final library build.

P.S. Speaking about MSVC's paths, there is a small tweak needed to avoid MSVC to put libraries into these directories at all. I'll try to apply some.

AlexandrKozlovskiy commented 1 year ago

@Wohlstand Ok,we hope,what you will adapt luajit for msvc. Also why we can't add luajit as subdirectory,because usual lua we can add in android as subdirectory to android project.

Wohlstand commented 1 year ago

I'll try to debug it once I will boot my second Windows machine.

AlexandrKozlovskiy commented 1 year ago

@Wohlstand Whether you commit a new version of luajit,which will do compiling of luajit mor easier?