Bug 237142

Summary: x86_64 mock can't build i386 SRPMs (doesn't read ~/.rpmmacros)
Product: [Retired] Fedora Hosted Projects Reporter: Carl Roth <roth>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: unspecifiedCC: dcantrell, nalin
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-04-22 16:04:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Carl Roth 2007-04-19 17:25:33 UTC
Description of problem:

My mock builds are failing with the error

error: cannot write to %sourcedir /usr/src/redhat/SOURCES

I'm trying to build i386 SRPMS on an x86_64 platform.  That is, I'm on an x86_64
host, and I'm using one of the i386 mock configurations.

I used the mock shell feature to try to interactively query the chroot
environment, and I determined that the 'rpm' command is not reading the
mockbuild's local '.rpmmacros' file, which is necessary to override the default
RPM %_topdir.

For example:

  $ mock ... shell

  mock-chroot> rpm --eval '%_topdir'
  /usr/src/redhat

  mock-chroot> export HOME=/builddir
  mock-chroot> rpm --eval '%_topdir'
  /usr/src/redhat
  ^^^^^^^^^^^^^^^

This second example should have printed out '/builddir/build' instead.

I tried debugging the rpm command (by installing 'gdb' and 'rpm-debuginfo.i386'
into the chroot), but gdb isn't able to run for mysterious reasons:

    thread_get_info_callback: cannot get thread info: generic error

Then I tried using 'strace' to see if the .rpmmacros file is getting read.  When
I run the command under strace I see that 1) the file is getting read in, and 2)
the *correct result* is being printed.  Yikes!

This is reproducable, even after a 'mock init' that rebuilds the chroot.

Version-Release number of selected component (if applicable):

mock-0.6.11-1.fc6

How reproducible:

Always

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Other configurations that I tested:

* an x86_64 host, running in an x86_64 chroot environment, works correctly.
* an i386 host, running in an i386 chroot environment, works correctly.

What's the story here?  Are x86_64/i386 cross-builds supported?

Comment 1 Nalin Dahyabhai 2007-04-20 20:07:21 UTC
I use mock from Raw Hide (the changelog suggests that the version skew doesn't
change this) like so:
  setarch i386 mock -r fedora-devel-i386-core src.rpm
and it works quite well.

Comment 2 Carl Roth 2007-04-22 16:04:16 UTC
Thanks for the tip.  I wasn't using 'setarch'; I was assuming that mock would do
the right thing and invoke it for me.  I guess that technically this is not a
bug as I have described it.