Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide in readme doesnt work #468

Open
Jipok opened this issue Feb 4, 2024 · 6 comments
Open

Guide in readme doesnt work #468

Jipok opened this issue Feb 4, 2024 · 6 comments

Comments

@Jipok
Copy link

Jipok commented Feb 4, 2024

$ 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
Copy link
Member

pazos commented Feb 4, 2024

Yay, the README is outdated. We switched from ndk15c to ndk23c in 9f0853c

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

Thanks!

@Jipok
Copy link
Author

Jipok commented Feb 4, 2024

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

@Jipok
Copy link
Author

Jipok commented Feb 4, 2024

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
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
Copy link
Author

Jipok commented Feb 4, 2024

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
Copy link
Member

pazos commented Feb 5, 2024

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.

@pazos
Copy link
Member

pazos commented Nov 18, 2024

Indeed, guide is wrong. We shouldn't have building steps given it is an advanced topic to get something usable with the APK barebones.

Anyhow, to build the APK of the standalone example:

  1. export ANDROID_NDK_HOME
 export ANDROID_NDK_HOME=/path/to/your/ndk/folder
  1. Build for arm 32 bits
make example
  1. Build for arm 64 bits
ANDROID_ARCH=arm64 make example
  1. Build for x86
ANDROID_ARCH=x86 make example
  1. Build for x86_64
ANDROID_ARCH=x86_64 make example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants