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

Android versions 4.2 supported? - finding header files #179

Open
MarcWeber opened this issue Jan 26, 2025 · 1 comment
Open

Android versions 4.2 supported? - finding header files #179

MarcWeber opened this issue Jan 26, 2025 · 1 comment

Comments

@MarcWeber
Copy link

Trying to compile an app for an old tablet (odys iron) android 4.2 or such. I ended up with the following error messages.
So TRS_24 has android-activity as dependency and I feel like having to specify header locations but don't know exactly how.
Does Android-activity has a list of Android versions known to work ? I don't know exactly where to start looking into details.

warning: `/Users/marcweber/mw-repos/TRS_24/example/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
   Compiling imgui-sys v0.12.0
   Compiling freetype-sys v0.19.0
   Compiling android-activity v0.6.0
warning: [email protected]: In file included from game-activity-csrc/game-activity/GameActivity.cpp:17:
warning: [email protected]: game-activity-csrc/game-activity/GameActivity.h:30:10: fatal error: 'android/asset_manager.h' file not found
warning: [email protected]: #include <android/asset_manager.h>
warning: [email protected]:          ^
warning: [email protected]: 1 error generated.
warning: [email protected]: ToolExecError: Command LC_ALL="C" "arm-linux-androideabi-clang++" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "game-activity-csrc" "-Wall" "-o" "/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/android-activity-4d4e30ec147b3bf5/out/9cf9d0220cd7b5c3-GameActivity.o" "-c" "game-activity-csrc/game-activity/GameActivity.cpp" with args arm-linux-androideabi-clang++ did not execute successfully (status code exit status: 1).cargo:warning=In file included from game-activity-csrc/game-activity/GameActivityEvents.cpp:17:
warning: [email protected]: game-activity-csrc/game-activity/GameActivityEvents.h:29:10: fatal error: 'android/input.h' file not found
warning: [email protected]: #include <android/input.h>
warning: [email protected]:          ^
warning: [email protected]: 1 error generated.
warning: [email protected]: ToolExecError: Command LC_ALL="C" "arm-linux-androideabi-clang++" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "game-activity-csrc" "-Wall" "-o" "/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/android-activity-4d4e30ec147b3bf5/out/9cf9d0220cd7b5c3-GameActivityEvents.o" "-c" "game-activity-csrc/game-activity/GameActivityEvents.cpp" with args arm-linux-androideabi-clang++ did not execute successfully (status code exit status: 1).
error: failed to run custom build command for `android-activity v0.6.0`

Caused by:
  process didn't exit successfully: `/Users/marcweber/mw-repos/TRS_24/example/target/release/build/android-activity-10716154a2f35689/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=game-activity-csrc/game-activity/GameActivity.h
  cargo:rerun-if-changed=game-activity-csrc/game-activity/GameActivity.cpp
  cargo:rerun-if-changed=game-activity-csrc/game-activity/GameActivityEvents.h
  cargo:rerun-if-changed=game-activity-csrc/game-activity/GameActivityEvents.cpp
  cargo:rerun-if-changed=game-activity-csrc/game-activity/GameActivityLog.h
  OUT_DIR = Some(/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/android-activity-4d4e30ec147b3bf5/out)
  OPT_LEVEL = Some(3)
  TARGET = Some(armv7-linux-androideabi)
  HOST = Some(aarch64-apple-darwin)
  cargo:rerun-if-env-changed=CXX_armv7-linux-androideabi
  CXX_armv7-linux-androideabi = None
  cargo:rerun-if-env-changed=CXX_armv7_linux_androideabi
  CXX_armv7_linux_androideabi = None
  cargo:rerun-if-env-changed=TARGET_CXX
  TARGET_CXX = None
  cargo:rerun-if-env-changed=CXX
  CXX = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(false)
  cargo:rerun-if-env-changed=CXXFLAGS_armv7-linux-androideabi
  CXXFLAGS_armv7-linux-androideabi = None
  cargo:rerun-if-env-changed=CXXFLAGS_armv7_linux_androideabi
  CXXFLAGS_armv7_linux_androideabi = None
  cargo:rerun-if-env-changed=TARGET_CXXFLAGS
  TARGET_CXXFLAGS = None
  cargo:rerun-if-env-changed=CXXFLAGS
  CXXFLAGS = None
  CARGO_ENCODED_RUSTFLAGS = Some()
  cargo:warning=In file included from game-activity-csrc/game-activity/GameActivity.cpp:17:
  cargo:warning=game-activity-csrc/game-activity/GameActivity.h:30:10: fatal error: 'android/asset_manager.h' file not found
  cargo:warning=#include <android/asset_manager.h>
  cargo:warning=         ^
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=ToolExecError: Command LC_ALL="C" "arm-linux-androideabi-clang++" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "game-activity-csrc" "-Wall" "-o" "/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/android-activity-4d4e30ec147b3bf5/out/9cf9d0220cd7b5c3-GameActivity.o" "-c" "game-activity-csrc/game-activity/GameActivity.cpp" with args arm-linux-androideabi-clang++ did not execute successfully (status code exit status: 1).cargo:warning=In file included from game-activity-csrc/game-activity/GameActivityEvents.cpp:17:
  cargo:warning=game-activity-csrc/game-activity/GameActivityEvents.h:29:10: fatal error: 'android/input.h' file not found
  cargo:warning=#include <android/input.h>
  cargo:warning=         ^
  cargo:warning=1 error generated.

  exit status: 1
  cargo:warning=ToolExecError: Command LC_ALL="C" "arm-linux-androideabi-clang++" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "game-activity-csrc" "-Wall" "-o" "/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/android-activity-4d4e30ec147b3bf5/out/9cf9d0220cd7b5c3-GameActivityEvents.o" "-c" "game-activity-csrc/game-activity/GameActivityEvents.cpp" with args arm-linux-androideabi-clang++ did not execute successfully (status code exit status: 1).

  --- stderr


  error occurred in cc-rs: Command LC_ALL="C" "arm-linux-androideabi-clang++" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "game-activity-csrc" "-Wall" "-o" "/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/android-activity-4d4e30ec147b3bf5/out/9cf9d0220cd7b5c3-GameActivityEvents.o" "-c" "game-activity-csrc/game-activity/GameActivityEvents.cpp" with args arm-linux-androideabi-clang++ did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
