Build openjdk7/hotspot error while linking,

David Holmes David.Holmes at oracle.com
Tue Jun 14 22:14:52 UTC 2011


Dang Nhan Nguyen said the following on 06/15/11 01:43:
> I found out the cause is my additional code to the hotspot which use sdt namespace:
> 
> using namespace std;
> 
> When I remove this line and all the printout with "cout <<", no more linking error. Though I don't have a thorough explanation.
> 
> Does it mean I cannot use certain features in stdlib in hotspot? If so, which part (at least std namespace is not possible)?

Yeah it means you can't use most of C++. Really hotspot uses C++ as a 
basic "C with classes". We don't support things like C++ exceptions or 
RTTI and probably other stuff; we don't use anything much from any of 
the C++ std libraries.

Inside the VM you should be using tty->print_cr(...) for output, or a 
raw printf for places where you can't use tty.

Cheers,
David

> Cheers,
> /Nhan
> 
>> -----Original Message-----
>> From: David Holmes [mailto:David.Holmes at oracle.com]
>> Sent: Tuesday, June 14, 2011 1:21 PM
>> To: Dang Nhan Nguyen
>> Cc: build-dev at openjdk.java.net
>> Subject: Re: Build openjdk7/hotspot error while linking,
>>
>> Sorry never seen this, or heard of this one, when building hotspot. I
>> suggest comparing that build instructions used when building the whole
>> JDK with those building Hotspot by itself.
>>
>> David Holmes
>>
>> Dang Nhan Nguyen said the following on 06/14/11 20:01:
>>> Hi All,
>>>
>>> I have successfully built the whole Openjdk7/JVM (b121) on an
>>> platform with amd64/Ubuntu/Gcc 4.4.3. I try to build hotspot alone on
>>> the same machine.
>>>
>>> ALT_OUTPUTDIR=../../build/hotspot_product ARCH_DATA_MODEL=64 make
>>> product 2>&1 | tee ../../build/hotspot_product.log
>>>
>>> The building process go well, but the linking process has a error
>>> like this:
>>>
>>> Linking vm... /usr/bin/ld:
>>> /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.a(ctype.o): relocation
>>> R_X86_64_32S against `vtable for std::ctype<wchar_t>' can not be used
>>> when making a shared object; recompile with -fPIC
>>> /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.a: could not read
>>> symbols: Bad value collect2: ld returned 1 exit status
>>>
>>> I try some time but have not solved it successfully. Could anybody
>>> hint me what is the actual problem and how to solve it?
>>>
>>>
>>> Thank you, --Nhan Nguyen



More information about the build-dev mailing list