Unable to build vmkit

Hello, I am using Ubuntu 11.10 64-bit. Following the instructions on the
VMKit website I grabbed llvm, clang, and vmkit via svn (and GNU
Classpath via the link of the page). Compilation of llvm, clang and
classpath went fine. I had problems compiling vmkit, which seem to be
related to a TargetOptions being required as a parameter when creating a
TargetMachine in LLVM. This led to a couple other places in VMKit's code
that tried to reference some LLVM global variables that no longer exist
(I assume because they were moved into TargetOptions).

I attempted to make some minor fixes to get by this and I did, but when
it was building mmtk-vmkit.jar (I think that's what it is doing) I got
an assertion while running the vmjc command in the Makefile:
vmjc: JavaRuntimeJIT.cpp:469: void *j3ResolveSpecialStub(): Assertion
`FI->Metadata != __null && "Wrong stack trace"' failed.

So, either my "fixes" were bad, or I have another problem that I don't
know how to solve :slight_smile:

Should I be grabbing a specific version of LLVM/Clang from SVN (instead
of the head)?

Thank you,
Jeff

Hello, I am using Ubuntu 11.10 64-bit. Following the instructions on the
VMKit website I grabbed llvm, clang, and vmkit via svn (and GNU
Classpath via the link of the page). Compilation of llvm, clang and
classpath went fine. I had problems compiling vmkit, which seem to be
related to a TargetOptions being required as a parameter when creating a
TargetMachine in LLVM. This led to a couple other places in VMKit's code
that tried to reference some LLVM global variables that no longer exist
(I assume because they were moved into TargetOptions).

I attempted to make some minor fixes to get by this and I did, but when
it was building mmtk-vmkit.jar (I think that's what it is doing) I got
an assertion while running the vmjc command in the Makefile:
vmjc: JavaRuntimeJIT.cpp:469: void *j3ResolveSpecialStub(): Assertion
`FI->Metadata != __null && "Wrong stack trace"' failed.

So, either my "fixes" were bad, or I have another problem that I don't
know how to solve :slight_smile:

I looked into this and this is because vmkit uses the
ExecutionEngine::createJIT interface, and at the moment you can't use
custom TargetOptions with this method (see
http://llvm.org/doxygen/ExecutionEngine_8cpp_source.html#l00439 ).

In this case, we're not setting NoFramePointerElim when creating the
JIT, which does bad things to code that uses the frame pointer :).

For what it's worth (if there's a particular reason you want to use
mainline), locally hacking an extra parameter for TargetOptions into
the createJIT method seems to work fine. I can't speak if that makes
any sense for LLVM proper, but will unblock this for you.

Should I be grabbing a specific version of LLVM/Clang from SVN (instead
of the head)?

r145713 (latest before the TargetOptions refactoring) works here. Good luck!

~Will

Hi Jeff,

I have just updated vmkit to the new LLVM API for passing target options. VMKit trunk should now work again.

Nicolas