I am following the steps to use the LLVM toolchain at the end of this Getting Started with the LLVM System page.
I built my LLVM toolchain on a MinGW64 host, and everything in the example above worked fine except the lli
command. I could successfully compile my target C program, as well as executing the native hello.exe
to print hello world
. But I couldn’t jit the bitcode.
The target code test.c
is very primitive:
int main(void)
{
return 0;
}
I followed the steps in the tutorial to produce the bitcode and assembly:
$ clang -emit-llvm -c test.c -o test.bc
$ llc test.bc -o test.s
$ clang test.s -o test
When I use lli
to jit the bitcode, an error occurred saying the __main
symbols is not found:
$ lli test.bc
JIT session error: Symbols not found: [ __main ]
C:/msys64/home/xxx/llvm-project/build/bin/lli.exe: Failed to materialize symbols: { (main, { main }) }
However, the linux build on my Ubuntu machine works just fine. Why is this happening?