Bug 11906 - rpmbuild: Can not build packages on qemu target
Summary: rpmbuild: Can not build packages on qemu target
Status: RESOLVED WONTFIX
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 2.4
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 4.0 M1
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-08-08 02:49 UTC by Jackie Huang
Modified: 2021-09-20 22:59 UTC (History)
9 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jackie Huang 2017-08-08 02:49:14 UTC
I tried to build a SRPM from fedora but failed with:

=============
checking for gcc... gcc
checking whether the C compiler (gcc %optflags ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
error: Bad exit status from /var/tmp/rpm-tmp.mcuBTq (%build)

RPM build errors:
    Could not canonicalize hostname: qemux86-64
    Bad exit status from /var/tmp/rpm-tmp.mcuBTq (%build)
============

Steps to reproduce:
1) add in local.conf:
IMAGE_INSTALL_append += "packagegroup-core-buildessential"

2) build sato image:
bitbake core-image-sato

3) start qemu:
runqemu qemux86-64 nographic

4) get srpm from fedora and try to build:

root@qemux86-64:~# wget http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/source/SRPMS/d/daemonize-1.7.3-7.fc22.src.rpm

root@qemux86-64:~# rpm -ivh daemonize-1.7.3-7.fc22.src.rpm
warning: daemonize-1.7.3-7.fc22.src.rpm: Header V3 RSA/SHA256 Signature, key ID 8e1431d5: NOKEY
Updating / installing...
   1:daemonize-1.7.3-7.fc22           warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
################################# [100%]

root@qemux86-64:~# rpmbuild -ba -v rpmbuild/SPECS/daemonize.spec
warning: Could not canonicalize hostname: qemux86-64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.5GlH38
+ umask 022
+ cd /home/root/rpmbuild/BUILD
+ cd /home/root/rpmbuild/BUILD
+ rm -rf bmc-daemonize-8c9856b
+ /bin/gzip -dc /home/root/rpmbuild/SOURCES/daemonize-1.7.3.tar.gz
+ /bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd bmc-daemonize-8c9856b
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.mcuBTq
+ umask 022
+ cd /home/root/rpmbuild/BUILD
+ cd bmc-daemonize-8c9856b
+ CFLAGS=%optflags
+ export CFLAGS
+ CXXFLAGS=%optflags
+ export CXXFLAGS
+ FFLAGS=%optflags
+ export FFLAGS
+ ./configure --host=x86_64-poky-linux-gnu --build=x86_64-poky-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/usr/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc %optflags ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
error: Bad exit status from /var/tmp/rpm-tmp.mcuBTq (%build)


RPM build errors:
    Could not canonicalize hostname: qemux86-64
    Bad exit status from /var/tmp/rpm-tmp.mcuBTq (%build)
Comment 1 Jackie Huang 2017-08-08 02:57:26 UTC
If I change the platform as the following, it builds with some warnings:
root@qemux86-64:~# diff /etc/rpm/platform_orig /etc/rpm/platform
1c1
< qemux86_64-pc-linux
---
> x86_64-pc-linux

root@qemux86-64:~# rpmbuild -ba -v rpmbuild/SPECS/daemonize.spec
sh: line 1: /usr/bin/getconf: No such file or directory
sh: line 4: [: : integer expression expected
warning: Could not canonicalize hostname: qemux86-64
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wD5ziH

(...detail logs omitted...)

+ umask 022
+ cd /home/root/rpmbuild/BUILD
+ cd bmc-daemonize-8c9856b
+ rm -rf /home/root/rpmbuild/BUILDROOT/daemonize-1.7.3-7.x86_64
+ exit 0

root@qemux86-64:~# ls rpmbuild/RPMS/x86_64/daemonize-1.7.3-7.x86_64.rpm
rpmbuild/RPMS/x86_64/daemonize-1.7.3-7.x86_64.rpm

root@qemux86-64:~# rpm -ivh rpmbuild/RPMS/x86_64/daemonize-1.7.3-7.x86_64.rpm
error: Failed dependencies:
        libc.so.6()(64bit) is needed by daemonize-1.7.3-7.x86_64
        libc.so.6(GLIBC_2.2.5)(64bit) is needed by daemonize-1.7.3-7.x86_64
Comment 2 Randy MacLeod 2017-08-08 15:08:43 UTC
I updated the title to indicate that the first problem encountered is qemu specific.

Given that we don't have the right libc to allow building a fedora22 src.rpm, I'd suggest that the right solution there would be to install a fedora22 container.

Jackie, 
   Can you try building a src.rpm for a newer fedora where libc versions match?
Comment 3 Mark Hatle 2017-08-08 15:19:33 UTC
Randy, the request is the ability to use the natively provided RPM resources on the target.

In this case, the failures are due to RPM(4) setup, including:

* Hostname issue:
warning: Could not canonicalize hostname: qemux86-64

* Invalid calls:
sh: line 1: /usr/bin/getconf: No such file or directory
sh: line 4: [: : integer expression expected

* Missing/incorrect RPM macro definitions:
(optflags is not defined)
+ CFLAGS=%optflags
+ export CFLAGS
+ CXXFLAGS=%optflags
+ export CXXFLAGS
+ FFLAGS=%optflags
+ export FFLAGS

I'm sure we will encounter other issues, but at this time it's not related to the compiler, libc.  Once we can get through the initial RPM configuration and rpmbuild runtime issues -- then we can focus on compilation problems.  (If we do encounter fedora or similar specific issues -- this won't be a Yocto Project bug any longer IMHO.)
Comment 4 Randy MacLeod 2017-08-08 18:49:46 UTC
I assumed that the libc version mismatch was coming from the src.rpm but maybe it isn't. Jackie can investigate a little but if there is a huge number of tricky dependencies to fix, it's tempting to leave this to 2.5. Keep us posted please Jackie.
Comment 5 Mark Hatle 2017-08-08 18:57:31 UTC
The libc dependencies may be a different bug.

RPM5 properly recorded the RPM dependencies during the build process.  Early on in the RPM4 work it was shown this was missing, but was supposed to have been corrected by the time Pyro (2.3) was released.

The easiest way to check:

rpm -q <libc providing package> --provides

You SHOULD see things like:

libc.so.6()(64bit)

if you do not, then we have a significantly more serious bug.  (Which should be opened as a new defect.)
Comment 6 Alexander Kanavin 2017-08-08 19:48:32 UTC
I'm not sure why not being able to build srpms from foreign linux distros is seen as a bug. We never claimed to support it, and there's far too many things that can go wrong and other mismatches in spec files and elsewhere.

I can see how getting Fedora software into a Yocto image without having to write Yocto recipes can be useful, but making it work reliably is a major task, and too big for a bugzilla ticket IMO.
Comment 7 Mark Hatle 2017-08-08 20:03:47 UTC
Being able to build SRPMs is a feature that a lot of people want.

being able to start with a Fedora (or similar) SRPM is strongly desired as it lowers the barrier for most people to add something quickly to their system.  I do not expect the pieces of software to work without any modifications.. but if the modifications are minor this certainly simplifies things.

Issues like incorrect dependencies (if that is indeed a problem) is different from 'Yocto Project uses a different name' issues.

Similarly around path differences and such.  All of those, I would expect the person trying to make it work to have to 'do something' to resolve.


But macro definitions, default dependency settings, etc should all be there, and did work in the past.

This bug is about being able to build -an- SRPM.  The example happens to be a Fedora SRPM, but at this point it doesn't matter if it's Fedora or something else.

The various pieces of an SRPM spec file need to function properly, including the machine/hostname identification, optflags, calls to external utilities (made by RPM, not the package), and dependencies automatically instantiated by RPM's rpmbuild.

If this basic functionality does not work, then there is a gap in the configuration of RPM4.  (Each of those did work with RPM5 before.)
Comment 8 Alexander Kanavin 2017-08-09 04:59:49 UTC
Fair enough, but then you should be not be starting with a Fedora srpm. Take a srpm produced from an oe-core recipe via archiver.bbclass and make that work first.
Comment 9 Randy MacLeod 2021-03-09 19:26:57 UTC
Its an enhancement so move to 3.4M1.
Comment 10 Richard Purdie 2021-09-20 22:59:50 UTC
I'm not aware of anyone left who wants to work on this. Closing as something we don't plan to do.