Closed lanistor closed 4 years ago
JIT session error: Symbols not found: { ___cxa_begin_catch, ...
Failed to materialize symbols: { (0x7fdb6440b810, {__ZNSt3__1lsINS_11char_traitsIcEEEERNS_13basic_ostreamIcT_EES6_PKc,...
You seem to have guessed the issue, but to confirm: LLVM's JIT acts as a linker, and you are seeing missing symbols errors because you don't have definitions of some of the symbols that your relocatable object is using. You need to load definitions of those functions into the JIT, or link them into the JIT executable and then make the JIT executable's symbols visible to JIT'd code. See: https://llvm.org/docs/ORCv2.html#how-to-add-process-and-library-symbols-to-the-jitdylibs
In your case a glance at the missing symbols suggest that you will at least need to build your JIT with RTTI and exceptions turned on. I'm not sure whether you will have to do anything special to pull in the iostreams definitions.
clang++ -std=c++17 -stdlib=libc++ ffi.cpp -o build/ffi.o
As I mentioned in https://github.com/llvm/llvm-project/issues/57 you need to use -c -o
to produce a relocatable object. Using just -o
will result in an executable which definitely will not work.
@lhames Yeah, it works. Thank you so much.
When i try to link c++ function, error occured:
Here are my code: main.cpp
ffi.cpp
ffi.o
was build byclang++ -std=c++17 -stdlib=libc++ ffi.cpp -c -o build/ffi.o;
If usingclang++ -std=c++17 -stdlib=libc++ ffi.cpp -o build/ffi.o;
, another error will occour:Relative question: issues/57