On Fri, Jun 27, 2025 at 01:37:13PM +0100, Richard W.M. Jones wrote:
> On Tue, Jun 24, 2025 at 12:19:47PM -0500, Chris Adams wrote:
> > Once upon a time, Richard W.M. Jones <rjo...@redhat.com> said:
> > > To make the discussion concrete, could you grab a list of the actual
> > > libraries that we're talking about here?  I'm interested in how hard
> > > it would be to adapt them to cross compilation as Dan mentioned upthread.
> > 
> > Just looking at a running copy of the Steam client, I see libs loaded
> > from a whole lot of packages.  I expect that some are loaded by others,
> > like I don't expect steam is actually using lm_sensors-libs itself.
> > 
> >    NetworkManager-libnm
> >    atk
> >    bzip2-libs
> 
> Thanks!  It's a lot of libraries.  I picked bzip2 at random as it's
> relatively simple and modified it so it cross-compiled to a 32 bit
> library.  The diff to the spec is attached.

And I should say this probably only works because I have glibc.i686
installed.  The packages would need to be modified & rebuilt in
dependency order starting with glibc.

Rich.

> Obviously this could either be done as a new, separate package, or as
> a subpackage of the existing bzip2 package.  (For mingw we're mixing
> both approaches.)
> 
> RPM complains about:
> 
>     Macro expanded in comment on line 10: %{version}/%{name}-%{version}.tar.gz
> 
>     Binaries arch (1) not matching the package arch (2).
>     Binaries arch (1) not matching the package arch (2).
> 
> I couldn't use 'BuildArch: i686' as I expected.  Apparently only
> 'BuildArch: noarch' works.  But surely this could be fixed somehow.
> 
> Cross-compiling _all_ of the packages in this way is going to be a
> fair bit of work.
> 
> Rich.
> 
> -- 
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> Fedora Windows cross-compiler. Compile Windows programs, test, and
> build Windows installers. Over 100 libraries supported.
> http://fedoraproject.org/wiki/MinGW

> diff --git a/bzip2.spec b/bzip2.spec
> index ca1b861..7a0baab 100644
> --- a/bzip2.spec
> +++ b/bzip2.spec
> @@ -1,4 +1,5 @@
>  %global library_version 1.0.8
> +%global _libdir32 %{_prefix}/lib
>  
>  Summary: File compression utility
>  Name: bzip2
> @@ -64,28 +65,28 @@ Static libraries for applications using the bzip2 
> compression format.
>  %patch -P3 -p2
>  
>  cp -a %{SOURCE1} .
> -sed -i "s|^libdir=|libdir=%{_libdir}|" bzip2.pc
> +sed -i "s|^libdir=|libdir=%{_libdir32}|" bzip2.pc
>  
>  %build
>  
>  %make_build -f Makefile-libbz2_so CC="%{__cc}" AR="%{__ar}" RANLIB="ranlib" \
> -    CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 -fpic -fPIC" \
> +    CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 -fpic -fPIC -m32" \
>      LDFLAGS="%{__global_ldflags}" \
>      all
>  
>  rm -f *.o
>  %make_build CC="%{__cc}" AR="%{__ar}" RANLIB="ranlib" \
> -    CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64" \
> +    CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 -m32" \
>      LDFLAGS="%{__global_ldflags}" \
>      all
>  
>  %install
>  chmod 644 bzlib.h
> -mkdir -p 
> $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{_libdir}/pkgconfig,%{_includedir}}
> +mkdir -p 
> $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{_libdir32}/pkgconfig,%{_includedir}}
>  cp -p bzlib.h $RPM_BUILD_ROOT%{_includedir}
> -install -m 755 libbz2.so.%{library_version} $RPM_BUILD_ROOT%{_libdir}
> -install -m 644 libbz2.a $RPM_BUILD_ROOT%{_libdir}
> -install -m 644 bzip2.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/bzip2.pc
> +install -m 755 libbz2.so.%{library_version} $RPM_BUILD_ROOT%{_libdir32}
> +install -m 644 libbz2.a $RPM_BUILD_ROOT%{_libdir32}
> +install -m 644 bzip2.pc $RPM_BUILD_ROOT%{_libdir32}/pkgconfig/bzip2.pc
>  install -m 755 bzip2-shared  $RPM_BUILD_ROOT%{_bindir}/bzip2
>  install -m 755 bzip2recover bzgrep bzdiff bzmore  $RPM_BUILD_ROOT%{_bindir}/
>  cp -p bzip2.1 bzdiff.1 bzgrep.1 bzmore.1  $RPM_BUILD_ROOT%{_mandir}/man1/
> @@ -95,8 +96,8 @@ ln -s bzdiff $RPM_BUILD_ROOT%{_bindir}/bzcmp
>  ln -s bzmore $RPM_BUILD_ROOT%{_bindir}/bzless
>  ln -s bzgrep $RPM_BUILD_ROOT%{_bindir}/bzegrep
>  ln -s bzgrep $RPM_BUILD_ROOT%{_bindir}/bzfgrep
> -ln -s libbz2.so.%{library_version} $RPM_BUILD_ROOT%{_libdir}/libbz2.so.1
> -ln -s libbz2.so.1 $RPM_BUILD_ROOT%{_libdir}/libbz2.so
> +ln -s libbz2.so.%{library_version} $RPM_BUILD_ROOT%{_libdir32}/libbz2.so.1
> +ln -s libbz2.so.1 $RPM_BUILD_ROOT%{_libdir32}/libbz2.so
>  ln -s bzip2.1 $RPM_BUILD_ROOT%{_mandir}/man1/bzip2recover.1
>  ln -s bzip2.1 $RPM_BUILD_ROOT%{_mandir}/man1/bunzip2.1
>  ln -s bzip2.1 $RPM_BUILD_ROOT%{_mandir}/man1/bzcat.1
> @@ -115,17 +116,17 @@ ln -s bzgrep.1 $RPM_BUILD_ROOT%{_mandir}/man1/bzfgrep.1
>  
>  %files libs
>  %license LICENSE
> -%{_libdir}/libbz2.so.1*
> +%{_libdir32}/libbz2.so.1*
>  
>  %files static
>  %license LICENSE
> -%{_libdir}/libbz2.a
> +%{_libdir32}/libbz2.a
>  
>  %files devel
>  %doc manual.html manual.pdf
>  %{_includedir}/*
> -%{_libdir}/*.so
> -%{_libdir}/pkgconfig/bzip2.pc
> +%{_libdir32}/*.so
> +%{_libdir32}/pkgconfig/bzip2.pc
>  
>  %changelog
>  * Thu Jan 16 2025 Fedora Release Engineering <rel...@fedoraproject.org> - 
> 1.0.8-20

> -- 
> _______________________________________________
> 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


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

-- 
_______________________________________________
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