2
votes

I have a multifile c++ project, built with help of Makefile. CC and CXX were gcc and g++ relatively. Now I need to try this project under llvm (lli). I have replaced

CC = gcc
CXX = g++
LD = ld

with

CC = clang
CXX = clang++
LD = clang++

and added -emit-llvm to cflags:

CFLAGS_DEBUG =  $(CFLAGS) -g -emit-llvm
...
CFLAGS_RELEASE =  $(CFLAGS) -O2 -emit-llvm

Then I invoked make. Object files were built, but while collecting them into application, I got this error:

obj/Debug/../../XX/YY.o: file not recognized: File format not recognized

collect2: ld returned 1 exit status

clang: error: linker command failed with exit code 1 (use -v to see invocation)

So, how I must build this project properly for the LLVM runtime interpreter (lli)?

1

1 Answers

5
votes

You should link via llvm-link, not via clang++