Genie Generating Incorrect Linker Flags for MacOS and Android Building
Author: GEMISISCreated Aug 25, 2024Updated Nov 30, 2025
Describe the bug
When building the Android target on an M-series MacBook Pro, Genie is generating incorrect makefiles with wrong linker flags on the shared library builds. It is specifically adding a -dynamiclib flag when it should be a -shared flag in bgfx-shared-lib.make.
To Reproduce Steps to reproduce the behavior (Note: requires MacBook Pro):
- Run
make android-arm64 - Note the error
Expected behavior Build is successful
Actual behavior Failed build with the following error message:
Linking bgfx-shared-lib
clang++: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
ld.lld: error: undefined symbol: main
>>> referenced by crtbegin.c
>>> /Users/gemisis/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/32/crtbegin_dynamic.o:(_start_main)
>>> referenced by crtbegin.c
>>> /Users/gemisis/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/32/crtbegin_dynamic.o:(_start_main)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../../android-arm64/bin/libbgfx-shared-libDebug.so] Error 1
make[1]: *** [bgfx-shared-lib] Error 2
make: *** [android-arm64-debug] Error 2Screenshots
Additional context
- Building for Android 64-bit devices
- Running on an M3 Max MacBook Pro
- Changing from
-dynamiclibto-sharedmanually after projgen successfully builds, but is not a proper fix.
Source: bkaradzic/bgfx