#3343·bgfx

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):

  1. Run make android-arm64
  2. Note the error

Expected behavior Build is successful

Actual behavior Failed build with the following error message:

bash
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 2

Screenshots image

Additional context

  • Building for Android 64-bit devices
  • Running on an M3 Max MacBook Pro
  • Changing from -dynamiclib to -shared manually after projgen successfully builds, but is not a proper fix.