ibmruntimes / openj9-openjdk-jdk

Extensions for OpenJDK for Eclipse OpenJ9
GNU General Public License v2.0
17 stars 73 forks source link

Export VS library when building OpenJCEPlus #835

Closed taoliult closed 1 week ago

taoliult commented 1 week ago

This commit fixes the “cannot open file 'LIBCMT.lib’” issue when compiling the OpenJCEPlus native codes with Semeru on Windows platform.

taoliult commented 1 week ago

After testing, I found this change only works for JDK23 Windows build. Builds links below.

https://hyc-runtimes-jenkins.swg-devops.com/job/Build_JDK23_x86-64_windows_Personal/36/ https://hyc-runtimes-jenkins.swg-devops.com/job/Build_JDK23_x86-64_windows_Personal/39/

From the logs I can see the following output. And also I can see the library file generated in the Bin folder.

[2024-09-01T04:13:50.441Z] Microsoft (R) Incremental Linker Version 14.40.33811.0
[2024-09-01T04:13:50.441Z] Copyright (C) Microsoft Corporation.  All rights reserved.
[2024-09-01T04:13:50.441Z] 
[2024-09-01T04:13:50.441Z] Updating images/sec-bin.zip
[2024-09-01T04:13:50.441Z]    Creating library ..\..\..\target\buildwin\host64\libjgskit_64.lib and object ..\..\..\target\buildwin\host64\libjgskit_64.exp
[2024-09-01T04:13:51.064Z] OpenJCEplus compile complete

But when running the JDK21, 17 and 11 Windows build, this change won’t work. And the library file can’t be generated, builds links and output below. For JDK21, 17 and 11 Windows build, without this change, the build work fine.

https://hyc-runtimes-jenkins.swg-devops.com/job/Build_JDK21_x86-64_windows_Personal/294/ https://hyc-runtimes-jenkins.swg-devops.com/job/Build_JDK17_x86-64_windows_Personal/787/ https://hyc-runtimes-jenkins.swg-devops.com/job/Build_JDK11_x86-64_windows_Personal/1712/

[2024-08-31T00:17:03.434Z] Microsoft (R) Incremental Linker Version 14.40.33811.0
[2024-08-31T00:17:03.434Z] Copyright (C) Microsoft Corporation.  All rights reserved.
[2024-08-31T00:17:03.434Z] 
[2024-08-31T00:17:03.434Z] LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
[2024-08-31T00:17:03.434Z] OpenJCEplus compile complete
taoliult commented 1 week ago

Found the commit on JDKNext and JDK23, link below, related to the LIB='$(OPENJ9_VS_LIB)’, the export of the VS library.

https://github.com/ibmruntimes/openj9-openjdk-jdk/commit/102d7524fd365af37ad14f4fef5154e6f4802762#diff-c48d2557c6bf74adf1551b53a30cbd65972e46627cc3b619bea5a0ae3c168565R113

https://github.com/ibmruntimes/openj9-openjdk-jdk23/commit/102d7524fd365af37ad14f4fef5154e6f4802762#diff-c48d2557c6bf74adf1551b53a30cbd65972e46627cc3b619bea5a0ae3c168565R113

This commit only applied to JDK23 and JDKNext, it did not applied to JDK21 and earlier versions. So, I think this explains why this LIB='$(OPENJ9_VS_LIB)’ only works for JDK23 build. And I don’t think we need to back-port this PR to JDK21 or any earlier versions.

keithc-ca commented 1 week ago

The openjdk makefiles are organized differently in versions prior to jdk23: LIB is already exported in those versions so no change should be necessary for those versions. (See, for example, custom-spec.gmk.in from jdk21).

keithc-ca commented 1 week ago

Jenkins line endings check