Skip to content

Unable to compile project with clang++ lto #1563

Answered by RageCPP
RageCPP asked this question in Q&A
Discussion options

You must be logged in to vote

The cause of the error may have been found, here is an example I used to illustrate

➜  lto-test gcc -flto main.c -c -o main.o
➜  lto-test ar q main.a main.o
ar: creating main.a
➜  lto-test gcc b.c -c -o b.o 
➜  lto-test gcc -flto main.a b.o -o main 
➜  lto-test ./main 
Foo2
➜  lto-test clang -flto a.a b.o -o main
clang-15: error: no such file or directory: 'a.a'
➜  lto-test clang -flto main.a b.o -o main
/usr/bin/ld: main.a(main.o): plugin needed to handle lto object
/usr/bin/ld: main.a(main.o): plugin needed to handle lto object
/usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: b.o: in function `foo1':
b.c:(.text+0x…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RageCPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant