jdk8 extra c/cxx - flags settings

Erik Joelsson erik.joelsson at oracle.com
Mon Nov 25 09:36:56 UTC 2013


On 2013-11-25 03:01, David Holmes wrote:
> Hi Matthias,
>
> On 22/11/2013 10:55 PM, Baesken, Matthias wrote:
>>
>> I had the need for setting additional C/C++ compilation flags in my 
>> OpenJDK8 build.
>> It seems they are used for most jdk C/C++ compilation, but at least 
>> the generators from
>>
>> jdk/makefiles/gensrc/GensrcMisc.gmk
>>
>> seem to be an exception.
>
> The "extra flags' variables are intended for use when compiling the 
> actual JDK sources, not for compiling auxiliary tools used during the 
> build process. There is currently no means, that I am aware of, to 
> customize those invocations.
>
> To expand further on this the primary role of the "extra flags" is to 
> provide values needed for cross-compilation of the JDK sources. I'm 
> sure you can see that it wouldn't make sense to pass cross-compiler 
> options to the compilation of the build tools on the host build machine.
>
David is correct, these tools are handled differently due to being 
compiled by the "build" compiler rather than the "target" compiler when 
cross compiling. We haven't had the need to customize the compiler or 
link args for these yet, but I don't see why there shouldn't be a 
variable from configure that that would enable customization.

/Erik
> David
> -----
>
>> Example :
>>
>> configure --with-extra-cflags=-DTESTMYEXTRAFLAGC 
>> --with-extra-cxxflags=-DTESTMYEXTRAFLAGCXX
>>
>> does not lead to the expected flags in the build for 
>> genSocketOptionRegistry.c  :
>>
>> ...
>> /usr/local/bin/gcc  -DTHIS_FILE='"genSocketOptionRegistry.c"' -c -MMD 
>> -MF 
>> /mydir/open_jdk/jdk8/linuxx86_64_opt/jdk/gensrc/genSocketOptionRegistry/genSocketOptionRegistry.d
>> -o 
>> /mydir/open_jdk/jdk8/linuxx86_64_opt/jdk/gensrc/genSocketOptionRegistry/genSocketOptionRegistry.o 
>> /mydir/open_jdk/jdk8/openjdk8/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c 
>>
>> ...
>>
>> (while the flags show up for "normal" C/C++ files .)
>>
>> Is there another option (available  /   planned?) to configure the 
>> extra C/C++ compile flags for this special case ?
>>
>>
>> Thanks,
>>         Matthias
>>




More information about the build-dev mailing list