A bunch of errors while installing VMKit and compiling LLVM

Hi everyone

I wasn’t successful in running VMKit on my machine and I’m still struggling with doing it.
Maybe someone had at least one of my problems and knows how to solve it (because it seems to me that I ran into every problem that could occur :slight_smile: ).

Thanks in advance,
Sergii.

So here is the story:
I have a fresh installation of Ubuntu 11.04 64bit with all important updates.
I’ll tell in advance that I was careful in trying to compile LLVM and VMKit
(i.e. I had only one version of llvm-gcc and/or clang installed at a
time, I always ran “make clean” before “make” etc.)

To build VMKit we have first to checkout and build LLVM. The VMKit “Getting started”
guide states: Make sure you have llvm-gcc or clang available when you configure LLVM.
Alternatively, you can also checkout clang in llvm-scr/tools.

The following steps are not done in sequence, they are alternatives

  1. Install llvm-gcc from Ubuntu repository. In this case the LLVM configuration
    script doesn’t see the gcc compiler although it’s installed
    ~/llvm/llvm-build$ sudo apt-get install llvm-gcc-4.5
    ~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
    checking for clang… no
    checking for llvm-gcc… llvm-gcc
    checking for C compiler default output file name… configure:
    error: C compiler cannot create executables

  2. Install older version of llvm-gcc from Ubuntu repository. This installation
    doesn’t create llvm-gcc executable but instead creates llvm-gcc-4.2 so I
    created a symlink to llvm-gcc-4.2. named llvm-gcc. The LLVM configuration goes fine
    but building LLVM produces an error

~/llvm/llvm-build$ sudo apt-get install llvm-gcc-4.2
~/llvm/llvm-build$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/llvm-gcc
~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
~/llvm/llvm-build$ make

llvm[1]: Compiling Host.cpp for Release+Asserts build
In file included from /usr/include/c++/4.5/cerrno:43:0,
from /home/svozniuk/llvm/llvm-src/lib/Support/Unix/Unix.h:27,
from /home/svozniuk/llvm/llvm-src/lib/Support/Unix/Host.inc:21,
from /home/svozniuk/llvm/llvm-src/lib/Support/Host.cpp:20:
/usr/include/errno.h:69:13: error: multiple types in one declaration
/usr/include/errno.h:69:13: error: declaration does not declare anything
/bin/rm: cannot remove /home/svozniuk/llvm/llvm-build/lib/Support/Release+Asserts/Host.d.tmp': No such file or directory make[1]: *** [/home/svozniuk/llvm/llvm-build/lib/Support/Release+Asserts/Host.o] Error 1 make[1]: Leaving directory /home/svozniuk/llvm/llvm-build/lib/Support’
make: *** [all] Error 1

  1. Download llvm-gcc4.2-2.9-x86_64-linux archive from llvm.org, extract
    it and manually add to the PATH. The configuration script finishes successfully
    but building LLVM produces an error

~/llvm/llvm-build$ export PATH=$PATH:/home/svozniuk/llvm/llvm-gcc4.2-2.9-x86_64-linux/bin/
~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
~/llvm/llvm-build$ make
llvm[1]: Compiling CommandLine.cpp for Release+Asserts build
In file included from /home/svozniuk/llvm/llvm-src/lib/Support/CommandLine.cpp:25:
/home/svozniuk/llvm/llvm-src/include/llvm/Support/system_error.h:499: error: ‘EAFNOSUPPORT’ was not declared in this scope
/home/svozniuk/llvm/llvm-src/include/llvm/Support/system_error.h:500: error: ‘EADDRINUSE’ was not declared in this scope
…And another 50 errors of the same type follow…

  1. Install clang from Ubuntu repository (All ways (which I know of) to build LLVM with
    llvm-gcc available have failed so now I switch to building LLVM with clang available).
    The configuration finishes successfully but again I get an error trying to build LLVM

~/llvm/llvm-build$ sudo apt-get install clang
~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
~/llvm/llvm-build$ make

llvm[1]: Compiling APFloat.cpp for Release+Asserts build
In file included from /home/svozniuk/llvm/llvm-src/lib/Support/APFloat.cpp:15:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/APFloat.h:104:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/APInt.h:18:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/ArrayRef.h:13:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/SmallVector.h:17:
/home/svozniuk/llvm/llvm-src/include/llvm/Support/type_traits.h:20:10: fatal error: ‘utility’ file not found
#include
^
1 error generated.
make[1]: *** [/home/svozniuk/llvm/llvm-build/lib/Support/Release+Asserts/APFloat.o] Error 1

  1. Checkout clang to llvm-src-clang/tools and build LLVM this way. LLVM Configuration script finishes
    with no errors. LLVM builds successfully. VMKit configuration script finishes with no errors.
    Building VMKit produces an error (segmentation fault)
    ~/llvm/llvm-build-clang$ …/llvm-src-clang/configure --enable-optimized
    ~/llvm/llvm-build-clang$ make
    ~/llvm/vmkit$ ./configure --with-llvmsrc="/home/svozniuk/llvm/llvm-src-clang" --with-llvmobj="/home/svozniuk/llvm/llvm-build-clang" --with-gnu-classpath-glibj="/home/svozniuk/llvm/classpath-0.97.2" --with-gnu-classpath-libs="/home/svozniuk/llvm/classpath-0.97.2/lib" --with-mmtk-plan=org.mmtk.plan.copyms.CopyMS
    ~/llvm/vmkit$ make

llvm[2]: Building Release+Asserts Bytecode Module MMTKAlloc.bc
make[2]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk/mmtk-alloc' make[2]: Entering directory /home/svozniuk/llvm/vmkit/mmtk/java’
make[2]: buildfile: Command not found
make[2]: [all] Error 127 (ignored)
llvm[2]: Building Release+Asserts mmtk-vmkit.jar all
Can’t find zip file.
0 opt 0x000000000093449f
1 opt 0x0000000000934fda
2 libpthread.so.0 0x00002b867fa26c60
3 MMTKMagic.so 0x00002b8680977769
4 opt 0x00000000008d0177 llvm::MPPassManager::runOnModule(llvm::Module&) + 535
5 opt 0x00000000008d02db llvm::PassManagerImpl::run(llvm::Module&) + 187
6 opt 0x00000000004c4c9f main + 5791
7 libc.so.6 0x00002b86805faeff __libc_start_main + 255
8 opt 0x00000000004b4569
Stack dump:
0. Program arguments: /home/svozniuk/llvm/llvm-build-clang/Release+Asserts/bin/opt -load=/home/svozniuk/llvm/vmkit/Release+Asserts/lib/MMTKMagic.so -std-compile-opts -LowerJavaRT -f mmtk-vmkit.bc -o mmtk-vmkit-optimized.bc

  1. Running pass ‘Remove references to RT’ on module ‘mmtk-vmkit.bc’.
    make[2]: *** [all] Segmentation fault
    make[2]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk/java' make[1]: *** [all] Error 1 make[1]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk’
    make: *** [all] Error 1

Hi Sergii,

Hi everyone

I wasn’t successful in running VMKit on my machine and I’m still struggling with doing it.
Maybe someone had at least one of my problems and knows how to solve it (because it seems to me that I ran into every problem that could occur :slight_smile: ).

Thanks in advance,
Sergii.

So here is the story:
I have a fresh installation of Ubuntu 11.04 64bit with all important updates.
I’ll tell in advance that I was careful in trying to compile LLVM and VMKit
(i.e. I had only one version of llvm-gcc and/or clang installed at a
time, I always ran “make clean” before “make” etc.)

To build VMKit we have first to checkout and build LLVM. The VMKit “Getting started”
guide states: Make sure you have llvm-gcc or clang available when you configure LLVM.
Alternatively, you can also checkout clang in llvm-scr/tools.

The following steps are not done in sequence, they are alternatives

  1. Install llvm-gcc from Ubuntu repository. In this case the LLVM configuration
    script doesn’t see the gcc compiler although it’s installed
    ~/llvm/llvm-build$ sudo apt-get install llvm-gcc-4.5
    ~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
    checking for clang… no
    checking for llvm-gcc… llvm-gcc
    checking for C compiler default output file name… configure:
    error: C compiler cannot create executables

  2. Install older version of llvm-gcc from Ubuntu repository. This installation
    doesn’t create llvm-gcc executable but instead creates llvm-gcc-4.2 so I
    created a symlink to llvm-gcc-4.2. named llvm-gcc. The LLVM configuration goes fine
    but building LLVM produces an error

~/llvm/llvm-build$ sudo apt-get install llvm-gcc-4.2
~/llvm/llvm-build$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/llvm-gcc
~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
~/llvm/llvm-build$ make

llvm[1]: Compiling Host.cpp for Release+Asserts build
In file included from /usr/include/c++/4.5/cerrno:43:0,
from /home/svozniuk/llvm/llvm-src/lib/Support/Unix/Unix.h:27,
from /home/svozniuk/llvm/llvm-src/lib/Support/Unix/Host.inc:21,
from /home/svozniuk/llvm/llvm-src/lib/Support/Host.cpp:20:
/usr/include/errno.h:69:13: error: multiple types in one declaration
/usr/include/errno.h:69:13: error: declaration does not declare anything
/bin/rm: cannot remove /home/svozniuk/llvm/llvm-build/lib/Support/Release+Asserts/Host.d.tmp': No such file or directory make[1]: *** [/home/svozniuk/llvm/llvm-build/lib/Support/Release+Asserts/Host.o] Error 1 make[1]: Leaving directory /home/svozniuk/llvm/llvm-build/lib/Support’
make: *** [all] Error 1

  1. Download llvm-gcc4.2-2.9-x86_64-linux archive from llvm.org, extract
    it and manually add to the PATH. The configuration script finishes successfully
    but building LLVM produces an error

~/llvm/llvm-build$ export PATH=$PATH:/home/svozniuk/llvm/llvm-gcc4.2-2.9-x86_64-linux/bin/
~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
~/llvm/llvm-build$ make
llvm[1]: Compiling CommandLine.cpp for Release+Asserts build
In file included from /home/svozniuk/llvm/llvm-src/lib/Support/CommandLine.cpp:25:
/home/svozniuk/llvm/llvm-src/include/llvm/Support/system_error.h:499: error: ‘EAFNOSUPPORT’ was not declared in this scope
/home/svozniuk/llvm/llvm-src/include/llvm/Support/system_error.h:500: error: ‘EADDRINUSE’ was not declared in this scope
…And another 50 errors of the same type follow…

  1. Install clang from Ubuntu repository (All ways (which I know of) to build LLVM with
    llvm-gcc available have failed so now I switch to building LLVM with clang available).
    The configuration finishes successfully but again I get an error trying to build LLVM

~/llvm/llvm-build$ sudo apt-get install clang
~/llvm/llvm-build$ …/llvm-src/configure --enable-optimized
~/llvm/llvm-build$ make

llvm[1]: Compiling APFloat.cpp for Release+Asserts build
In file included from /home/svozniuk/llvm/llvm-src/lib/Support/APFloat.cpp:15:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/APFloat.h:104:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/APInt.h:18:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/ArrayRef.h:13:
In file included from /home/svozniuk/llvm/llvm-src/include/llvm/ADT/SmallVector.h:17:
/home/svozniuk/llvm/llvm-src/include/llvm/Support/type_traits.h:20:10: fatal error: ‘utility’ file not found
#include
^
1 error generated.
make[1]: *** [/home/svozniuk/llvm/llvm-build/lib/Support/Release+Asserts/APFloat.o] Error 1

  1. Checkout clang to llvm-src-clang/tools and build LLVM this way. LLVM Configuration script finishes
    with no errors. LLVM builds successfully. VMKit configuration script finishes with no errors.

I believe option 5 is the only solution that works right now :frowning: You’re not the first one that had problems with pre-installed llvm-gcc or clang. I’ll update the web page to say that one must checkout clang in tools/clang

Building VMKit produces an error (segmentation fault)
~/llvm/llvm-build-clang$ …/llvm-src-clang/configure --enable-optimized
~/llvm/llvm-build-clang$ make
~/llvm/vmkit$ ./configure --with-llvmsrc="/home/svozniuk/llvm/llvm-src-clang" --with-llvmobj="/home/svozniuk/llvm/llvm-build-clang" --with-gnu-classpath-glibj="/home/svozniuk/llvm/classpath-0.97.2" --with-gnu-classpath-libs="/home/svozniuk/llvm/classpath-0.97.2/lib" --with-mmtk-plan=org.mmtk.plan.copyms.CopyMS
~/llvm/vmkit$ make

llvm[2]: Building Release+Asserts Bytecode Module MMTKAlloc.bc
make[2]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk/mmtk-alloc' make[2]: Entering directory /home/svozniuk/llvm/vmkit/mmtk/java’
make[2]: buildfile: Command not found
make[2]: [all] Error 127 (ignored)
llvm[2]: Building Release+Asserts mmtk-vmkit.jar all
Can’t find zip file.
0 opt 0x000000000093449f
1 opt 0x0000000000934fda
2 libpthread.so.0 0x00002b867fa26c60
3 MMTKMagic.so 0x00002b8680977769
4 opt 0x00000000008d0177 llvm::MPPassManager::runOnModule(llvm::Module&) + 535
5 opt 0x00000000008d02db llvm::PassManagerImpl::run(llvm::Module&) + 187
6 opt 0x00000000004c4c9f main + 5791
7 libc.so.6 0x00002b86805faeff __libc_start_main + 255
8 opt 0x00000000004b4569
Stack dump:
0. Program arguments: /home/svozniuk/llvm/llvm-build-clang/Release+Asserts/bin/opt -load=/home/svozniuk/llvm/vmkit/Release+Asserts/lib/MMTKMagic.so -std-compile-opts -LowerJavaRT -f mmtk-vmkit.bc -o mmtk-vmkit-optimized.bc

  1. Running pass ‘Remove references to RT’ on module ‘mmtk-vmkit.bc’.
    make[2]: *** [all] Segmentation fault
    make[2]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk/java' make[1]: *** [all] Error 1 make[1]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk’
    make: *** [all] Error 1

Do you have ‘ant’? I think we forget to check if ant is installed on your machine :frowning: If not, please install it. If yes, could you also attach the output of make ENABLE_OPTIMIZED=1 VERBOSE=1?

Thanks!
Nicolas

Hi, Nicolas

Indeed, I did not have ant installed and installing it allowed me to overcome the previous error. However the next one appeared. I have ran make with ENABLE_OPTIMIZED=1 VERBOSE=1 and here is the output (the last part of it)

