Hi again,
I hope everybody is doing well given these days' circumstances!
I have a follow-up question on my previous attempts to use LLVM.
What I want is to include *libLLVM_android* on l*ibart-compiler* and use it
on an arm64 device (sailfish) in particular.
Now, I can successfully compile llvm components I need using:
m libLLVM_android opt llc llvm-linker
Then I install the library and the 3 tools on a sailfish device, and when
executing llc for example I can see that it can successfully utilize the
*libLLVM_android* library.
But when I try to include the libLLVM_android on art/compiler/Android.bp I
get issues.
Here's my changes:
*art/compiler/Android.bp:*
libart_cc_defaults {
name: "some_llvm_defaults",
defaults: [
// I am not using llvm-defaults as compilation will break on
warnings like: -Wc++14-extensions
// "llvm-defaults",
"force_build_llvm_components",
],
target: {
android: {
srcs: [
// my additional .cc files go here..
],
},
},
// I think this is the proper way to include the headers
header_libs: ["llvm-headers"],
// not sure about the next 2 lines
// export_shared_lib_headers: ["libLLVM_android"],
// compile_multilib: "first",
// that's how I should include the library I think, but it gives me the
error#1 listed below
shared_libs: ["libLLVM_android"],
cflags: [
// some flags necessary for LLVM
"-D__STDC_LIMIT_MACROS",
"-D__STDC_CONSTANT_MACROS",
"-Wno-unused-parameter",
],
// headers shouldn't be included like this I think, but instead
// with someting like header_libs that I did above
include_dirs: [
"external/llvm/include",
],
}
On the external/llvm/Android.bp I can see here
<https://cs.android.com/android/platform/superproject/+/android10-release:external/llvm/Android.bp;l=276>
that
it does export the relevant header directories for android targets,
and since I have successfully compiled and installed libLLVM_android on a
device, I can't see why it won't work.
The error#1 is:
> out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list
-b out/soong
-n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs
.ninja -o
out/soong/build.ninja Android.bp
internal error: panic in WalkDeps(module "apex_test_build_features" variant
"android_common_apex_test_build_features",
github.com/google/blueprint.(*baseModuleContext).WalkDeps.func1, ) for
dependency module "prebuilt_libLLVM_android"
variant "android_arm_armv8-a_kryo_core_shared_apex_test_build_features" in
GenerateBuildActions for module
"apex_test_build_features" variant "android_common_apex_test_build_features"
Requesting an invalid path
(full error log here
<https://gist.github.com/Paschalis/813d53901b83960da34bc2fb78f09844>)
Is it because I have to include libLLVM_android in some apex configuration
so some checks for its inclusion to libart-compiler can now pass?
Or is it that the prebuilt_libLLVM_android is missing?
On android6, I used to include libLLVM like this and it worked fine:
*art/compiler/Android.mk:*
...
LOCAL_SHARED_LIBRARIES += libLLVM
LOCAL_CFLAGS += -D__STDC_LIMIT_MACROS \
-D__STDC_CONSTANT_MACROS
LOCAL_C_INCLUDES += $(LOCAL_LLVM_INCLUDES)
ifeq ($$(art_target_or_host),target)
# I think I am missing this part on Android.bp
include $(LLVM_DEVICE_BUILD_MK)
endif
include $(LLVM_GEN_INTRINSICS_MK)
...
Thanks in advance,
Paschalis
On Tuesday, March 3, 2020 at 8:41:49 PM UTC+2, Paschalis Mpeis wrote:
>
> Thanks a lot Colin for taking the time to read through my message and
> reply.
> I ended up using Android.bp files as you suggested.
>
> Since all these tools were dropped from building in android10, I though
> they were never converted to blueprint files.
> It turns out commit 7623033 had them, and with minor changes I made them
> compiling for target device.
>
>
>
> On Tuesday, March 3, 2020 at 12:25:31 AM UTC+2, Colin Cross wrote:
>>
>> Those files are generated by the llvm_tblgen modules in
>> external/llvm/Android.bp. You'll find their outputs at:
>>
>> out/soong/.intermediates/external/llvm/llvm-gen-attributes/gen/llvm/IR/Attributes.inc
>>
>> out/soong/.intermediates/external/llvm/llvm-gen-intrinsics/gen/llvm/IR/Intrinsics.gen
>>
>> As a hack you could copy those files to the places where the Android.mk
>> files create them, just be aware they will not be updated if you make
>> changes to the source files and rebuild. You could also try reverting the
>> change that removed generating those files in Make:
>> commit 7ebb1e3516ebd630aa3fe94f9b4cca2c2dbb09ae
>> Author: Dan Willemsen <[email protected]>
>> Date: Thu Nov 1 00:16:34 2018 -0700
>>
>> Disable tblgen in Make
>>
>> The last user of these have been removed. simpleperf is still using
>> LLVM_HOST_BUILD_MK and LLVM_DEVICE_BUILD_MK, so these can't all be
>> removed yet.
>>
>> Test: treehugger
>> Change-Id: I0b3966fa5630e9795a1e7d7b9658f9a2bcad5271
>>
>> You'll likely have better success building opt, llvm-link and llc using
>> Android.bp files than trying to get the old Android.mk files to work though.
>>
>> On Mon, Mar 2, 2020 at 12:49 PM Paschalis Mpeis <[email protected]>
>> wrote:
>>
>>> Hi there,
>>>
>>> I am building some tools from *external/llvm*, specifically *opt*,
>>> *llvm-link*, and* llc*.
>>> For this, I revived the relevant Android.mk from previous commits
>>> (for each of the tools, and a relevant portion at
>>> external/llvm/Android.mk).
>>> They are normally picked up by the soong build system, and I can for
>>> example call: `m opt`.
>>>
>>> However, these tools depend on *two intermediates*:
>>>
>>> -
>>>
>>> target/product/<DEVICE>/gen/EXECUTABLES/opt_intermediates/llvm/IR/Attributes.inc
>>> -
>>>
>>> target/product/<DEVICE>/gen/EXECUTABLES/opt_intermediates/llvm/IR/Intrinsics.gen
>>>
>>> I have enabled FORCE_BUILD_LLVM_COMPONENTS (see here
>>> <https://cs.android.com/android/platform/superproject/+/android10-release:external/llvm/Android.bp;l=159>
>>> )
>>> and I can see there are relevant entries for what I want at lines: 148
>>> <https://cs.android.com/android/platform/superproject/+/android10-release:external/llvm/Android.bp;l=148>
>>> and 154
>>> <https://cs.android.com/android/platform/superproject/+/android10-release:external/llvm/Android.bp;l=154>
>>> .
>>>
>>> So, is my question is: is there a way to generate those 2 intermediate
>>> files using the existing Android.bp setup on android10-release branch
>>> <https://cs.android.com/android/platform/superproject/+/android10-release:external/llvm/>
>>> ?
>>>
>>> Cheers,
>>> Paschalis
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the "Android
>>> Building" mailing list.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-building?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Building" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/android-building/6e937488-80cb-42c8-b15c-087cafb7c400%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/android-building/6e937488-80cb-42c8-b15c-087cafb7c400%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
--
You received this message because you are subscribed to the "Android Building"
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-building/00a51312-0d65-489c-a9f5-f23076b040c3%40googlegroups.com.