[PATCH] D119038: [BOLT] Fix runtime osx cross-compile build

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 16:38:46 PST 2022


Amir accepted this revision.
Amir added a comment.

In D119038#3303006 <https://reviews.llvm.org/D119038#3303006>, @yota9 wrote:

> @Amir Do you use clang as CC/CXX for building BOLT? Also don't forget that currently the build for aarch64 is disabled in cmake.
>
>   /usr/bin/clang++   -I. -O3 -DNDEBUG   -target x86_64-apple-darwin19.6.0 -ffreestanding -fno-exceptions -fno-rtti -fno-stack-protector -std=c++11 -MD -MT CMakeFiles/bolt_rt_instr_osx.dir/instr.cpp.o -MF CMakeFiles/bolt_rt_instr_osx.dir/instr.cpp.o.d -o CMakeFiles/bolt_rt_instr_osx.dir/instr.cpp.o -c /home/yota9/src/llvm/bolt/runtime/instr.cpp
>   In file included from /home/yota9/src/llvm/bolt/runtime/instr.cpp:44:
>   In file included from /home/yota9/src/llvm/bolt/runtime/common.h:13:
>   In file included from /usr/include/elf.h:22:
>   /usr/include/features.h:461:12: fatal error: 'sys/cdefs.h' file not found
>   #  include <sys/cdefs.h>
>
> It does not look as an ARM problem to me. The thing is that HAVE_ELF_H is defined in config.h file since it is defining for the host compiler, but used for cross compile tool. I assume the osx instrumentation is working because in instr.cpp we have:
>
>   #if defined(HAVE_ELF_H) and !defined(__APPLE__)
>
> And the second one is not true for the cross tool. But anyway we should not try include elf.h for non-linux target.

Ah, yes, I've seen this issue but worked around it. Thanks for properly fixing it! This reason is sufficient:

> we should not try include elf.h for non-linux target.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119038/new/

https://reviews.llvm.org/D119038



More information about the llvm-commits mailing list