VMKit Development

Hi,
I was just curious if VMKit development is still going on.

Also while building VMKit I am getting error at link stage:

make[1]: Entering directory `/code/vmkit/tools/vmjc'
llvm[1]: Linking Debug+Asserts executable vmjc
/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lLLVMLinker
collect2: ld returned 1 exit status

I have installed but I am not able to use the llvm linker to link this application.
I tried using LD=llvm-ld during make, but it does not help.

Any idea on how this can be solved?

Thanks,
Akshat

Hi Akshat,

Did you compile LLVM before compiling VMKit? libLLVMLinker.so is a shared library from LLVM.

Cheers,
Nicolas

Hi,
Going ahead, the llvm-ld seems to segfault (build on Linux with llvm-ld v3.0svn build):

make[2]: Entering directory /root/code/vmkit/mmtk/mmtk-j3' llvm[2]: Building Debug+Asserts Bytecode Module MMTKRuntime.bc 0 llvm-ld 0x0884c66e 1 llvm-ld 0x0884c3fb 2 0xb7891400 __kernel_sigreturn + 0 3 llvm-ld 0x083be9e9 llvm::isa_impl<llvm::Constant, llvm::Value>::doit(llvm::Value const&) + 29 4 llvm-ld 0x083ccba4 llvm::isa_impl_cl<llvm::Constant, llvm::Value*>::doit(llvm::Value const*) + 29 5 llvm-ld 0x083cb81c llvm::isa_impl_wrap<llvm::Constant, llvm::Value*, llvm::Value*>::doit(llvm::Value* const&) + 31 6 llvm-ld 0x083c94bf llvm::isa_impl_wrap<llvm::Constant, llvm::Use, llvm::Value*>::doit(llvm::Use const&) + 43 7 llvm-ld 0x083c5fe3 bool llvm::isa<llvm::Constant, llvm::Use>(llvm::Use const&) + 29 8 llvm-ld 0x083c1cc6 llvm::cast_retty<llvm::Constant, llvm::Use>::ret_type llvm::cast<llvm::Constant, llvm::Use>(llvm::Use const&) + 29 9 llvm-ld 0x083c04de llvm::GlobalAlias::getOperand(unsigned int) const + 70 10 llvm-ld 0x083de0d1 llvm::GlobalAlias::getAliasee() + 37 11 llvm-ld 0x083dc3c6 12 llvm-ld 0x083dcdb5 13 llvm-ld 0x083dce74 llvm::Linker::LinkModules(llvm::Module*, llvm::Module*, std::string*) + 64 14 llvm-ld 0x083d949a llvm::Linker::LinkInModule(llvm::Module*, std::string*) + 46 15 llvm-ld 0x083d926c llvm::Linker::LinkInFile(llvm::sys::Path const&, bool&) + 1524 16 llvm-ld 0x083d943d llvm::Linker::LinkInFiles(std::vector<llvm::sys::Path, std::allocator<llvm::sys::Path> > const&) + 67 17 llvm-ld 0x083ad740 main + 1329 18 libc.so.6 0xb75d3cc6 __libc_start_main + 230 19 llvm-ld 0x083a67c1 Stack dump: 0. Program arguments: /root/code/llvm/Debug+Asserts/bin/llvm-ld -r -o /root/code/vmkit/Debug+Asserts/lib/MMTKRuntime.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/ActivePlan.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Assert.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Collection.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/FinalizableProcessor.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Lock.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/MMTk_Events.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Memory.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/ObjectModel.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/ReferenceProcessor.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/RuntimeHelpers.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Scanning.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Selected.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Statistics.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/Strings.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/SynchronizedCounter.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/TraceInterface.bc /root/code/vmkit/mmtk/mmtk-j3/Debug+Asserts/VM.bc make[2]: *** [/root/code/vmkit/Debug+Asserts/lib/MMTKRuntime.bc] Segmentation fault make[2]: Leaving directory /root/code/vmkit/mmtk/mmtk-j3’
make[1]: *** [all] Error 1
make[1]: Leaving directory `/root/code/vmkit/mmtk’
make: *** [all] Error 1

Any pointers on how I can debug this?

Thanks,
Akshat

Hi Akshat,

Going ahead, the llvm-ld seems to segfault (build on Linux with llvm-ld v3.0svn
build):

try updating to latest LLVM from svn - this was fixed a day or two ago.

Ciao, Duncan.

Hi,
I tried building again with the latest llvm.
I am getting another seg fault:

