Skip to content

Build improvement for OpenJDK 17/21 #1593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion SPECS/openjdk/openjdk17.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Summary: OpenJDK
Name: openjdk17
Version: 17.0.14
Release: 1%{?dist}
Release: 2%{?dist}
URL: https://github.com/openjdk/jdk17u
Group: Development/Tools
Vendor: VMware, Inc.
Expand Down Expand Up @@ -98,6 +98,7 @@ chmod a+x ./configur*
unset JAVA_HOME
ENABLE_HEADLESS_ONLY="true"

%ifarch aarch64
sh ./configur* \
--with-target-bits=64 \
--enable-headless-only \
Expand All @@ -107,6 +108,18 @@ sh ./configur* \
--with-freetype-lib=%{_libdir} \
--with-stdc++lib=dynamic \
--disable-warnings-as-errors
%else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this will suffice for both aarch64 and x86_64 without code duplication and condition checking.

sh ./configur* \
    --with-target-bits=64 \
    --enable-headless-only \
    --with-extra-cxxflags="-Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse" \
    --with-extra-cflags="-fno-delete-null-pointer-checks -Wno-error -fno-lifetime-dse" \
    --with-freetype-include=%{_includedir}/freetype2 \
    --with-freetype-lib=%{_libdir} \
    --with-stdc++lib=dynamic \
    --build=%{_build} \
    --disable-warnings-as-errors

Reference: https://github.com/rpm-software-management/rpm/blob/master/macros.in#L1066

Please give this a try. Thanks for your contribution and continues engagement to make our product better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Photon OS on any non-VMware hypervisor is often not recognized. That's a main challenge.
Previously, #1542 was the intention so get solved.
E.g. for cloud-init, dark2phoenix took the extra mile in canonical/cloud-init#5077. That was a year ago, and the time to get it done wasn't little.
A code snippet for on aarch64 and x86_64 without code duplication and condition checking is best, no doubt.

I have to test a few things first and will come back.

sh ./configur* \
--with-target-bits=64 \
--enable-headless-only \
--with-extra-cxxflags="-Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse" \
--with-extra-cflags="-fno-delete-null-pointer-checks -Wno-error -fno-lifetime-dse" \
--with-freetype-include=%{_includedir}/freetype2 \
--with-freetype-lib=%{_libdir} \
--with-stdc++lib=dynamic \
--build=x86_64-unknown-linux-gnu \
--disable-warnings-as-errors
%endif

mkdir -p %{_datadir}/java
# make doesn't support _smp_mflags
Expand Down Expand Up @@ -243,6 +256,8 @@ rm -rf %{buildroot}/* %{_libdir}/jvm/OpenJDK-*
%{_libdir}/jvm/OpenJDK-%{jdk_major_version}/lib/src.zip

%changelog
* Sun Feb 09 2025 Daniel Casota <[email protected]> 17.0.14-2
- See https://github.com/vmware/photon/issues/1588
* Wed Jan 22 2025 Shreenidhi Shedi <[email protected]> 17.0.14-1
- Upgrade to v17.0.14
* Mon Dec 16 2024 Brennan Lamoreaux <[email protected]> 17.0.8-3
Expand Down