Building frustration (on Oracle Linux)
Doug Simon
doug.simon at oracle.com
Sun Dec 27 20:30:59 UTC 2015
> On 27 Dec 2015, at 15:52, Raffaello Giulietti <raffaello.giulietti at supsi.ch> wrote:
>
> On 2015-12-27 12:48, Doug Simon wrote:
>>>>> I dislike Ubuntu for other reasons not related to Truffle/Graal.
>>>>> However, I have to admit that, at least for the purpose of building
>>>>> Truffle/Graal and for working on it, it was much smoother an experience
>>>>> than with CentOS, Fedora and Oracle Linux, all of them I tried before.
>>>>> Hence, I think I’ll stick with it.
>>>>
>>>> Strange, I would not expect much differences with those distributions either.
>>>> Not sure what the counter part of build-essentials is, but it shouldn’t be much more than a C/C++ tool chain, and some development headers (see http://packages.ubuntu.com/trusty/build-essential).
>>>>
>>>> I was under the impression that some of us use Oracle Linux to work on Graal. Perhaps we could extend the instructions for those distributions. Do you remember any of the specific issues you ran into?
>>>>
>>>
>>> Since I don't remember the details, I would have to retry the
>>> installation. I run my Linux systems as VirtualBox images, so that
>>> should be possible with little investment in time starting from scratch,
>>> i.e., by first installing the OS (for what it costs, VirtualBox is
>>> really a great product). No promises, however...
>>>
>
> As *not* promised, I retried a build of Truffle/Graal on a freshly
> installed Oracle Linux 7.2. For the installation I chose the "Server
> with GUI" software selection with the "Development Tools" among other
> packages. Immediately after installation, I updated everything proposed
> by the "Software Update" system tool.
>
> I then proceeded by installing the ant, hg and Oracle JDK 8 packages.
>
> While following the instructions at
> https://wiki.openjdk.java.net/display/Graal/Instructions, the build
> stops with the following messages:
>
> --------
> Linking vm...
> /usr/bin/ld: cannot find -lstdc++
>
> collect2: error: ld returned 1 exit status
>
> /usr/bin/chcon: cannot access ‘libjvm.so’: No such file or directory
>
> ERROR: Cannot chcon libjvm.so
> /usr/bin/objcopy: 'libjvm.so': No such file
> --------
>
> Of course, some version of libstdc++.so.* exists in /usr/lib64 but there
> is no unqualified libstdc++.so link. I'm not sure if this is needed, if
> it has been forgotten, if it depends on some configuration that I miss.
>
> Even after creating a libstdc++.so -> libstdc++.so.6 link in /usr/lib64,
> the above error message still persists. Afaik, this folder needs not to
> appear on LD_LIBRARY_PATH (which I didn't care to set in the first
> place, since it's not needed on Ubuntu).
>
> I hope I'm such an idiot to have forgotten something trivial.
No, you’re absolutely not. I ran into the same issue recently when I obtained a VM running "Oracle Linux 7 u1”. The problem is that the HotSpot build system wants to statically link in the stdc++ library and (in my case at least), there is no static version of libstdc++. That is, there is no libstdc++*.a files next to the libstdc++.so* files. My solution was to patch the relevant HotSpot make file to enable dynamic linking of the C++ library:
diff -r 9ed36a1fec52 make/linux/makefiles/gcc.make
--- a/make/linux/makefiles/gcc.make Tue Dec 08 17:58:45 2015 +0100
+++ b/make/linux/makefiles/gcc.make Thu Dec 10 03:56:21 2015 -0800
@@ -281,7 +281,7 @@
# Linker flags
# statically link libstdc++.so, work with gcc but ignored by g++
-STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
+STATIC_STDCXX = -lstdc++ -Wl,-Bdynamic
ifeq ($(USE_CLANG),)
# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
Of course, that makes the resulting binary not as flexible in terms of distribution but that may not matter in your case (as it did;t in mine).
It seems strange that Oracle Linux is not an officially supported JDK 8 build platform (https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms) but that’s the way it currently is.
-Doug
More information about the graal-dev
mailing list