[Mesa-dev] [PATCH] Android: Fix LLVM duplicated symbols linking for N and M
Mauro Rossi
issor.oruam at gmail.com
Wed Aug 23 18:12:06 UTC 2017
Il 23/ago/2017 19:57, "Rob Herring" <robh at kernel.org> ha scritto:
On Wed, Aug 23, 2017 at 12:31 PM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:
> On 23 August 2017 at 17:50, Rob Herring <robh at kernel.org> wrote:
>> On Sun, Aug 20, 2017 at 2:57 PM, Rob Herring <robh at kernel.org> wrote:
>>> On Fri, Aug 18, 2017 at 8:53 PM, Chih-Wei Huang <cwhuang at android-x86.org>
wrote:
>>>> 2017-08-19 8:27 GMT+08:00 Emil Velikov <emil.l.velikov at gmail.com>:
>>>>> On 18 August 2017 at 20:46, Rob Herring <robh at kernel.org> wrote:
>>>>>> Both statically linking libLLVMCore and dynamically linking libLLVM
causes
>>>>>> duplicated symbols in gallium_dri.so and it fails to dlopen. We don't
>>>>>> really need to link libLLVMCore, but just need generated headers to
be
>>>>>> built first. Dynamically linking to libLLVM instead is enough to do
>>>>>> that. Thanks to Qiang Yu for finding the root cause.
>>
>> [...]
>>
>>>>>> $(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
>>>>>> - $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308
-DMESA_LLVM_VERSION_PATCH=0) \
>>>>>> - $(eval LOCAL_STATIC_LIBRARIES += libLLVMCore) \
>>>>>> - $(eval LOCAL_C_INCLUDES += external/llvm/include
external/llvm/device/include),) \
>>>>>> + $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0308
-DMESA_LLVM_VERSION_PATCH=0),) \
>>>>>> $(if $(filter O,$(MESA_ANDROID_MAJOR_VERSION)), \
>>>>>> - $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309
-DMESA_LLVM_VERSION_PATCH=0) \
>>>>>> - $(eval LOCAL_HEADER_LIBRARIES += llvm-headers),)
>>>>>> + $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309
-DMESA_LLVM_VERSION_PATCH=0),) \
>>>>>> + $(eval LOCAL_SHARED_LIBRARIES += libLLVM)
>>>>> Am I the only person getting tad confused by amount of brackets?
>>>>> As mentioned by Chih-Wei - a shell switch is not possible, but how
>>>>> about a test vague like the following?
>>>>>
>>>>> test "x$(MESA_ANDROID_MAJOR_VERSION)" = "xO" &&
>>>>> $(eval LOCAL_CFLAGS += -DHAVE_LLVM=0x0309
-DMESA_LLVM_VERSION_PATCH=0)
>>>>
>>>> Only possible if you put it into $(shell ...)
>>>> That gives me an idea. Maybe we ca do like
>>>>
>>>> $(shell case "$(MESA_ANDROID_MAJOR_VERSION)" in \
>>>> 6) echo ... ;; \
>>>> 7) echo ... ;; \
>>>> *) echo ... ;; \
>>>> esac)
>>>>
>>>> I haven't really try it yet.
>>>
>>> What does either really buy us? It's really just bike shedding and
>>> unrelated to fixing the problem at hand.
>>>
>>> I have another idea which is to use llvm-config and avoid the
>>> conditionals altogether. I haven't looked into that closely though.
>>
>> Well, the build is broken again because the version changed from O to
>> 8 (and I'm not sure if master is going to change to P or 9 at some
>> point). So I went ahead and have this all coded up like this (I don't
>> see a simple way to build and run llvm-config):
>>
> Yay :-(
>
>> $(eval $(shell sed -n -e
>> 's/.*\(LLVM_VERSION_MAJOR\).*\([0-9].*\)/\1:=\2/p'
>> external/llvm/device/include/llvm/Config/llvm-config.h)) \
>> $(eval $(shell sed -n -e
>> 's/.*\(LLVM_VERSION_MINOR\).*\([0-9].*\)/\1:=\2/p'
>> external/llvm/device/include/llvm/Config/llvm-config.h)) \
>> $(eval LOCAL_CFLAGS +=
>> -DHAVE_LLVM=0x$(LLVM_VERSION_MAJOR)0$(LLVM_VERSION_MINOR))
>>
>> Only one slight problem in that for master/O it reports 3.8 as the
>> version is 3.8.275480 which I think is the SVN version number. Not
>> sure what to do with that...
>>
> Indeed, seems like a SVN version. Not sure how much to care about the
> PATCH version.
> Leave it as 0 or use the SVN one - your call.
Okay, I was a bit vague. The problem is the version is effectively 3.9
and the build breaks if we build with HAVE_LLVM=0x308 instead.
I don't think it would work on older versions either. N has 3.8.256229
and that is 3.8 (from mesa perspective). The M version was 3.6.svn,
but we pass 3.7 to mesa. So there's not really a programmatic way to
handle this.
Rob
LLVM version in Cmakelists.txt is indeed 3.9.0
Mauro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170823/058794b5/attachment.html>
More information about the mesa-dev
mailing list