The release notes of version 3.7 of the Snapdragon LLVM Compiler mention Full support for building Android code base (AOSP) without any changes to the build system. I attempted to build with it, but the following line failed with error: expected value token: https://www.codeaurora.org/cgit/quic/la/platform/frameworks/rs/tree/driv...
I'm guessing that I'm missing something here.
Thanks for your question.
We verified that the Snapdragon LLVM 3.7 toolchain can build the AOSP tip from Google code base as of first week of August. The code you are trying to compile is Qualcomm's version of Android which is older; Google migrated most of AOSP modules to be built with LLVM only recently (in the last 2 months) and cannot be cleanly built with Snapdragon LLVM.
Please note that you would need to point the AOSP build system to use Snapdragon LLVM instead of llvm.org LLVM that is part of NDK. This may require a small change to AOSP make system that we will be happy to share. Please let us know if you would like this change
So it works without modification on the AOSP master branch, but not the marshmallow release branches? And yes, I would like to see the change you are referring to. Thank you for your help and quick response.
@Raja I would also like to see the change, as I am having trouble using this compiler at all.
Sorry about the delay. Please apply the patch below to AOSP build system. We use this patch internally to build AOSP with Snapdragon LLVM. Please let us know if you run into issues
Thanks
diff --git a/core/binary.mk b/core/binary.mk
index e18f8c8..18106ac 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -169,6 +169,8 @@ ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
endif
+my_qcclang := $(strip $(LOCAL_QCCLANG))
+
# clang is enabled by default for host builds
# enable it unless we've specifically disabled clang above
ifdef LOCAL_IS_HOST_MODULE
@@ -186,6 +188,12 @@ ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
endif
endif
+ifeq ($(QCCLANG),true)
+ ifeq ($(my_qcclang),)
+ my_qcclang := true
+ endif
+endif
+
# arch-specific static libraries go first so that generic ones can depend on them
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
@@ -262,6 +270,14 @@ my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFL
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CONLYFLAGS)
my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
+ ifeq ($(my_qcclang), true)
+ ifeq ($(strip $(my_cc)),)
+ my_cc := $(QCCLANG_PATH)/clang
+ endif
+ ifeq ($(strip $(my_cxx)),)
+ my_cxx := $(QCCLANG_PATH)/clang++
+ endif
+ endif
else
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CONLYFLAGS)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index e5d299c..4f204a0 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -151,6 +151,7 @@ LOCAL_MODULE_OWNER:=
LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:=
+LOCAL_QCCLANG:=
LOCAL_JAR_EXCLUDE_FILES:=
LOCAL_JAR_PACKAGES:=
LOCAL_JAR_EXCLUDE_PACKAGES:=
This looks like a no-op if QCCLANG isn't defined, which it doesn't seem to be in anything open source. Also, even if it was, I don't see how it'd be any different from simply changing the clang path manually.
Any update here?
I'm trying to build Android for MSM with the Snapdragon CLANG. The compilers bin directory is in $PATH and the right binaries gets picked (when invoking 'which clang'). I'm calling make like so:
make LOCAL_CLANG=true LOCAL_CC=clang LOCAL_CXX=clang++ -j17
but I only get a long list of errors:
external/libcxx/src/thread.cpp:63: error: unsupported reloc 43
external/libcxx/src/thread.cpp:133: error: unsupported reloc 43
external/libcxx/src/thread.cpp:133: error: unsupported reloc 43
external/libcxx/include/thread:146: error: unsupported reloc 43
external/libcxx/include/thread:149: error: unsupported reloc 43
external/libcxx/include/thread:149: error: unsupported reloc 43
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libc++.so' failed
make: *** [out/host/linux-x86/obj32/lib/libc++.so] Error 1
make: *** wait: No child processes. Stop.
Btw: I get the same error with Android default CLANG and the given patch for using Snapdragon CLANG as default via shell variable doesn't work (= invalid when copy'n'pasted to a file and applied with git).
Any suggestions/ideas to point me to the right direction?
Regards,
Cid
From the log, it looks like you are building the host (x86) version of libc++.so. Snapdragon LLVM supports only ARM target builds. The AOSP LLVM (provided by Google) does support x86 but I am not sure what the issue is. I would suggest contacting Google AOSP forums to understand this issue