You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description
I encountered a linker error when building Raylib as a shared library for Android using the provided CMake configuration.The error indicates an "undefined symbol: main" when trying to link the Raylib shared library.
Since Android requires native applications to have an android_main() entry, Raylib's implementation allows the user to define a main() function, which is then called by Raylib. This must be taken into account by the build system.
Steps to reproduce
Use the provided Raylib CMake build system for Android (configured with the Android NDK).
Run the following CMake command to configure the build:
Encounter the linker error during the linking step:
ld.lld: error: undefined symbol: main
>>> referenced by rcore_android.c:279 (C:/coding/raylib/raylib/src/platforms/rcore_android.c:279)
>>> raylib/CMakeFiles/raylib.dir/rcore.c.o:(android_main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Additional information
This issue does not occur when using the provided Makefile, which works as expected.
The problem seems to be related to the CMake configuration.
The issue does not occur when building a static library.
Environment
Raylib version: Latest master branch
Operating System: Windows 10
Android NDK version: r27b
CMake version: 3.10.4
The text was updated successfully, but these errors were encountered:
raysan5
changed the title
[build] Unable to build raylib as a shared library for Android
[build][CMake] Unable to build raylib as a shared library for Android
Nov 14, 2024
Issue description
I encountered a linker error when building Raylib as a shared library for Android using the provided
CMake
configuration.The error indicates an "undefined symbol: main" when trying to link the Raylib shared library.Since Android requires native applications to have an
android_main()
entry, Raylib's implementation allows the user to define amain()
function, which is then called by Raylib. This must be taken into account by the build system.Steps to reproduce
Use the provided Raylib CMake build system for Android (configured with the Android NDK).
Run the following
CMake
command to configure the build:Build the shared library:
Encounter the linker error during the linking step:
Additional information
Environment
The text was updated successfully, but these errors were encountered: