Closed charleshan closed 3 weeks ago
Not entirely unexpected, but this is not an issue specific to macOS Docker. But thanks for specifying; that could've made for some really hard troubleshooting if it were. :-)
Slightly unrelated, but running an emulated x86_64 Linux system doesn't seem very apropos except for building Linux AppImages from macOS? For the emulator you can simply do native Mac builds. For cross-compilation a Docker image could be preferable, but then we're talking about the specific Kobo/Kindle/etc. images.
Yep, I wasn't sure if it's Mac specific issue but I included the information anyway. Thanks for updating the title.
I was just looking to set up an isolated dev environment. My goal is to build for android. It seems like I have to use homebrew?
Okay... going the homebrew route but came across anther error.
/koreader/base/build/arm64-apple-darwin23.5.0-debug/cmake/koenv.sh: line 58: MESON-NOTFOUND: command not found
brew install meson
Already installed meson. ./kodev clean
was necessary 😅
Wait, that's not normal.
It should have errored out earlier:
-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.46.0")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:91 (find_program):
Could not find MESON using the following names: meson
Call Stack (most recent call first):
CMakeLists.txt:110 (find_executable)
What is the exact koreader version you're trying to build?
I got that error from the latest and v2024.07 (latest stable)
No, v2024.07 did not yet use meson. What's the output of git describe --tag
?
Yeah I saw the commit 3 days ago that added pip install meson
. I didn't verify if meson was used before this but this is why I switched to another branch.
(base) ~/Documents/Github/koreader$ git describe --tag
v2024.07
Ahhhh I just need to add one line and build. I found a workaround to use native android keyboard (https://github.com/koreader/koreader/issues/7423) using the Automator app. I just need KOReader to copy to clipboard automatically when "Edit Note" is open.
Another error 😭
(base) ~/Documents/Github/koreader$ ./kodev release android -v
git submodule update --remote l10n
make -C base/toolchain /Users/charleshan/Documents/Github/koreader/base/toolchain/android-sdk-linux
make[1]: Entering directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
make[1]: '/Users/charleshan/Documents/Github/koreader/base/toolchain/android-sdk-linux' is up to date.
make[1]: Leaving directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
make -C base/toolchain /Users/charleshan/Documents/Github/koreader/base/toolchain/android-ndk-r23c
make[1]: Entering directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
make[1]: '/Users/charleshan/Documents/Github/koreader/base/toolchain/android-ndk-r23c' is up to date.
make[1]: Leaving directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
/Users/charleshan/Documents/Github/koreader/base/toolchain/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi18-clang: line 3: /Users/charleshan/Documents/Github/koreader/base/toolchain/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: cannot execute binary file
/Users/charleshan/Documents/Github/koreader/base/toolchain/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi18-clang: line 3: /Users/charleshan/Documents/Github/koreader/base/toolchain/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: cannot execute binary file
base/Makefile.defs:437: *** failed to retrieve target machine. Stop.
Are all the outputs in your previous comment when using v2024.07
?
I would start from a pristine state, on current master.
Pardon, it's https://github.com/koreader/koreader/issues/12294#issuecomment-2268726915 that's generic (or something very much like it); I overlooked that the OP showed an older checkout.
As for the error, I'm not surprised. Trying to cross-compile for android on macOS… Let me check a few things, but it's not going to work out of the box.
Trying to cross-compile for android on macOS…
Used to work. ;-) But to be clear I was talking about with the steps in the OP, not new steps.
Even with the old steps, I don't see how, not since the NDK bump?
That would be the most obvious candidate for the moment it broke, yes.
2 possible paths:
Makefile.defs
will need patching. If you can provide the necessary information, we can update the build system.That would be the most obvious candidate for the moment it broke, yes.
Yeah, with NDK 23c, the toolchain binary path contain the build host machine…
Just FYI, my first attempt was using Docker in the first comment using current master.
Makefile.defs will need patching. If you can provide the necessary information, we can update the build system
What information do you need?
But you were using the wrong image for building an Android version.
What information do you need?
Once installed, in which sub-directory of the NDK is the toolchain available? (Probably under toolchains/llvm/prebuilt
)
But you were using the wrong image for building an Android version.
To be clear I was talking about following the OP instructions on a clean checkout of current master. No Android distractions of any sort. :-) The only confusion is that I had assumed OP was also on current master so I didn't notice the actual error was slightly different.
What information do you need?
Once installed, in which sub-directory of the NDK is the toolchain available? (Probably under
toolchains/llvm/prebuilt
)/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64
OK, so using the current master (v2024.07-60-gf22e8bbbc2
):
make fetchthirdparty
git -C base fetch https://github.com/benoit-pierre/koreader-base.git pr/macos_android
and git -C base checkout FETCH_HEAD
ANDROID_NDK_HOME=/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313 ANDROID_HOME=/Users/charleshan/Library/Android/sdk/platforms/android-28 ./kodev release android
You mean git -C base fetch https://github.com/benoit-pierre/koreader-base.git pr/macos_android
right?
I see different errors now:
(base) ~/Documents/Github/koreader$ ANDROID_NDK_HOME=/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313 ANDROID_HOME=/Users/charleshan/Library/Android/sdk/platforms/android-28 ./kodev release android -v
git submodule update --remote l10n
make -C base/toolchain /Users/charleshan/Library/Android/sdk/platforms/android-28
make[1]: Entering directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
make[1]: Nothing to be done for '/Users/charleshan/Library/Android/sdk/platforms/android-28'.
make[1]: Leaving directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
make -C base/toolchain /Users/charleshan/Library/Android/sdk/ndk/23.2.8568313
make[1]: Entering directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
make[1]: Nothing to be done for '/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313'.
make[1]: Leaving directory '/Users/charleshan/Documents/Github/koreader/base/toolchain'
************ Building for MACHINE: "armv7a-unknown-linux-android18" **********
************ PATH: "/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/bin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/util-linux/bin:/Users/charleshan/.local/bin:/opt/homebrew/opt/openssl@1.1/bin:/Users/charleshan/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin:/opt/homebrew/sbin" **********
************ CHOST: "armv7a-linux-androideabi18" **********
************ NINJA: ninja -j8 -l8 **********
************ MAKE: make -j8 -l8 **********
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE='/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/toolchain.cmake' -DCMAKE_KOVARS='/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koreader_vars.cmake' -S base/cmake -B base/build/armv7a-unknown-linux-android18/cmake
Re-run cmake no build system arguments
-- Configuring done (0.1s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake
cd base/build/armv7a-unknown-linux-android18/cmake && ninja -v -j8 -l8 all
▸ 0% | cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib && : "" && set -- zlib "Downloading 'zlib'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib/stamp/download /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib/log/download && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run download_archive /Users/charleshan/Documents/Github/koreader/base/thirdparty/zlib/build/downloads/zlib-1.3.1.tar.xz 5e6af153311327e516690d300527ec9e https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.xz
FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib/stamp/download
cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib && : "" && set -- zlib "Downloading 'zlib'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib/stamp/download /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/zlib/log/download && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run download_archive /Users/charleshan/Documents/Github/koreader/base/thirdparty/zlib/build/downloads/zlib-1.3.1.tar.xz 5e6af153311327e516690d300527ec9e https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.xz
+printf: illegal format character q
▸ 0% | cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng && : "" && set -- libpng "Downloading 'libpng'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng/stamp/download /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng/log/download && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run download_archive /Users/charleshan/Documents/Github/koreader/base/thirdparty/libpng/build/downloads/v1.6.43.tar.gz dabdabca28f211feeba199d93235c703 https://github.com/pnggroup/libpng/archive/refs/tags/v1.6.43.tar.gz
FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng/stamp/download
cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng && : "" && set -- libpng "Downloading 'libpng'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng/stamp/download /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/libpng/log/download && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run download_archive /Users/charleshan/Documents/Github/koreader/base/thirdparty/libpng/build/downloads/v1.6.43.tar.gz dabdabca28f211feeba199d93235c703 https://github.com/pnggroup/libpng/archive/refs/tags/v1.6.43.tar.gz
+printf: illegal format character q
ninja: build stopped: subcommand failed.
make: *** [base/Makefile:89: base-all] Error 1
You mean
git -C base fetch https://github.com/benoit-pierre/koreader-base.git pr/macos_android
right?
Yep, please fetch, checkout, and try again.
You're probably going to hit issues building djvulibre and libunibreak. I've updated the branch again.
Some progress:
▸ 25% | cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi && : toolchain:254ed2e6a3f6866e229c000644c8ef8c && set -- fribidi "Configuring 'fribidi'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/log/configure && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run rm -rf /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run mkdir -p /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run /Users/charleshan/.asdf/shims/meson setup --native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini --cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini --auto-features=disabled --bindir= --libdir=lib --prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging --wrap-mode=nodownload --default-library=shared -Dbin=false -Ddocs=false -Dtests=false /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure
cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi && : toolchain:254ed2e6a3f6866e229c000644c8ef8c && set -- fribidi "Configuring 'fribidi'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/log/configure && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run rm -rf /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run mkdir -p /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run /Users/charleshan/.asdf/shims/meson setup --native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini --cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini --auto-features=disabled --bindir= --libdir=lib --prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging --wrap-mode=nodownload --default-library=shared -Dbin=false -Ddocs=false -Dtests=false /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
+ 'rm' '-rf' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ 'mkdir' '-p' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ 'cd' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ '/Users/charleshan/.asdf/shims/meson' 'setup' '--native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini' '--cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini' '--auto-features=disabled' '--bindir=' '--libdir=lib' '--prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging' '--wrap-mode=nodownload' '--default-library=shared' '-Dbin=false' '-Ddocs=false' '-Dtests=false' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source'
The Meson build system
Version: 1.5.1
Source dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
Build dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build
Build type: cross build
Project name: fribidi
Project version: 1.0.14
C compiler for the host machine: env armv7a-linux-androideabi18-clang (clang 12.0.9 "Android (8481493, based on r416183c2) clang version 12.0.9 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)")
C linker for the host machine: env armv7a-linux-androideabi18-clang ld.lld 12.0.9
Compiler for language c for the build machine not found.
Build machine cpu family: aarch64
Build machine cpu: aarch64
Host machine cpu family: arm
Host machine cpu: armv7-a
Target machine cpu family: arm
Target machine cpu: armv7-a
Checking for function "memmove" : YES
Checking for function "memset" : YES
Checking for function "strdup" : YES
Has header "stdlib.h" : YES
Has header "string.h" : YES
Has header "memory.h" : YES
Has header "strings.h" : YES
Has header "sys/times.h" : YES
Has header "strings.h" : YES (cached)
Configuring config.h using configuration
Has header "stdlib.h" : YES (cached)
Has header "string.h" : YES (cached)
Has header "strings.h" : YES (cached)
../source/gen.tab/meson.build:32:22: ERROR: No build machine compiler for 'gen.tab/gen-unicode-version.c'
Do you have a native toolchain installed (XCode)?
I have Xcode and ran xcode-select --install
yesterday
The clang / clang++ binaries from the NDK should be used, but since they are for x86_64, this may cause problems…
Meson may not like the fact that the native toolchain it's supposed to use does not produce binaries for the build machine architecture.
So what do you suggest?
Either try to override the default build tools, or maybe try building from a x86_64 sub-shell.
Let's try the second option first, start a sub-shell with arch -x86_64 bash -i
, and then:
cd base
export ANDROID_NDK_HOME=/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313
(you disregard the SDK for now, which is only used for building the APK)make TARGET=android clean
make TARGET=android fribidi
There's also the problem of luajit: you're building for ARM 32bits, there's a limitation of the luajit build system that means you need a native 32bits toolchain too for building the minilua executable that is used to generate the bytecode for the host machine. Can't use a 64bits native minilua to do it.
Do you think it'll be easier to attempt to fix building on docker instead?
bash-3.2$ export ANDROID_NDK_HOME=/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313
bash-3.2$ make TARGET=android clean
make[1]: Entering directory '/Users/charleshan/Documents/Github/koreader/platform/android/luajit-launcher'
Cleaning binaries, assets and LuaJIT build
rm -rf assets/module/ bin/ jni/luajit/build
cd jni/luajit && \
./mk-luajit.sh "armeabi-v7a" clean
Using NDKABI 18.
grep: invalid option -- P
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
make[1]: *** [Makefile:117: clean] Error 2
make[1]: Leaving directory '/Users/charleshan/Documents/Github/koreader/platform/android/luajit-launcher'
make: *** [Makefile:174: clean] Error 2
You running the commands from the wrong directory: do it in base directly.
Luajit-launcher will cause trouble too, I was expecting that, but once you can build base, we'll switch the main project to another branch to work around that issue.
▸ 60% | Configuring 'fribidi'
FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure
cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi && : toolchain:254ed2e6a3f6866e229c000644c8ef8c && set -- fribidi "Configuring 'fribidi'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/log/configure && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run rm -rf /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run mkdir -p /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run /Users/charleshan/.asdf/shims/meson setup --native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini --cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini --auto-features=disabled --bindir= --libdir=lib --prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging --wrap-mode=nodownload --default-library=shared -Dbin=false -Ddocs=false -Dtests=false /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
+ 'rm' '-rf' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ 'mkdir' '-p' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ 'cd' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ '/Users/charleshan/.asdf/shims/meson' 'setup' '--native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini' '--cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini' '--auto-features=disabled' '--bindir=' '--libdir=lib' '--prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging' '--wrap-mode=nodownload' '--default-library=shared' '-Dbin=false' '-Ddocs=false' '-Dtests=false' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source'
The Meson build system
Version: 1.5.1
Source dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
Build dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build
Build type: cross build
Project name: fribidi
Project version: 1.0.14
C compiler for the host machine: env armv7a-linux-androideabi18-clang (clang 12.0.9 "Android (8481493, based on r416183c2) clang version 12.0.9 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)")
C linker for the host machine: env armv7a-linux-androideabi18-clang ld.lld 12.0.9
Compiler for language c for the build machine not found.
Build machine cpu family: aarch64
Build machine cpu: aarch64
Host machine cpu family: arm
Host machine cpu: armv7-a
Target machine cpu family: arm
Target machine cpu: armv7-a
Checking for function "memmove" : YES
Checking for function "memset" : YES
Checking for function "strdup" : YES
Has header "stdlib.h" : YES
Has header "string.h" : YES
Has header "memory.h" : YES
Has header "strings.h" : YES
Has header "sys/times.h" : YES
Has header "strings.h" : YES (cached)
Configuring config.h using configuration
Has header "stdlib.h" : YES (cached)
Has header "string.h" : YES (cached)
Has header "strings.h" : YES (cached)
../source/gen.tab/meson.build:32:22: ERROR: No build machine compiler for 'gen.tab/gen-unicode-version.c'
That was run from the sub-shell? Because meson still think the build machine is arm64 (Build machine cpu family: aarch64
).
OK… Close the sub-shell, let's try changing the host compilers then (still from the base directory):
command -v clang
return the path of the XCode provided binarycd base
export ANDROID_NDK_HOME=/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313
(you disregard the SDK for now, which is only used for building the APK)make TARGET=android clean
make TARGET=android HOSTCC="$(command -v clang)" HOSTCXX="$(command -v clang++)" fribidi
Yes it was run from the sub-shell.
(base) ~/Documents/Github/koreader$ arch -x86_64 bash -i
bash-3.2$ cd base/
bash-3.2$ export ANDROID_NDK_HOME=/Users/charleshan/Library/Android/sdk/ndk/23.2.8568313
bash-3.2$ make TARGET=android clean
bash-3.2$ make TARGET=android fribidi
How do I make sure make sure command -v clang
return the path of the XCode provided binary?
(base) ~/Documents/Github/koreader$ command -v clang
/usr/bin/clang
(base) ~/Documents/Github/koreader$ command -v clang++
/usr/bin/clang++
Error after running make TARGET=android HOSTCC="$(command -v clang)" HOSTCXX="$(command -v clang++)" fribidi
▸ 60% | Configuring 'fribidi'
FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure
cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi && : toolchain:254ed2e6a3f6866e229c000644c8ef8c && set -- fribidi "Configuring 'fribidi'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/log/configure && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run rm -rf /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run mkdir -p /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run /Users/charleshan/.asdf/shims/meson setup --native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini --cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini --auto-features=disabled --bindir= --libdir=lib --prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging --wrap-mode=nodownload --default-library=shared -Dbin=false -Ddocs=false -Dtests=false /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
+ 'rm' '-rf' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ 'mkdir' '-p' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ 'cd' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build'
+ '/Users/charleshan/.asdf/shims/meson' 'setup' '--native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini' '--cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini' '--auto-features=disabled' '--bindir=' '--libdir=lib' '--prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging' '--wrap-mode=nodownload' '--default-library=shared' '-Dbin=false' '-Ddocs=false' '-Dtests=false' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source'
The Meson build system
Version: 1.5.1
Source dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source
Build dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build
Build type: cross build
Project name: fribidi
Project version: 1.0.14
C compiler for the host machine: env armv7a-linux-androideabi18-clang (clang 12.0.9 "Android (8481493, based on r416183c2) clang version 12.0.9 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)")
C linker for the host machine: env armv7a-linux-androideabi18-clang ld.lld 12.0.9
C compiler for the build machine: env /usr/bin/clang (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")
C linker for the build machine: env /usr/bin/clang ld64 1053.12
../source/meson.build:1:0: ERROR: Unknown linker(s): [['strip']]
A full log can be found at /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build/meson-logs/meson-log.txt
ninja: build stopped: subcommand failed.
make: *** [Makefile:89: fribidi] Error 1
Back to my previous question: Do you think it'll be easier to attempt to fix building on docker instead?
How do I make sure make sure
command -v clang
return the path of the XCode provided binary?
The paths are not under $ANDROID_NDK_HOME
.
(base) ~/Documents/Github/koreader$ command -v clang /usr/bin/clang (base) ~/Documents/Github/koreader$ command -v clang++ /usr/bin/clang++
Looks fine.
Error after running
make TARGET=android HOSTCC="$(command -v clang)" HOSTCXX="$(command -v clang++)" fribidi
▸ 60% | Configuring 'fribidi' FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi && : toolchain:254ed2e6a3f6866e229c000644c8ef8c && set -- fribidi "Configuring 'fribidi'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/stamp/configure /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/log/configure && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run rm -rf /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run mkdir -p /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build && run /Users/charleshan/.asdf/shims/meson setup --native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini --cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini --auto-features=disabled --bindir= --libdir=lib --prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging --wrap-mode=nodownload --default-library=shared -Dbin=false -Ddocs=false -Dtests=false /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source + 'rm' '-rf' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build' + 'mkdir' '-p' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build' + 'cd' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build' + '/Users/charleshan/.asdf/shims/meson' 'setup' '--native-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_host_toolchain.ini' '--cross-file=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/meson_cross_toolchain.ini' '--auto-features=disabled' '--bindir=' '--libdir=lib' '--prefix=/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/staging' '--wrap-mode=nodownload' '--default-library=shared' '-Dbin=false' '-Ddocs=false' '-Dtests=false' '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source' The Meson build system Version: 1.5.1 Source dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/source Build dir: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build Build type: cross build Project name: fribidi Project version: 1.0.14 C compiler for the host machine: env armv7a-linux-androideabi18-clang (clang 12.0.9 "Android (8481493, based on r416183c2) clang version 12.0.9 (https://android.googlesource.com/toolchain/llvm-project c935d99d7cf2016289302412d708641d52d2f7ee)") C linker for the host machine: env armv7a-linux-androideabi18-clang ld.lld 12.0.9 C compiler for the build machine: env /usr/bin/clang (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)") C linker for the build machine: env /usr/bin/clang ld64 1053.12 ../source/meson.build:1:0: ERROR: Unknown linker(s): [['strip']]
WTF…
A full log can be found at /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/fribidi/build/meson-logs/meson-log.txt ninja: build stopped: subcommand failed. make: *** [Makefile:89: fribidi] Error 1
Back to my previous question: Do you think it'll be easier to attempt to fix building on docker instead?
Yes, let's do that, but before, out of curiosity, are you able to build luajit with: make TARGET=android HOSTCC="$(command -v clang)" HOSTCXX="$(command -v clang++)" luajit
?
(base) ~/Documents/Github/koreader/base$ make TARGET=android HOSTCC="$(command -v clang)" HOSTCXX="$(command -v clang++)" luajit
▸ 0% | Building 'luajit'
make[1]: Entering directory '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/source'
==== Building LuaJIT 2.1 (amalgamation) ====
make -C src amalg
make[2]: Entering directory '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/source/src'
make[2]: armv7a-linux-androideabi18-/usr/bin/clang: No such file or directory
Makefile:271: *** Unsupported target architecture. Stop.
make[2]: Leaving directory '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/source/src'
make[1]: *** [Makefile:166: amalg] Error 2
make[1]: Leaving directory '/Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/source'
FAILED: /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/stamp/build
cd /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/source && : "" && set -- luajit "Building 'luajit'" 0 /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/stamp/build && . /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/koenv.sh && run make "CROSS= armv7a-linux-androideabi18-" CC=/usr/bin/clang "CFLAGS=-O2 -ffast-math -pipe -fomit-frame-pointer -DNDEBUG -ffile-prefix-map=/Users/charleshan/Documents/Github/koreader/base/=" LDFLAGS= "HOST_CC= /usr/bin/clang -m32" "HOST_CFLAGS=-mcpu=apple-m1 -O2 -ffast-math -pipe -fomit-frame-pointer -DNDEBUG -ffile-prefix-map=/Users/charleshan/Documents/Github/koreader/base/= -Wno-ignored-optimization-argument -Wno-unknown-warning-option -Wno-array-bounds -Wno-unused-command-line-argument -Wno-self-assign -Wno-parentheses-equality -Wno-macro-redefined" HOST_LDFLAGS= "TARGET_AR=llvm-ar rcus" "TARGET_CFLAGS=-O2 -ffast-math -pipe -fomit-frame-pointer -DNDEBUG -ffile-prefix-map=/Users/charleshan/Documents/Github/koreader/base/= -Wno-ignored-optimization-argument -Wno-unknown-warning-option -Wno-array-bounds -Wno-unused-command-line-argument -Wno-self-assign -Wno-parentheses-equality -Wno-macro-redefined -march=armv7-a -mfpu=vfpv3-d16 -mthumb -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -mfloat-abi=softfp -fPIC -DLUAJIT_SECURITY_STRHASH=0 -DLUAJIT_SECURITY_STRID=0" "TARGET_LDFLAGS=-Wl,-O1 -Wl,--as-needed -Wl,@/Users/charleshan/Documents/Github/koreader/base/origin.ldflags -no-canonical-prefixes -Wl,--fix-cortex-a8 -march=armv7-a /Users/charleshan/Library/Android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/12.0.9/lib/linux/libclang_rt.builtins-arm-android.a -Wl,--build-id=none" TARGET_RANLIB=llvm-ranlib "TARGET_SHLDFLAGS=-Wl,-O1 -Wl,--as-needed -Wl,@/Users/charleshan/Documents/Github/koreader/base/origin.ldflags -no-canonical-prefixes -Wl,--fix-cortex-a8 -march=armv7-a /Users/charleshan/Library/Android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/12.0.9/lib/linux/libclang_rt.builtins-arm-android.a -Wl,--build-id=none" TARGET_SYS=Linux "TARGET_STRIP=llvm-strip --strip-unneeded" TARGET_SONAME=libluajit.so INSTALL_SONAME=libluajit.so amalg && /opt/homebrew/Cellar/cmake/3.30.2/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /Users/charleshan/Documents/Github/koreader/base/cmake /Users/charleshan/Documents/Github/koreader/base/thirdparty/luajit /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/thirdparty/luajit/build.d /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake/CMakeFiles/d/fa031128dbb630131055ea06e463ce8b6130b13b29f0029ad56d393a1d3e22da.d
ninja: build stopped: subcommand failed.
make: *** [Makefile:89: luajit] Error 1
Right, had forgotten about that other potential problem… sigh Crappy build systems everywhere.
Try docker, with the koandroid
image.
I'm guessing that you mean I should use koandroid
instead of koappimage
right?
(base) ~/Documents/Github$ docker run -v $(pwd)/koreader:/home/ko/koreader -it koreader/koandroid:latest bash
Unable to find image 'koreader/koandroid:latest' locally
docker: Error response from daemon: manifest for koreader/koandroid:latest not found: manifest unknown: manifest unknown.
See 'docker run --help'.
I see koreader/koandroid
in Docker Hub. Am I missing something?
Use koreader/koandroid:0.8.2-20.04
.
Built Docker container with a warning.
(base) ~/Documents/Github$ docker run -v $(pwd)/koreader:/home/ko/koreader -it koreader/koandroid:0.8.2-20.04 bash
Unable to find image 'koreader/koandroid:0.8.2-20.04' locally
0.8.2-20.04: Pulling from koreader/koandroid
55077ec45fd6: Pull complete
4f4fb700ef54: Pull complete
895f9133dc71: Pull complete
Digest: sha256:6e55f0cede76ff85a1324835dad3b3f3d4fa176d089c4ec439d45a9231464b22
Status: Downloaded newer image for koreader/koandroid:0.8.2-20.04
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
ko@8925754d7d11:~$ cd koreader && ./kodev fetch-thirdparty
fatal: detected dubious ownership in repository at '/home/ko/koreader'
To add an exception for this directory, call:
git config --global --add safe.directory /home/ko/koreader
bash: g++: command not found
/usr/local/bin/luajit: cannot create state: not enough memory
fatal: detected dubious ownership in repository at '/home/ko/koreader'
To add an exception for this directory, call:
git config --global --add safe.directory /home/ko/koreader
fatal: detected dubious ownership in repository at '/home/ko/koreader'
To add an exception for this directory, call:
git config --global --add safe.directory /home/ko/koreader
fatal: detected dubious ownership in repository at '/home/ko/koreader'
To add an exception for this directory, call:
git config --global --add safe.directory /home/ko/koreader
make: *** [Makefile:156: fetchthirdparty] Error 128
ko@8925754d7d11:~/koreader$ git config --global --add safe.directory /home/ko/koreader
ko@8925754d7d11:~/koreader$ ./kodev fetch-thirdparty
bash: g++: command not found
/usr/local/bin/luajit: cannot create state: not enough memory
Synchronizing submodule url for 'base'
Synchronizing submodule url for 'l10n'
Synchronizing submodule url for 'platform/android/luajit-launcher'
Synchronizing submodule url for 'platform/ubuntu-touch/ubuntu-touch-sdl'
Synchronizing submodule url for 'resources/fonts'
Synchronizing submodule url for 'test'
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: Enumerating objects: 262, done.
remote: Counting objects: 100% (262/262), done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 106 (delta 52), reused 61 (delta 8), pack-reused 0
Receiving objects: 100% (106/106), 1.52 MiB | 3.56 MiB/s, done.
Resolving deltas: 100% (52/52), completed with 30 local objects.
From https://github.com/koreader/koreader-translations
* branch 7bddf3c87472b152b18d0f7bbc04b43b9e4d0dd1 -> FETCH_HEAD
Submodule path 'l10n': checked out '7bddf3c87472b152b18d0f7bbc04b43b9e4d0dd1'
bash: g++: command not found
/usr/local/bin/luajit: cannot create state: not enough memory
Synchronizing submodule url for 'luafilesystem'
Synchronizing submodule url for 'thirdparty/kpvcrlib/crengine'
ko@8925754d7d11:~/koreader$ ./kodev release android
bash: g++: command not found
/usr/local/bin/luajit: cannot create state: not enough memory
Submodule path 'l10n': checked out 'adf35ce50d407619194c7588aa81aae6114350b9'
bash: g++: command not found
/usr/local/bin/luajit: cannot create state: not enough memory
bash: g++: command not found
/usr/local/bin/luajit: cannot create state: not enough memory
/usr/local/bin/luajit: cannot create state: not enough memory
************ Building for MACHINE: "armv7a-unknown-linux-android18" **********
************ PATH: "/opt/android-ndk-r23c/toolchains/llvm/prebuilt/linux-x86_64/bin:/opt/android-ndk-r23c:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/build-tools/30.0.2:/home/ko/.local/bin:/usr/local/x-tools/*/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" **********
************ CHOST: "armv7a-linux-androideabi18" **********
************ NINJA: ninja -j8 -l8 **********
************ MAKE: make -j8 -l8 **********
CMake Error: The current CMakeCache.txt directory /home/ko/koreader/base/build/armv7a-unknown-linux-android18/cmake/CMakeCache.txt is different than the directory /Users/charleshan/Documents/Github/koreader/base/build/armv7a-unknown-linux-android18/cmake where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "/home/ko/koreader/base/cmake/CMakeLists.txt" does not match the source "/Users/charleshan/Documents/Github/koreader/base/cmake/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.
make: *** [base/Makefile:70: base/build/armv7a-unknown-linux-android18/cmake/build.ninja] Error 1
Clean before attempting (./kodev clean android
).
How's docker support on macOS?
I followed the instructions in the doc:
After successfully creating a docker container, when I try to build, I get the following error: