Closed
Description
Tested versions
Godot 4.3
System information
Mac OS 15
Issue description
Cannot build Godot native library (so) for android on Mac OS 15, using Godot 4.3.
I followed these steps: Compiling for Android — Godot Engine (stable) documentation in English
The SDK and NDK seems to be setup well. Building progresses until linking, where this issue happens:
Linking Shared Library solitaire/bin/libbachey.android.template_debug.arm64.so ...
ld: error: unknown argument '-dynamic', did you mean '-Bdynamic'
ld: error: unknown argument '-dylib'
ld: error: unknown argument '-arch'
ld: error: unknown argument '-platform_version'
ld: error: unable to find library -lto_library
ld: error: cannot open /Users/bacsigabor/Library/Android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/darwin-x86_64/lib/libLTO.dylib: No such file or directory
ld: error: cannot open x86_64: No such file or directory
ld: error: cannot open macos: No such file or directory
ld: error: cannot open 15.0.0: No such file or directory
ld: error: cannot open 0.0.0: No such file or directory
ld: error: unable to find library -lc++
ld: error: unable to find library -lSystem
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [solitaire/bin/libbachey.android.template_debug.arm64.so] Error 1
scons: building terminated because of errors.
bacsigabor@Mac godot-solitaire %
I tried the setup steps for windows, but similarly Scons fails at linking:
solitaire\bin\libbachey.android.template_debug.arm64.so ...
=====
lld: error: unable to find library -lc++
lld: error: unable to find library -lmingw32
lld: error: unable to find library -lgcc_s
lld: error: unable to find library -lgcc
lld: error: unable to find library -lmoldname
lld: error: unable to find library -lmingwex
lld: error: unable to find library -lmsvcrt
lld: error: unable to find library -ladvapi32
lld: error: unable to find library -lshell32
lld: error: unable to find library -luser32
lld: error: unable to find library -lkernel32
lld: error: unable to find library -lmingw32
lld: error: unable to find library -lgcc_s
lld: error: unable to find library -lgcc
lld: error: unable to find library -lmoldname
lld: error: unable to find library -lmingwex
lld: error: unable to find library -lmsvcrt
lld: error: unable to find library -lkernel32
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Why? What could I miss? Are there other important settings than ANDROID_HOME environment variable or do I need additional step for the SConstruct file?
Steps to reproduce
Follow Android SDK/NDK setup steps, build GDNative with scons and notice these errors
Minimal reproduction project (MRP)
SCons file:
#!/usr/bin/env python
import os
import sys
env = SConscript("godot-cpp/SConstruct")
# For reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
AddOption(
'--opt',
action='store_true',
help='optimise',
default=False)
if GetOption('opt'):
env.Append(CXXFLAGS=['-O3'])
env['LINKFLAGS'] = []
else:
env.Append(CXXFLAGS=['-g', '-O0'])
env['LINKFLAGS'] = ['-g']
0]) + " - >" + str(item[1]))
if env["platform"] == "macos":
library = env.SharedLibrary(
"solitaire/bin/libbachey.{}.{}.framework/libbachey.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else:
library = env.SharedLibrary(
"solitaire/bin/libbachey{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)
Default(library)