RFR: 8087156: SetupNativeCompilation ignores CFLAGS_release for cpp files

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Fri Jun 12 13:04:29 UTC 2015

On 2015-06-11 08:51, Erik Joelsson wrote:
> Hello Omair,
> This looks good to me, thanks for catching it!
Looks good to me too.

However, this is not the first time we've encountered a problem like 
this. I ran into a similar problem some time ago. It's a very brittle 
system we have. I believe we should get rid of the CXXFLAGS and just 
have CFLAGS and let them cover c++ compilation as well.

Do we have use cases where C and C++ both are used in the same library, 
and requires different flags?


> /Erik
> On 2015-06-11 00:36, Omair Majid wrote:
>> Hi,
>> I discovered a bug in SetupNativeCompilation that results in some C++
>> code being built with wrong CXXFLAGS.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8087156
>> Webrev: 
>> http://cr.openjdk.java.net/~omajid/webrevs/8087156-setupnativecompilation/00/
>> It turns out that debugging flags are automatically added to the
>> CXXFLAGS which makes the code that copies over CFLAGS to CXXFLAGS if
>> CXXFLAGS is empty fail. This causes the desired CXXFLAGS to not be set
>> at all.
>> Depending on the code, these CXXFLAGS can include -DPRODUCT. In other
>> words, some JDK code is currently being built as if in non-product mode.
>> An example of this is libunpack:
>> jdk/make/lib/Lib-jdk.pack200.gmk:
>> $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
>>      ... snip ...
>>      CFLAGS_release := -DPRODUCT, \
>>      ... snip ...
>> The same issue exists in OpenJDK 8.
>> Thanks,
>> Omair

More information about the build-dev mailing list