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

Fix android build on Fedora 40. #32532

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 15 additions & 13 deletions python/servo/command_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ def build_android_env_if_needed(self, env: Dict[str, str]):
host_cxx = env.get('HOST_CXX') or shutil.which("clang++")

llvm_toolchain = path.join(env['ANDROID_NDK_ROOT'], "toolchains", "llvm", "prebuilt", host)
env['PATH'] = (path.join(llvm_toolchain, "bin") + ':' + env['PATH'])
env['PATH'] = (env['PATH'] + ':' + path.join(llvm_toolchain, "bin"))

def to_ndk_bin(prog):
return path.join(llvm_toolchain, "bin", prog)
Expand All @@ -623,18 +623,20 @@ def to_ndk_bin(prog):
env['HOST_CXX'] = host_cxx
env['HOST_CFLAGS'] = ''
env['HOST_CXXFLAGS'] = ''
env['CC'] = to_ndk_bin("clang")
env['CPP'] = to_ndk_bin("clang") + " -E"
env['CXX'] = to_ndk_bin("clang++")

env['AR'] = to_ndk_bin("llvm-ar")
env['RANLIB'] = to_ndk_bin("llvm-ranlib")
env['OBJCOPY'] = to_ndk_bin("llvm-objcopy")
env['YASM'] = to_ndk_bin("yasm")
env['STRIP'] = to_ndk_bin("llvm-strip")
env['TARGET_CC'] = to_ndk_bin("clang")
env['TARGET_CPP'] = to_ndk_bin("clang") + " -E"
env['TARGET_CXX'] = to_ndk_bin("clang++")

env['TARGET_AR'] = to_ndk_bin("llvm-ar")
env['TARGET_RANLIB'] = to_ndk_bin("llvm-ranlib")
env['TARGET_OBJCOPY'] = to_ndk_bin("llvm-objcopy")
env['TARGET_YASM'] = to_ndk_bin("yasm")
env['TARGET_STRIP'] = to_ndk_bin("llvm-strip")
env['RUST_FONTCONFIG_DLOPEN'] = "on"

env["LIBCLANG_PATH"] = path.join(llvm_toolchain, "lib64")
env["CLANG_PATH"] = to_ndk_bin("clang")

# A cheat-sheet for some of the build errors caused by getting the search path wrong...
#
# fatal error: 'limits' file not found
Expand All @@ -646,8 +648,8 @@ def to_ndk_bin(prog):
#
# Also worth remembering: autoconf uses C for its configuration,
# even for C++ builds, so the C flags need to line up with the C++ flags.
env['CFLAGS'] = "--target=" + android_toolchain_name
env['CXXFLAGS'] = "--target=" + android_toolchain_name
env['TARGET_CFLAGS'] = "--target=" + android_toolchain_name
env['TARGET_CXXFLAGS'] = "--target=" + android_toolchain_name

# These two variables are needed for the mozjs compilation.
env['ANDROID_API_LEVEL'] = android_api
Expand All @@ -667,7 +669,7 @@ def to_ndk_bin(prog):
if not os.path.exists(env['AAR_OUT_DIR']):
os.makedirs(env['AAR_OUT_DIR'])

env['PKG_CONFIG_SYSROOT_DIR'] = path.join(llvm_toolchain, 'sysroot')
env['TARGET_PKG_CONFIG_SYSROOT_DIR'] = path.join(llvm_toolchain, 'sysroot')

def build_ohos_env_if_needed(self, env: Dict[str, str]):
if not (self.cross_compile_target and self.cross_compile_target.endswith('-ohos')):
Expand Down