On Tue, Apr 15, 2025 at 05:53:36PM +0000, Gary Buhrmaster wrote:
> On Tue, Apr 15, 2025 at 4:10 PM Daniel P. Berrangé <berra...@redhat.com> 
> wrote:
> 
> > Can we just stop building for i686 in Fedora in general, instead of burning
> > maintainer time figuring out deps problems like this... ? What's the
> > blocker and how much longer do we have to put up with its burden in Fedora ?
> 
> Was there not a proposal (or probably less
> than a proposal, a suggestion?), that i686
> builds could be changed to being opt-in
> (rather than opt-out), such that the various
> libraries that need to be multilib (for
> "reasons") would be the primary ones
> built on i686?  I think it was abandoned
> due to the complexity of builds and
> QA testing without quite a lot of packages
> being available but maybe it needs to be
> revisited?  While Fedora is not RHEL, as
> I recall, RHEL10 is intending to drop
> multilib support (so vendors still using
> 32-bit libraries presumably should have
> gotten the word the time is now for
> moving to 64-bit libraries).

Similar to this, I was wondering if it's possible to build i686
libraries as subpackages of regular x86_64 builds.  This would be
analogous to how we currently build mingw-* packages as subpackages of
some main libraries like gnutls.

I picked hivex, a small C library, for my test.  The changes needed to
build new subpackages called:

- hivex-libs-i686-1.3.24-4.fc43.x86_64.rpm
- hivex-devel-i686-1.3.24-4.fc43.x86_64.rpm

are attached.

Some problems ...

- RPM gives these warnings:

    /home/rjones/d/fedora/hivex/rawhide/hivex.spec line 232: autopatch: no 
matching patches in range
    Binaries arch (1) not matching the package arch (2).
    Binaries arch (1) not matching the package arch (2).

- RPM doesn't let you force the BuildArch to i686.

- The subpackages obviously have the wrong names.

- The Provides of the new packages are a bit wrong (fixable?)

- The debuginfo is probably wrong.

It doesn't look like it's that far from working, but seems like it
would need some changes to our RPM macros at the very least.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
diff --git a/hivex.spec b/hivex.spec
index 2f21f66..fb47afe 100644
--- a/hivex.spec
+++ b/hivex.spec
@@ -61,6 +61,11 @@ BuildRequires:  rubygem(minitest)
 BuildRequires:  rubygem(rdoc)
 BuildRequires:  readline-devel
 BuildRequires:  libxml2-devel
+%ifarch x86_64
+BuildRequires:  glibc-devel(x86-32)
+BuildRequires:  readline-devel(x86-32)
+BuildRequires:  libxml2-devel(x86-32)
+%endif
 %if 0%{verify_tarball_signature}
 BuildRequires:  gnupg2
 %endif
@@ -124,6 +129,30 @@ Requires:       pkgconfig
 for %{name}.
 
 
+%ifarch x86_64
+%package libs-i686
+Summary:        Library for %{name}
+License:        LGPL-2.1-only AND LGPL-2.0-or-later
+Conflicts:      %{name} < 1.3.20-6
+Obsoletes:      %{name} < 1.3.20-6
+
+
+%description libs-i686
+%{name}-libs contains the library for %{name}.
+
+
+%package devel-i686
+Summary:        Development tools and libraries for %{name}
+Requires:       %{name}-libs = %{version}-%{release}
+Requires:       pkgconfig
+
+
+%description devel-i686
+%{name}-devel contains development tools and libraries
+for %{name}.
+%endif
+
+
 %if !0%{?rhel}
 %package static
 Summary:        Statically linked library for %{name}
@@ -206,6 +235,9 @@ autoreconf -fi
 
 
 %build
+mkdir native_build
+pushd native_build
+%global _configure ../configure
 %configure \
     PYTHON=%{__python3} \
 %if !%{with ocaml}
@@ -216,10 +248,27 @@ autoreconf -fi
 %endif
     %{nil}
 make V=1 INSTALLDIRS=vendor %{?_smp_mflags}
+popd
+
+%ifarch x86_64
+mkdir i686-build
+pushd i686-build
+%configure \
+    --disable-ocaml --disable-perl --disable-python --disable-ruby \
+    --disable-static \
+    CFLAGS="-m32"
+make V=1 INSTALLDIRS=vendor %{?_smp_mflags}
+popd
+%endif
 
 
 %install
-make install DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor
+make install DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor -C native_build
+%ifarch x86_64
+make install DESTDIR=$RPM_BUILD_ROOT INSTALLDIRS=vendor \
+     libdir=%{_prefix}/lib \
+     -C i686-build
+%endif
 
 # Remove unwanted libtool *.la file:
 rm $RPM_BUILD_ROOT%{_libdir}/libhivex.la
@@ -236,6 +285,7 @@ rm $RPM_BUILD_ROOT%{python3_sitearch}/libhivexmod.la
 
 
 %check
+pushd native_build
 if ! make check -k; then
     for f in $( find -name test-suite.log | xargs grep -l ^FAIL: ); do
         echo
@@ -245,6 +295,8 @@ if ! make check -k; then
     done
     exit 1
 fi
+popd
+
 
 %files -f %{name}.lang
 %doc README.md
@@ -271,6 +323,20 @@ fi
 %{_libdir}/pkgconfig/hivex.pc
 
 
+%ifarch x86_64
+%files libs-i686
+%doc README.md
+%license LICENSE
+%{_prefix}/lib/libhivex.so.*
+
+
+%files devel-i686
+%license LICENSE
+%{_prefix}/lib/libhivex.so
+%{_prefix}/lib/pkgconfig/hivex.pc
+%endif
+
+
 %if !0%{?rhel}
 %files static
 %license LICENSE
-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to