#33 Build static-libs-image and add resulting files via -static-libs sub-package.
Merged 3 years ago by jvanek. Opened 3 years ago by jvanek.
Unknown source static-libs  into  master

file modified
+75 -6
@@ -20,6 +20,9 @@

  # Enable release builds by default on relevant arches.

  %bcond_without release

  

+ # Workaround for stripping of debug symbols from static libraries

+ %define __brp_strip_static_archive %{nil}

+ 

  # The -g flag says to use strip -g instead of full strip on DSOs or EXEs.

  # This fixes detailed NMT and other tools which need minimal debug info.

  # See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879
@@ -143,12 +146,12 @@

  %endif

  

  %if %{bootstrap_build}

- %global release_targets bootcycle-images docs-zip

+ %global release_targets bootcycle-images static-libs-image docs-zip

  %else

- %global release_targets images docs-zip

+ %global release_targets images docs-zip static-libs-image

  %endif

  # No docs nor bootcycle for debug builds

- %global debug_targets images

+ %global debug_targets images static-libs-image

  

  

  # Filter out flags from the optflags macro that cause problems with the OpenJDK build
@@ -242,7 +245,7 @@

  %global top_level_dir_name   %{origin}

  %global minorver        0

  %global buildver        36

- %global rpmrelease      2

+ %global rpmrelease      3

  # priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit

  %if %is_system_jdk

  %global priority %( printf '%02d%02d%02d%02d' %{majorver} %{minorver} %{securityver} %{buildver} )
@@ -291,8 +294,9 @@

  # parametrized macros are order-sensitive

  %global compatiblename  java-%{majorver}-%{origin}

  %global fullversion     %{compatiblename}-%{version}-%{release}

- # images stub

- %global jdkimage       jdk

+ # images directories from upstream build

+ %global jdkimage                jdk

+ %global static_libs_image       static-libs

  # output dir stub

  %define buildoutputdir() %{expand:openjdk/build%{?1}}

  # we can copy the javadoc to not arched dir, or make it not noarch
@@ -829,6 +833,10 @@

  %{_jvmdir}/%{sdkdir -- %{?1}}/lib/src.zip

  }

  

+ %define files_static_libs() %{expand:

+ %{_jvmdir}/%{sdkdir -- %{?1}}/lib/static/linux-%{archinstall}/glibc/lib*.a

+ }

+ 

  %define files_javadoc() %{expand:

  %doc %{_javadocdir}/%{uniquejavadocdir -- %{?1}}

  %license %{buildoutputdir -- %{?1}}/images/%{jdkimage}/legal
@@ -931,6 +939,11 @@

  %endif

  }

  

+ %define java_static_libs_rpo() %{expand:

+ Requires:         %{name}-devel%{?1}%{?_isa} = %{epoch}:%{version}-%{release}

+ OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release}

+ }