make[2]: Entering directory `/root/code/vmkit/mmtk/java’
Buildfile: /root/code/vmkit/mmtk/java/build.xml

main:
[javac] /root/code/vmkit/mmtk/java/build.xml:4: warning: ‘includeantruntime’ was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to /root/code/vmkit/mmtk/java/classes
[jar] Building jar: /root/code/vmkit/mmtk/java/mmtk-vmkit.jar

BUILD SUCCESSFUL
Total time: 3 seconds
llvm[2]: Building Debug+Asserts mmtk-vmkit.jar all
0 vmjc 0x0904fd0a
1 vmjc 0x0904fa97
2 0xb78e7400 __kernel_sigreturn + 0
3 libstdc++.so.6 0xb7835532 std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const*, unsigned int, std::allocator const&) + 50
4 vmjc 0x08653213 llvm::StringRef::str() const + 91
5 vmjc 0x09064883 llvm::Twine::str() const + 131
6 vmjc 0x087092ca llvm::Triple::Triple(llvm::Twine const&) + 36
7 vmjc 0x0889eb47 llvm::X86_MC::ParseX86Triple(llvm::StringRef) + 59
8 vmjc 0x0889efe4 llvm::X86_MC::createX86MCSubtargetInfo(llvm::StringRef, llvm::StringRef, llvm::StringRef) + 45
9 vmjc 0x0869d5b8 j3::JavaAOTCompiler::JavaAOTCompiler(std::string const&) + 1144
10 vmjc 0x08652435 main + 216
11 libc.so.6 0xb7614cc6 __libc_start_main + 230
12 vmjc 0x08651cc1
make[2]: *** [all] Segmentation fault

Anything that I am overlooking.
Thanks,
Akshat

Thanks,
Akshat

Hi Akshat,

Could you give us your configuration? CPU/OS? How did you configure and build llvm and vmkit?

Nicolas

Hi,
Here are my build details.
OS:
Linux scop 2.6.38-gentoo-r6 #1 SMP Sat Jul 9 13:07:18 EST 2011 i686 Intel(R) Core™ i5-2415M CPU @ 2.30GHz GenuineIntel GNU/Linux
Machine: VirtualBox (32 bit)

Configure (VMKit):
./configure --with-llvmsrc=/root/code/llvm --with-llvmobj=~/code/llvm --with-gnu-classpath-libs=/usr/gnu-classpath-0.98/lib/classpath LD=/usr/bin/llvm-ld --with-gnu-classpath-glibj=/usr/gnu-classpath-0.98/share/classpath/glibj.zip

For LLVM just did a ./configure and make; make install

Hope this helps.
Thanks,
Akshat

Hi,
Here are my build details.
OS:
Linux scop 2.6.38-gentoo-r6 #1 SMP Sat Jul 9 13:07:18 EST 2011 i686 Intel(R) Core™ i5-2415M CPU @ 2.30GHz GenuineIntel GNU/Linux
Machine: VirtualBox (32 bit)

Configure (VMKit):
./configure --with-llvmsrc=/root/code/llvm --with-llvmobj=~/code/llvm --with-gnu-classpath-libs=/usr/gnu-classpath-0.98/lib/classpath LD=/usr/bin/llvm-ld --with-gnu-classpath-glibj=/usr/gnu-classpath-0.98/share/classpath/glibj.zip

Why do you need to specify LD? Also are you compiling vmkit with clang or llvm-gcc? (Note that you need an llvm-based C++ compiler to build vmkit).

Nicolas

Yep, I am compiling with llvm-gcc. Also I removed the LD flag on the configure, it still gives the same segafault.
Thanks,
Akshat

I just noticed there was some .h move around in llvm and fixed the includes in vmkit. Maybe you were just removing the failing includes?

In any case, I have updated vmkit for llvm trunk. Let me know if updating helps.

Nicolas

Hi,
I just did a reconfigure and rebuild with the latest svn for vmkit code.

The code still seg faults but the stack trace seems to have changed.

llvm[2]: Building Debug+Asserts mmtk-vmkit.jar all
vmjc: JavaRuntimeJIT.cpp:172: uint32 j3VirtualTableLookup(j3::Class*, uint32, uint32*, j3::JavaObject*): Assertion `dmeth->classDef->isInitializing() && “Class not ready in a virtual lookup.”’ failed.
0 vmjc 0x0904fc0a
1 vmjc 0x0904f997
2 0xb77ac400 __kernel_sigreturn + 0
3 libc.so.6 0xb74eede2 abort + 386
4 libc.so.6 0xb74e67d8 __assert_fail + 248
5 vmjc 0x08678786 j3VirtualTableLookup + 550
6 vmjc 0xb5f6eac3 j3VirtualTableLookup + 2911855971
7 vmjc 0xb5f6eb2d j3VirtualTableLookup + 2911856077
8 vmjc 0x08672cae j3::JavaMethod::invokeIntStaticBuf(j3::Jnjvm*, j3::Class*, void*) + 126
9 vmjc 0x0867573b j3::JavaMethod::invokeIntStaticAP(j3::Jnjvm*, j3::Class*, char*) + 491
10 vmjc 0x08675789 j3::JavaMethod::invokeIntStatic(j3::Jnjvm*, j3::Class*, …) + 41
11 vmjc 0x08698a39 j3::Classpath::CreateJavaThread(j3::Jnjvm*, j3::JavaThread*, char const*, j3::JavaObject*) + 537
12 vmjc 0x08698b28 j3::Classpath::InitializeThreading(j3::Jnjvm*) + 232
13 vmjc 0x0865dc0e j3::Jnjvm::loadBootstrap() + 414
14 vmjc 0x0869c131 mainCompilerStart(j3::JavaThread*) + 833
15 vmjc 0x086fc438 mvm::thread::internalThreadStart(mvm::Thread*) + 120
16 libpthread.so.0 0xb7774cf2
17 libc.so.6 0xb759184e clone + 94
make[2]: *** [all] Aborted

Is there any way to put the building process through a debugger. I tried to use gdb, but got no stack trace.

Thanks,
Akshat

This error usually shows up when vmkit cannot find the classpath libs and jar. Make sure --with-gnu-classpath-libs points to the directory of .so files are, and that --with-gnu-classpath-glibj points to glibj.zip.

Nicolas

Thanks Nicolas,
I do have --with-gnu-classpath-libs and --with-gnu-classpath-glibj
pointing to the right thing, but I have gnu class path 0.98 instead of 0.97 and its the non X version.

So I do not have the libgtkpeer.so.
Maybe that is the reason why it is crashing. Unfortunately, I am not able to compile GNU class path with gtk+ peer right now.

Will give it a try on the mac.

Thanks,
Akshat

Hi Akshat,

Please use version 0.97.2. vmkit does not support 0.98.
Also, it should be fine to not compile gtk+ peer.

Nicolas

Thanks Nicolas,

Classpath-0.97.2 did the trick.
Finally got it built.

Thanks,
Akshat