Re: [PATCH v9 1/3] perf report: Support LLVM for addr2line()

James Clark
2024-09-10T14:06:40Z

On 9/3/24 15:15, Arnaldo Carvalho de Melo wrote:
> On Tue, Sep 03, 2024 at 11:01:36AM -0300, Arnaldo Carvalho de Melo wrote:
>> On Tue, Sep 03, 2024 at 07:09:47AM -0300, Arnaldo Carvalho de Melo wrote:
>>> 3: almalinux:9-i386WARNING: image platform (linux/386) does not match the expected platform (linux/amd64)
>>> WARNING: image platform (linux/386) does not match the expected platform (linux/amd64)
>>> 17.58 almalinux:9-i386 : FAIL gcc version 11.4.1 20231218 (Red Hat 11.4.1-3) (GCC)
>>> util/llvm-c-helpers.cpp: In function ‘char* make_symbol_relative_string(dso*, const char*, u64, u64)’:
>>> util/llvm-c-helpers.cpp:150:52: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘u64’ {aka ‘long long unsigned int’} [-Werror=format=]
>>> 150 | snprintf(buf, sizeof(buf), "%s+0x%lx",
>>> | ~~^
>>> | |
>>> | long unsigned int
>>> | %llx
>>> 151 | demangled ? demangled : sym_name, addr - base_addr);
>>> | ~~~~~~~~~~~~~~~~
>>> | |
>>> | u64 {aka long long unsigned int}
>>> cc1plus: all warnings being treated as errors
>>> make[3]: *** [/git/perf-6.11.0-rc3/tools/build/Makefile.build:158: util] Error 2
>>
>> The one above is fixed by the patch at the end, that I already added to
>> the cset where the problem was being introduced.
>>
>> Now there is something a bit more tricky, we'll have to add a feature
>> check to see if the libllvm has what is needed if this appears in some
>> distro we still want to support, since alpine 3.16 has what is needed
>> I'll take the opportunity to drop test building on alpine 3.15.
>
> Or, as I'll do with debian:11, just remove llvm-dev and not build the
> features it enables:
>
> 17 13.79 debian:11 : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
> util/llvm-c-helpers.cpp: In function 'char* llvm_name_for_code(dso*, const char*, u64)':
> util/llvm-c-helpers.cpp:178:21: error: 'std::remove_reference_t<llvm::DILineInfo>' {aka 'struct llvm::DILineInfo'} has no member named 'StartAddress'
> 178 | addr, res_or_err->StartAddress ? *res_or_err->StartAddress : 0);
> | ^~~~~~~~~~~~
> util/llvm-c-helpers.cpp:178:49: error: 'std::remove_reference_t<llvm::DILineInfo>' {aka 'struct llvm::DILineInfo'} has no member named 'StartAddress'
> 178 | addr, res_or_err->StartAddress ? *res_or_err->StartAddress : 0);
> | ^~~~~~~~~~~~
> make[3]: *** [/git/perf-6.11.0-rc3/tools/build/Makefile.build:158: util] Error 2
>

I also hit this issue. I think it makes sense to auto detect the version
so I sent a patch. It was quite easy to autodetect and it might not be
that obvious to others how to get the build working again given this error.