clang --profile requires nonexistent file on Amazon Linux 2

0

Hello- when using the al2-provided clang/llvm suite, the --coverage flag fails, claiming there is an archive missing:

[ec2-user@ip-172-31-36-41 ~]$ echo "int main() { }" >| hello.c
[ec2-user@ip-172-31-36-41 ~]$ clang -v --coverage hello.c -o hello
clang version 11.1.0 (Amazon Linux 2 11.1.0-1.amzn2.0.2)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-redhat-linux/7
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/7
Selected GCC installation: /usr/lib/gcc/aarch64-redhat-linux/7
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/bin/clang-11" -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model static -mframe-pointer=non-leaf -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu generic -target-feature +neon -target-abi aapcs -fallow-half-arguments-and-returns -fno-split-dwarf-inlining -debugger-tuning=gdb -v -femit-coverage-notes -femit-coverage-data -resource-dir /usr/lib64/clang/11.1.0 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.1.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/ec2-user -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -o /tmp/hello-f82f91.o -x c hello.c
clang -cc1 version 11.1.0 based upon LLVM 11.1.0 default target aarch64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib64/clang/11.1.0/include
 /usr/include
End of search list.
 "/usr/bin/ld" -EL --build-id --eh-frame-hdr -m aarch64linux -dynamic-linker /lib/ld-linux-aarch64.so.1 -o hello /usr/lib/gcc/aarch64-redhat-linux/7/../../../../lib64/crt1.o /usr/lib/gcc/aarch64-redhat-linux/7/../../../../lib64/crti.o /usr/lib/gcc/aarch64-redhat-linux/7/crtbegin.o -L/usr/lib/gcc/aarch64-redhat-linux/7 -L/usr/lib/gcc/aarch64-redhat-linux/7/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/aarch64-redhat-linux/7/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/hello-f82f91.o /usr/lib64/clang/11.1.0/lib/linux/libclang_rt.profile-aarch64.a -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/aarch64-redhat-linux/7/crtend.o /usr/lib/gcc/aarch64-redhat-linux/7/../../../../lib64/crtn.o
/usr/bin/ld: cannot find /usr/lib64/clang/11.1.0/lib/linux/libclang_rt.profile-aarch64.a: No such file or directory
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

as far as i can tell, that file should be provided by clang/llvm/compiler-rt, but it is not to be found in any of the packages available in the default installation:

[ec2-user@ip-172-31-36-41 ~]$ yum whatprovides /usr/lib64/clang/11.1.0/lib/linux/libclang_rt.profile-aarch64.a
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
222 packages excluded due to repository priority protections
No matches found

this is a stock AL2 image on which i've only run yum groupinstall -y 'Development Tools' ; yum install -y clang-devel llvm-devel

for reference, this works fine in AL2023:

[ec2-user@ip-172-31-27-140 ~]$ clang -v --coverage ./hello.c -o hello
clang version 15.0.6 (Amazon Linux 15.0.6-3.amzn2023.0.2)
Target: x86_64-amazon-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-amazon-linux/11
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-amazon-linux/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/usr/bin/clang-15" -cc1 -triple x86_64-amazon-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -ftest-coverage -fprofile-arcs -fcoverage-compilation-dir=/home/ec2-user -resource-dir /usr/lib64/clang/15.0.6 -internal-isystem /usr/lib64/clang/15.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-amazon-linux/11/../../../../x86_64-amazon-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/ec2-user -ferror-limit 19 -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/hello-55d8dd.o -x c ./hello.c
clang -cc1 version 15.0.6 based upon LLVM 15.0.6 default target x86_64-amazon-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-amazon-linux/11/../../../../x86_64-amazon-linux/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib64/clang/15.0.6/include
 /usr/local/include
 /usr/include
End of search list.
 "/usr/bin/ld" --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o hello /usr/bin/../lib/gcc/x86_64-amazon-linux/11/../../../../lib64/crt1.o /usr/bin/../lib/gcc/x86_64-amazon-linux/11/../../../../lib64/crti.o /usr/bin/../lib/gcc/x86_64-amazon-linux/11/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-amazon-linux/11 -L/usr/bin/../lib/gcc/x86_64-amazon-linux/11/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib /tmp/hello-55d8dd.o /usr/lib64/clang/15.0.6/lib/linux/libclang_rt.profile-x86_64.a -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-amazon-linux/11/crtend.o /usr/bin/../lib/gcc/x86_64-amazon-linux/11/../../../../lib64/crtn.o
[ec2-user@ip-172-31-27-140 ~]$

am i missing something here? as far as i can tell, it seems like these should be part of the compiler-rt package, but they're not inlcuded there, and that also seems to be a separate build from the llvm package. i've only dug in a little bit here, though.

it'd be great if we didn't have to go on a toolchain-rebuilding expedition on amazon linux 2, which we'll be using for the duration of its supported life.

asked 9 months ago361 views
2 Answers
0

Hello!

This issue has been escalated internally and has been found to be due to the missing compiler-rt package. This package will be added to the Amazon Linux 2 repository in the near future and it will resolve the issue you reported.

Should you face any issues after this package has been made available within the Amazon Linux 2 repository, I would recommend creating an AWS Support case (if you have not done so already) to get in touch with an engineer to assist you further.

AWS
SUPPORT ENGINEER
Juan_P
answered 9 months ago
0

Hello,

I would like to inform you that Compiler-rt package has been added in Amazon Linux 2 repository, according to your scenario please use below steps to confirm the same at your end.

  1. $ sudo yum update -y
  2. $ sudo yum groupinstall -y 'Development Tools' ; yum install -y clang-devel llvm-devel
  3. $ sudo yum install compiler-rt
  4. $ echo "int main() { }" >| hello.c
  5. $ clang -v --coverage hello.c -o hello
AWS
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions