Who succeeded in building Shark on x86_64? (ubuntu)

Xerxes Rånby xerxes at zafena.se
Mon Jul 29 10:06:06 PDT 2013


2013-07-17 12:41, Min Seong Kim skrev:
>  Who succeeded in building Shark on x86_64? (ubuntu)
> 
I have tested to build it unfortunately there is some new issues combining the latest LLVM SVN and OpenJDK hg tip, more info below:
I have installed all dependencies needed to build OpenJDK on my machine by running
sudo apt-get build-dep openjdk-7-jdk

Romans blog-post The return of the Shark, part II (howto) includes some details on how to build Shark.
http://rkennke.wordpress.com/2012/11/28/the-return-of-the-shark-part-ii-howto/

>  
> 
> plz tell me environmentaldetails.
>

Roman have also posted his own shark build script that also set-up the environment
http://cr.openjdk.java.net/~rkennke/shark/Build8-zero-shark
Update Build8-zero-shark to match your system
You will probably only need to change the export LLVM_CONFIG to point to the llvm-config from your own LLVM 3.2+ build.
On my 32bit system I also had to make sure that LP64 is unset. Defining LP64 on 32bit such as export LP64=0 will still make the build think its on a 64bit system and fail during linking of libjvm.so.

> 
> I tried all day, it failed and failed.
>
Please include details on how it failed or else we cant possibly help.
We also need to know which LLVM svn version and OpenJDK hotspot hg changeset/revision you used.

New issues gets introduced from time to time when the OpenJDK or LLVM source change that will cause the Zero/Shark build to fail, or simply require us developers to learn new tricks.
Half a year have passed since Roman tested his build, and since then things have unfortunately "bitrot", its time for some "normal" Zero/Shark maintenance work to get things working again!

The hotspot-comp I use have switched to the new "configure" based build system thus in order to generate the main openJDK makefile I had to run:
sh configure --with-jvm-variants=zeroshark
You may then create the final jdk image with shark included by runing:
sh Build8-zero-shark CONF=linux-x86-normal-zeroshark-release all
Example: on a 32bit system the final image is generated inside
hotspot-comp/build/linux-x86-normal-zeroshark-release/images/j2sdk-image


I will list some of the issues I experience when building the current Shark from hotspot-comp hg tip in combination with the current llvm (3.4) svn
on a 32bit system using gcc 4.6.3
llvm svn Revision: 187351
hotspot: 5012 d90d1b96b65b

***
first issue:
redefinition of entry_frame_call_wrapper() when using zero...
possible fix:

diff -r d90d1b96b65b src/share/vm/runtime/frame.hpp
--- a/src/share/vm/runtime/frame.hpp	Fri Jul 26 12:37:39 2013 -0700
+++ b/src/share/vm/runtime/frame.hpp	Mon Jul 29 18:08:49 2013 +0200
@@ -353,7 +353,11 @@

  public:
   // Entry frames
+#ifdef ZERO
+  JavaCallWrapper* entry_frame_call_wrapper() const;
+#else
   JavaCallWrapper* entry_frame_call_wrapper() const { return *entry_frame_call_wrapper_addr(); }
+#endif
   JavaCallWrapper* entry_frame_call_wrapper_if_safe(JavaThread* thread) const;
   JavaCallWrapper** entry_frame_call_wrapper_addr() const;
   intptr_t* entry_frame_argument_at(int offset) const;


***
next issue LLVM header changes related:
Compiling /home/xranby/hotspot-comp/hotspot/src/share/vm/compiler/compileBroker.cpp
In file included from /usr/local/include/llvm/IR/Value.h:17:0,
                 from /usr/local/include/llvm/Support/ValueHandle.h:19,
                 from /usr/local/include/llvm/ADT/ValueMap.h:31,
                 from /usr/local/include/llvm/ExecutionEngine/ExecutionEngine.h:22,
                 from /home/xranby/hotspot-comp/hotspot/src/share/vm/shark/llvmHeaders.hpp:42,
                 from /home/xranby/hotspot-comp/hotspot/src/share/vm/shark/sharkCompiler.hpp:33,
                 from /home/xranby/hotspot-comp/hotspot/src/share/vm/compiler/compileBroker.cpp:56:
/usr/local/include/llvm/IR/Use.h:45:7: error: redefinition of 'class llvm::PointerLikeTypeTraits<llvm::Use**>'
/usr/local/include/llvm/Use.h:43:7: error: previous definition of 'class llvm::PointerLikeTypeTraits<llvm::Use**>'
/usr/local/include/llvm/IR/Use.h:60:7: error: redefinition of 'class llvm::Use'
/usr/local/include/llvm/Use.h:58:7: error: previous definition of 'class llvm::Use'

Its possible we may need to update hotspot-comp/hotspot/src/share/vm/shark/llvmHeaders.hpp to use a different set of LLVM headers in order to fix this LLVM header issue.
A quick fix is to comment out use of llvm/IR/* headers inside the llvm/support/* headers, this allows the Shark build to continue. A proper fix needs to be discussed.



***
third issue:
Compiling /home/xranby/hotspot-comp/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp
/home/xranby/hotspot-comp/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp: In function 'int SafeFetch32(int*, int)':
/home/xranby/hotspot-comp/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp:413:7: error: redefinition of 'int SafeFetch32(int*, int)'
/home/xranby/hotspot-comp/hotspot/src/share/vm/runtime/stubRoutines.hpp:441:12: error: 'int SafeFetch32(int*, int)' previously defined here
/home/xranby/hotspot-comp/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp: In function 'intptr_t SafeFetchN(intptr_t*, intptr_t)':
/home/xranby/hotspot-comp/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp:418:12: error: redefinition of 'intptr_t SafeFetchN(intptr_t*, intptr_t)'
/home/xranby/hotspot-comp/hotspot/src/share/vm/runtime/stubRoutines.hpp:445:17: error: 'intptr_t SafeFetchN(intptr_t*, intptr_t)' previously defined here

Not sure how to fix/workaround this one yet.

Happy hacking, Cheers
Xerxes


More information about the zero-dev mailing list