JDK-8241400 : [macos] jpackageapplauncher/main.m built using CXXFLAGS_JDKEXE
  • Type: Bug
  • Component: tools
  • Sub-Component: jpackage
  • Affected Version: 15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2020-03-21
  • Updated: 2020-04-07
  • Resolved: 2020-03-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b17Fixed
Related Reports
Relates :  
Description
The jpackage build support in Lib-jdk.incubator.jpackage.gmk sets the CFLAGS for building the applauncher to CXXFLAGS_JDKEXE, so using options for compiling C++ code.  However, the MacOSX applauncher is written in Objective-C, which may lead to rejection of C++ options.  In particular, if the -std= option is present it will be rejected and the build will fail.

The -std= option ought to be specified for all C++ processing (both compiling and linking), to avoid potential inconsistencies.  The use of CXXFLAGS_JDKEXE when compiling Objective-C code prevents fixing some places where the -std= option is missing.

Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/6c01f2c60622 User: herrick Date: 2020-03-27 15:49:00 +0000
27-03-2020

ok - webrev: http://cr.openjdk.java.net/~herrick/8241400/webrev.01/
26-03-2020

The suggested solution looks good and is actually how it should be handled. Regarding CXXFLAGS_windows. The CXXFLAGS parameter to SetupNativeCompilation only needs to be used if you need a different set of flags for C++ files specifically. Otherwise it will fall back on CFLAGS. Same goes for CXXFLAGS_<os> vs CFLAGS_<os>. So in this case, it doesn't matter unless the library contains both C and C++ source files and those flags specifically need to only apply to the C++ source files.
26-03-2020

Unrelated to the macOSX problem, that snippet perhaps should have "CXXFLAGS_windows" instead of "CFLAGS_windows"?
26-03-2020

It seems that `clang -x objective-c` doesn't object to C options, including -std=c99. So I was able to "solve" the problem on MacOSX with the following change: diff -r 04f4357e1ce3 -r d18e304d46c6 make/lib/Lib-jdk.incubator.jpackage.gmk --- a/make/lib/Lib-jdk.incubator.jpackage.gmk Mon Mar 23 20:59:03 2020 -0400 +++ b/make/lib/Lib-jdk.incubator.jpackage.gmk Wed Mar 25 15:32:03 2020 -0400 @@ -59,7 +59,8 @@ SRC := $(JPACKAGE_APPLAUNCHER_SRC), \ TOOLCHAIN := TOOLCHAIN_LINK_CXX, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CXXFLAGS_JDKEXE), \ + CFLAGS := $(CFLAGS_JDKEXE), \ + CXXFLAGS := $(CXXFLAGS_JDKEXE), \ CFLAGS_windows := -EHsc -DLAUNCHERC -DUNICODE -D_UNICODE, \ LDFLAGS := $(LDFLAGS_JDKEXE), \ LIBS_macosx := -framework Cocoa, \ Note that I haven't tested this beyond trying a macosx build.
25-03-2020

This was discovered while working on JEP 347 (JDK-8208089) changes that require being more careful about using consistent -std= options.
21-03-2020