make[2]: Entering directory `/home/svozniuk/llvm/vmkit/mmtk/java’
/usr/bin/ant -buildfile /home/svozniuk/llvm/vmkit/mmtk/java/build.xml
Buildfile: /home/svozniuk/llvm/vmkit/mmtk/java/build.xml

main:
[mkdir] Created dir: /home/svozniuk/llvm/vmkit/mmtk/java/classes
[javac] /home/svozniuk/llvm/vmkit/mmtk/java/build.xml:4: warning: ‘includeantruntime’ was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 380 source files to /home/svozniuk/llvm/vmkit/mmtk/java/classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[jar] Building jar: /home/svozniuk/llvm/vmkit/mmtk/java/mmtk-vmkit.jar

BUILD SUCCESSFUL
Total time: 4 seconds
llvm[2]: Building Release+Asserts mmtk-vmkit.jar all
/home/svozniuk/llvm/llvm-build-clang/Release+Asserts/bin/opt -load=/home/svozniuk/llvm/vmkit/Release+Asserts/lib/JITGCPass.so -std-compile-opts -JITGCPass -f /home/svozniuk/llvm/vmkit/Release+Asserts/lib/MMTKAlloc.bc -o /home/svozniuk/llvm/vmkit/Release+Asserts/lib/MMTKAlloc.bc
/home/svozniuk/llvm/vmkit/Release+Asserts/bin/vmjc -std-compile-opts -load=/home/svozniuk/llvm/vmkit/Release+Asserts/lib/MMTKRuntime.so -load=/home/svozniuk/llvm/vmkit/Release+Asserts/lib/MMTKMagic.so -LowerMagic /home/svozniuk/llvm/vmkit/mmtk/java/mmtk-vmkit.jar -disable-exceptions -disable-cooperativegc -with-clinit=org/mmtk/vm/VM,org/mmtk/utility/,org/mmtk/policy/,org/j3/config/* -Dmmtk.hostjvm=org.j3.mmtk.Factory -o mmtk-vmkit.bc -Dmmtk.properties=/home/svozniuk/llvm/vmkit/mmtk/java/vmkit.properties -disable-stubs -assume-compiled
vmjc: JavaClass.cpp:443: j3::JavaObject *j3::Class::doNew(j3::Jnjvm *): Assertion this && "No class when allocating."' failed. 0 vmjc 0x0000000000eea55f 1 vmjc 0x0000000000eeb09a 2 libpthread.so.0 0x00002b11108bbc60 3 libc.so.6 0x00002b11116bcd05 gsignal + 53 4 libc.so.6 0x00002b11116c0ab6 abort + 390 5 libc.so.6 0x00002b11116b57c5 __assert_fail + 245 6 vmjc 0x0000000000565deb j3::Class::doNew(j3::Jnjvm*) + 107 7 vmjc 0x00000000005726db j3::JavaString::stringDup(j3::ArrayUInt16 const* const&, j3::Jnjvm*) + 59 8 vmjc 0x000000000055a761 j3::StringMap::lookupOrCreate(j3::ArrayUInt16 const*, j3::Jnjvm*, j3::JavaString* (*)(j3::ArrayUInt16 const* const&, j3::Jnjvm*)) + 161 9 vmjc 0x0000000000557162 CreateUnableToLoad(mvm::UTF8 const*, j3::Jnjvm*) + 786 10 vmjc 0x00000000005552e3 j3::Jnjvm::noClassDefFoundError(mvm::UTF8 const*) + 67 11 vmjc 0x000000000055de64 j3::JnjvmClassLoader::loadName(mvm::UTF8 const*, bool, bool, j3::JavaString*) + 276 12 vmjc 0x00000000005667ea j3::Class::readParents(j3::Reader&) + 106 13 vmjc 0x000000000056791c j3::Class::readClass() + 364 14 vmjc 0x000000000055dacc j3::JnjvmClassLoader::constructClass(mvm::UTF8 const*, j3::ClassBytes*) + 364 15 vmjc 0x000000000055d89f j3::JnjvmBootstrapLoader::internalLoad(mvm::UTF8 const*, bool, j3::JavaString*) + 127 16 vmjc 0x000000000055dd7f j3::JnjvmClassLoader::loadName(mvm::UTF8 const*, bool, bool, j3::JavaString*) + 47 17 vmjc 0x00000000005a01fc extractFiles(j3::ClassBytes*, j3::JavaAOTCompiler*, j3::JnjvmBootstrapLoader*, std::vector<j3::Class*, std::allocator<j3::Class*> >&) + 444 18 vmjc 0x00000000005a0604 mainCompilerStart(j3::JavaThread*) + 548 19 vmjc 0x00000000005e2d79 mvm::Thread::internalThreadStart(mvm::Thread*) + 73 20 libpthread.so.0 0x00002b11108b2d8c 21 libc.so.6 0x00002b111176f04d clone + 109 Aborted make[2]: *** [all] Error 134 make[2]: Leaving directory /home/svozniuk/llvm/vmkit/mmtk/java’
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/svozniuk/llvm/vmkit/mmtk’
make: *** [all] Error 1

Hi Sergii,

I think there is a problem in your configure command for VMKit. If you look at what you provide for glibj:

–with-gnu-classpath-glibj="/home/svozniuk/llvm/classpath-0.97.2

I don’t think it’s right. You should change it to:

–with-gnu-classpath-glibj="/home/svozniuk/llvm/classpath-0.97.2/lib/glibj.zip

Also please make sure that you have created the links for the shared libraries (step 2 of getting started)

And, if you sync, you might have the configure script warning you about that mistake. The support for detecting correct configure options for GNU Classpath just came in yesterday :slight_smile:

Cheers,
Nicolas

Thanks, Nicolas

Finally I got VMKit up and running. You were right – there was a problem in the configuration of glibj.zip.

Best regards,
Sergii.