koreader / android-luajit-launcher

Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
MIT License
131 stars 84 forks source link

Guide in readme doesnt work #468

Open Jipok opened 8 months ago

Jipok commented 8 months ago
$ make prepare
Updating sources
git submodule init
git submodule sync
Synchronizing submodule url for 'jni/luajit/luajit'
Synchronizing submodule url for 'jni/lzma/7z'
git submodule update
using sdk in path ~/dev/android-luajit-launcher/cmdline-tools
using ndk in path ~/dev/android-luajit-launcher/android-ndk-r15c/
Building LuaJIT for all supported ABIs
cd jni/luajit &&  \
    ./mk-luajit.sh clean && \
    ./mk-luajit.sh x86 && \
    ./mk-luajit.sh clean && \
    ./mk-luajit.sh armeabi-v7a
Using NDKABI .
Detected NDK version 15...
Using NDKABI .
Detected NDK version 15...
make -C ~/dev/android-luajit-launcher/jni/luajit/build/x86 amalg install HOST_LDFLAGS= DESTDIR=~/dev/android-luajit-launcher/jni/luajit/build/x86 PREFIX= TARGET_LDFLAGS= TARGET_CFLAGS=-O2\ -pipe TARGET_AR=llvm-ar\ rcus LDFLAGS= TARGET_SYS=Linux INSTALL_SONAME=libluajit.so TARGET_FLAGS= TARGET_LIBS= HOST_CFLAGS=-O2\ -pipe\ -mtune=generic TARGET_SONAME=libluajit.so TARGET_RANLIB=llvm-ranlib TARGET_STRIP=llvm-strip CC=clang CFLAGS=-O2\ -pipe HOST_CC=\ clang\ -m32 CROSS=\ i686-linux-android18-
make[1]: Entering directory '~/dev/android-luajit-launcher/jni/luajit/build/x86'
==== Building LuaJIT 2.1 (amalgamation) ====
make -C src amalg
make[2]: Entering directory '~/dev/android-luajit-launcher/jni/luajit/build/x86/src'
make[2]: i686-linux-android18-clang: No such file or directory
Makefile:271: *** Unsupported target architecture.  Stop.
make[2]: Leaving directory '~/dev/android-luajit-launcher/jni/luajit/build/x86/src'
make[1]: *** [Makefile:165: amalg] Error 2
make[1]: Leaving directory '~/dev/android-luajit-launcher/jni/luajit/build/x86'
make: *** [Makefile:74: prepare] Error 2
pazos commented 8 months ago

Yay, the README is outdated. We switched from ndk15c to ndk23c in https://github.com/koreader/android-luajit-launcher/commit/9f0853c652da2f00db783d05dd71dac56e93f61d

Please try again with that and tell me if the issue is fixed, so I can update the instructions.

Thanks!

Jipok commented 8 months ago

UPD: Removed log. My fault. Fixed error via installing glibc-devel-32bit

Jipok commented 8 months ago

Instructions for installing NDK would also be useful. Not all people want to set up a studio for this, and it’s hard to find information on how to do without studio. I searched for a long time how, but now I know a simple way: 1) Download https://developer.android.com/studio#command-line-tools-only 2) Unpack && cd 3)

export JAVA_HOME=/usr/lib/jvm/openjdk17/  # If default java is not 17
./bin/sdkmanager --sdk_root=$pwd "ndk;23.2.8568313"
./bin/sdkmanager --sdk_root=$pwd "platforms;android-28"
Jipok commented 8 months ago

Now have:

Updating sources
git submodule init
git submodule sync
Synchronizing submodule url for 'jni/luajit/luajit'
Synchronizing submodule url for 'jni/lzma/7z'
git submodule update
using sdk in path ~/dev/android-luajit-launcher/cmdline-tools/platforms/android-28/
using ndk in path ~/dev/android-luajit-launcher/cmdline-tools/ndk/23.2.8568313/
Building LuaJIT for all supported ABIs
cd jni/luajit &&  \
    ./mk-luajit.sh clean && \
    ./mk-luajit.sh x86 && \
    ./mk-luajit.sh clean && \
    ./mk-luajit.sh armeabi-v7a
Using NDKABI .
Detected NDK version 23...
Using NDKABI .
Detected NDK version 23...
make -C ~/dev/android-luajit-launcher/jni/luajit/build/x86 amalg install HOST_LDFLAGS= DESTDIR=~/dev/android-luajit-launcher/jni/luajit/build/x86 PREFIX= TARGET_LDFLAGS= TARGET_CFLAGS=-O2\ -pipe TARGET_AR=llvm-ar\ rcus LDFLAGS= TARGET_SYS=Linux INSTALL_SONAME=libluajit.so TARGET_FLAGS= TARGET_LIBS= HOST_CFLAGS=-O2\ -pipe\ -mtune=generic TARGET_SONAME=libluajit.so TARGET_RANLIB=llvm-ranlib TARGET_STRIP=llvm-strip CC=clang CFLAGS=-O2\ -pipe HOST_CC=\ clang\ -m32 CROSS=\ i686-linux-android18-
make[1]: Entering directory '~/dev/android-luajit-launcher/jni/luajit/build/x86'
==== Building LuaJIT 2.1 (amalgamation) ====
make -C src amalg
make[2]: Entering directory '~/dev/android-luajit-launcher/jni/luajit/build/x86/src'
make all "LJCORE_O=ljamalg.o"
make[3]: Entering directory '~/dev/android-luajit-launcher/jni/luajit/build/x86/src'
HOSTLINK  host/minilua
/usr/bin/x86_64-unknown-linux-gnu-ld:~/dev/android-luajit-launcher/cmdline-tools/ndk/23.2.8568313//toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/crtbegin.o: file format not recognized; treating as linker script
/usr/bin/x86_64-unknown-linux-gnu-ld:~/dev/android-luajit-launcher/cmdline-tools/ndk/23.2.8568313//toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/crtbegin.o:1: syntax error
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [Makefile:656: host/minilua] Error 1
make[3]: Leaving directory '~/dev/android-luajit-launcher/jni/luajit/build/x86/src'
make[2]: *** [Makefile:625: amalg] Error 2
make[2]: Leaving directory '~/dev/android-luajit-launcher/jni/luajit/build/x86/src'
make[1]: *** [Makefile:165: amalg] Error 2
make[1]: Leaving directory '~/dev/android-luajit-launcher/jni/luajit/build/x86'
make: *** [Makefile:74: prepare] Error 2
pazos commented 8 months ago

Now have [...]

Thanks for the feedback. I will look at it when I have some time :)

Instructions for installing NDK would also be useful. Not all people want to set up a studio for this, and it’s hard to find information on how to do without studio.

The kind of people that would be able to benefit from this repo for something else than building KOReader for android shouldn't have any problems.

Support for the standalone thing, this repo, isn't a priority. I added an example app a while ago and made a few makefile "shortcuts", but to be able to do something useful with the app, as is, one should be confortable enough to draw to a canvas in LuaJIT or with a lua c module.

AFAIK there's no single project that uses this repo beyond KOReader. And KOReader pulls the SDK and NDK automatically.

tl;dr: There's no excuse to have a Readme / Makefile that doesn't produce the "hello, world" example APK. So it will be fixed eventually.