+ 

  %define java_jmods_rpo() %{expand:

  # Requires devel package

  # as jmods are bytecode, they should be OK without any _isa
@@ -1210,6 +1223,38 @@

  %endif

  

  %if %{include_normal_build}

+ %package static-libs

+ Summary: %{origin_nice} libraries for static linking %{majorver}

+ 

+ %{java_static_libs_rpo %{nil}}

+ 

+ %description static-libs

+ The %{origin_nice} libraries for static linking %{majorver}.

+ %endif

+ 

+ %if %{include_debug_build}

+ %package static-libs-slowdebug

+ Summary: %{origin_nice} libraries for static linking %{majorver} %{debug_on}

+ 

+ %{java_static_libs_rpo -- %{debug_suffix_unquoted}}

+ 

+ %description static-libs-slowdebug

+ The %{origin_nice} libraries for static linking %{majorver}.

+ %{debug_warning}

+ %endif

+ 

+ %if %{include_fastdebug_build}

+ %package static-libs-fastdebug

+ Summary: %{origin_nice} libraries for static linking %{majorver} %{fastdebug_on}

+ 

+ %{java_static_libs_rpo -- %{fastdebug_suffix_unquoted}}

+ 

+ %description static-libs-fastdebug

+ The %{origin_nice} libraries for static linking %{majorver}.

+ %{fastdebug_warning}

+ %endif

+ 

+ %if %{include_normal_build}

  %package jmods

  Summary: JMods for %{origin_nice} %{majorver}

  
@@ -1565,6 +1610,11 @@

  $JAVA_HOME/bin/javac -d . %{SOURCE14}

  $JAVA_HOME/bin/java $(echo $(basename %{SOURCE14})|sed "s|\.java||")

  

+ # Check debug symbols in static libraries (smoke test)

+ export STATIC_LIBS_HOME=$(pwd)/%{buildoutputdir -- $suffix}/images/%{static_libs_image}

+ readelf --debug-dump $STATIC_LIBS_HOME/lib/libfdlibm.a | grep w_remainder.c

+ readelf --debug-dump $STATIC_LIBS_HOME/lib/libfdlibm.a | grep e_remainder.c

+ 

  # Check debug symbols are present and can identify code

  find "$JAVA_HOME" -iname '*.so' -print0 | while read -d $'\0' lib

  do
@@ -1708,6 +1758,10 @@

    rm -rf $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/man

  

  popd

+ # Install static libs artefacts

+ mkdir -p $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/lib/static/linux-%{archinstall}/glibc

+ cp -a %{buildoutputdir -- $suffix}/images/%{static_libs_image}/lib/*.a \

+   $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/lib/static/linux-%{archinstall}/glibc

  

  if ! echo $suffix | grep -q "debug" ; then

    # Install Javadoc documentation
@@ -1912,6 +1966,9 @@

  %files devel

  %{files_devel %{nil}}

  

+ %files static-libs

+ %{files_static_libs %{nil}}

+ 

  %files jmods

  %{files_jmods %{nil}}

  
@@ -1941,6 +1998,9 @@

  %files devel-slowdebug

  %{files_devel -- %{debug_suffix_unquoted}}

  

+ %files static-libs-slowdebug

+ %{files_static_libs -- %{debug_suffix_unquoted}}

+ 

  %files jmods-slowdebug

  %{files_jmods -- %{debug_suffix_unquoted}}

  
@@ -1961,6 +2021,9 @@

  %files devel-fastdebug

  %{files_devel -- %{fastdebug_suffix_unquoted}}

  

+ %files static-libs-fastdebug

+ %{files_static_libs -- %{fastdebug_suffix_unquoted}}

+ 

  %files jmods-fastdebug

  %{files_jmods -- %{fastdebug_suffix_unquoted}}

  
@@ -1973,6 +2036,12 @@

  %endif

  

  %changelog

+ * Fri Oct 09 2020 Jiri Vanek <jvanek@redhat.com> - 1:15.0.0.36-3.rolling

+ - Build static-libs-image and add resulting files via -static-libs sub-package.

+ - Disable stripping of debug symbols for static libraries part of the -static-libs sub-package.

+ - JDK-8245832 increases the set of static libraries, so try and include them all with a wildcard.

+ - Update static-libs packaging to new layout

+ 

  * Mon Sep 21 2020 Petra Alice Mikova <pmikova@redhat.com> - 1:15.0.0.36-2.rolling

  - Add support for fastdebug builds on 64 bit architectures

  

Note that the missing wildcard fix failed the build.

rebased onto 1d08030e7ed2bfb4f9f86346e57ac03ea3b3134d

3 years ago

hmm passed. the sizes of static libs are weird:
18394778 java-latest-openjdk-static-libs-15.0.0.36-3.rolling.fc34.x86_64.rpm
17612574 java-latest-openjdk-static-libs-fastdebug-15.0.0.36-3.rolling.fc34.x86_64.rpm
11441797 java-latest-openjdk-static-libs-slowdebug-15.0.0.36-3.rolling.fc34.x86_64.rpm

I would expect slow>fast>released. Any ideas?

That is weird indeed.

Otherwise, looks okay to me.

Thanks!

Please use your name here as you've done the work.

rebased onto 4848b86

3 years ago

Pull-Request has been merged by jvanek

3 years ago

hmm passed. the sizes of static libs are weird:
18394778 java-latest-openjdk-static-libs-15.0.0.36-3.rolling.fc34.x86_64.rpm
17612574 java-latest-openjdk-static-libs-fastdebug-15.0.0.36-3.rolling.fc34.x86_64.rpm
11441797 java-latest-openjdk-static-libs-slowdebug-15.0.0.36-3.rolling.fc34.x86_64.rpm

I would expect slow>fast>released. Any ideas?

Not necessarily. A couple of comments:

  • There is no stripping of debugsymbols being done for all of them.
  • release build is essentially -O3 with -g, fastdebug is -O3 with -g and -DASSERT, slowdebug is -O0 with -g and -DASSERT
  • For highly optimized code more functions might get inlined increasing overall code size. They have to be kept around since no linking stage happens.

If I had to guess it's probably because of the different optimization levels and -DASSERT causing different inlining decisions by the compiler.

interesting. thank you very much for insight. Shamefully inlining have not crossed my mind. thanx!