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

[BUG] r27 NDK: Update NDK to version 27+ makes the game samples builds to fail #82

Open
manugildev opened this issue Dec 16, 2024 · 0 comments

Comments

@manugildev
Copy link

manugildev commented Dec 16, 2024

Description

Updating to NDK r27b+ on any of these samples fails with several compilation issues regarding standard C++ symbols not being found.

The issue is only reproducible on Windows.

Even if a workaround has been discovered, it doesn't seem like a proper solution since this bug might be just surfacing a bigger issue.

Steps to Reproduce

  1. Open a sample project in Android Studio. The easiest one to use is the game-mode sample.
  2. Follow the instructions in the README.md file to set up the project.
  3. Update GameActivity to latest available version 3.0.5 in app/build.gradle. This step might not be needed.
  4. Go to app/src/main/cpp/native_engine.cpp and replace ALooper_pollAll with ALooper_pollOnce on line 214. ALooper_pollAll has been deprecated in NDK 27 (read more).
  5. Go to app/build.gradle.
  6. Update project to ndk 27. Replace ndkVersion '26.1.10909125' with ndkVersion '27.1.12297006'.
  7. Build the APK.

Results

Errors regarding C++ symbols not being properly linked appear:

ld.lld: error: undefined symbol: std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::find(char, unsigned long) const
ld.lld: error: undefined symbol: std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>::replace(unsigned long, unsigned long, unsigned long, char)
ld.lld: error: undefined symbol: __cxa_guard_acquire ...
image

Workaround

  1. Go to game_mode/app/src/main/cpp/CMakeLists.txt.
  2. Add c++ to the bottom of target_link_libraries(...):
target_link_libraries(game
                      android
                      bullet3
                      imgui
                      game-activity::game-activity_static
                      games-frame-pacing::swappy_static
                      atomic
                      EGL
                      GLESv2
                      jnigraphics
                      log
                      z
            ----->    c++
)
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

1 participant