warning: [email protected]: In file included from freetype2/src/autofit/autofit.c:21:
warning: [email protected]: In file included from freetype2/src/autofit/ft-hb.c:27:
warning: [email protected]: In file included from freetype2/include/freetype/freetype.h:24:
warning: [email protected]: In file included from freetype2/include/freetype/config/ftconfig.h:42:
warning: [email protected]: freetype2/include/freetype/config/ftstdlib.h:88:10: fatal error: 'string.h' file not found
warning: [email protected]: #include <string.h>
warning: [email protected]:          ^
warning: [email protected]: 1 error generated.
warning: [email protected]: ToolExecError: Command LC_ALL="C" "arm-linux-androideabi-clang++" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "." "-I" "freetype2/include" "-I" "freetype2/src" "-DFT2_BUILD_LIBRARY" "-o" "/Users/marcweber/mw-repos/TRS_24/example/target/armv7-linux-androideabi/release/build/freetype-sys-7cb8d15d3b471e65/out/0d80b2c4b549a911-autofit.o" "-c" "freetype2/src/autofit/autofit.c" with args arm-linux-androideabi-clang++ did not execute successfully (status code exit status: 1).cargo:warning=In file included from freetype2/src/base/ftbase.c:21:
warning: [email protected]: In file included from freetype2/src/base/ftadvanc.c:19:
warning: [email protected]: In file included from freetype2/include/freetype/internal/ftdebug.h:29:
warning: [email protected]: In file included from freetype2/include/freetype/config/ftconfig.h:42:
warning: [email protected]: freetype2/include/freetype/config/ftstdlib.h:88:10: fatal error: 'string.h' file not found
warning: [email protected]: #include <string.h>
warning: [email protected]:          ^
warning: [email protected]: In file included from freetype2/src/base/ftbbox.c:27:
warning: [email protected]: In file included from freetype2/include/freetype/internal/ftdebug.h:29:
warning: [email protected]: In file included from freetype2/include/freetype/config/ftconfig.h:42:
warning: [email protected]: freetype2/include/freetype/config/ftstdlib.h:88:10: fatal error: 'string.h' file not found
warning: [email protected]: #include <string.h>
@MarijnS95 MarijnS95 changed the title Android versions supported - finding header files Android versions 4.2 supported? - finding header files Jan 27, 2025
@MarijnS95
Copy link
Member

MarijnS95 commented Jan 27, 2025

You might just be missing out because Android 4.2 is API level 17 (https://developer.android.com/tools/releases/platforms), while the latest GameActivity docs state it's only backwards compatible to level 19 (Android 4.4): https://developer.android.com/games/agdk/game-activity/get-started. EDIT: Since this crate is barely maintained and never updated, the GameActivity code copy-pasted into it may be older and compatible with earlier Android versions?

But from the logs it's hard to confirm that you're using a valid tool / environment to cross-compile to Android. It seems you're using an arbitrary arm-linux-androideabi-clang++ found in PATH, without ever providing an Android-specific sysroot from the NDK, nor providing a --target flag with the right Android target API level. Perhaps consider setting these up in (target-specific) C(XX)FLAGS environment variables and/or using cargo-apk or xbuild to cross-compile your Rust project.

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

No branches or pull requests

2 participants