Bug 2142119
Summary: | gcc: fatal error: environment variable ‘RPM_ARCH’ not defined | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jun Aruga <jaruga> |
Component: | package-notes | Assignee: | Zbigniew Jędrzejewski-Szmek <zbyszek> |
Status: | CLOSED DUPLICATE | QA Contact: | |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 38 | CC: | fhrdina, ljavorsk, luca.boccassi, zbyszek |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2023-05-20 18:38:59 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jun Aruga
2022-11-11 16:58:09 UTC
Here is a minimal reproducer. ``` <mock-chroot> sh-5.2$ cat main.c int main(int argc, char *argv[]) { return 0; } <mock-chroot> sh-5.2$ rpm -q gcc gcc-12.2.1-3.fc38.x86_64 <mock-chroot> sh-5.2$ rpm -qf /usr/lib/rpm/redhat/redhat-package-notes package-notes-srpm-macros-0.5-6.fc38.noarch <mock-chroot> sh-5.2$ gcc -specs=/usr/lib/rpm/redhat/redhat-package-notes main.c gcc: fatal error: environment variable ‘RPM_ARCH’ not defined compilation terminated. ``` The reason why the `gem install byebug (a Ruby native extension)` is using the flags defined in the redhat-rpm-config macro is because Ruby language propagates the build flags to build the native extension gem package. I checked the document in the redhat-rpm-config, and maybe I found the workaround to avoid using `-specs=/usr/lib/rpm/redhat/redhat-package-notes`. But I want to know why this happens, and what I am missing. https://src.fedoraproject.org/rpms/redhat-rpm-config//blob/rawhide/f/buildflags.md - Package note on ELF objects ``` %undefine _package_note_file ``` > Steps to Reproduce:
> 1. Build ruby.spec on the https://src.fedoraproject.org/rpms/ruby/tree/private-ruby-3.2 .
> 2. Install the built RPMs.
> 3. Run the `gem install byebug` on the mock environment by a user "mockbuild".
This also happens on the current latest rawhide branch `79d75fdcddac78d2c73000a6ae7569eabb05f7bc` too.
```
$ rpm -q ruby
ruby-3.1.2-170.fc38.x86_64
```
I found the grass package faced a similar issue with this. grass - RPM ARCH not defined https://bugzilla.redhat.com/show_bug.cgi?id=2138373 Here is how they fixed. https://src.fedoraproject.org/rpms/grass/c/65f12df9df7515907a074ea20e2c240369296fcb?branch=rawhide It seems that here is the original ticket about this issue. Package notes break extension modules of Ruby, Haskell, and possibly more language ecosystems https://bugzilla.redhat.com/show_bug.cgi?id=2043092 I hit this error on the libarchive upstreamed test as well [1]. I've tried a similar fix as grass use and it didn't help me with this error. [1] https://src.fedoraproject.org/tests/libarchive/blob/main/f/Sanity/Basic-sanity-test-for-libarchive This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38. (In reply to Jun Aruga from comment #0) > I noticed that the gcc complains "gcc: fatal error: environment variable > ‘RPM_ARCH’ not defined" with the `/usr/lib/rpm/redhat/redhat-package-notes` > file when running the command below on Fedora rawhide. This variable is define by rpm in builds, appropriately for the package being built. But when 'mock --shell' is used, those variables are not set. This causes problems when trying to repeat some part of the build commands, but it is not actually a problem in "real" builds. (In reply to Jun Aruga from comment #3) > I found the grass package faced a similar issue with this. > > grass - RPM ARCH not defined > Confidentialhttps://bugzilla.redhat.com/show_bug.cgi?id=2138373 > Here is how they fixed. > https://src.fedoraproject.org/rpms/grass/c/ > 65f12df9df7515907a074ea20e2c240369296fcb?branch=rawhide That fix is wrong. > Steps to Reproduce: > 1. Build ruby.spec on the > https://src.fedoraproject.org/rpms/ruby/tree/private-ruby-3.2 . > 2. Install the built RPMs. > 3. Run the `gem install byebug` on the mock environment by a user > "mockbuild". > > Actual results: > The `gem install byebug` failed with the error message above. This is the same issue as #1284684. There were various attempts to fix this, but it really needs to be resolved by the maintainers of the package in the way that they like. https://src.fedoraproject.org/rpms/ruby/pull-request/110 had a working solution, but it wasn't accepted because of some stylistic issues and whatnot. *** This bug has been marked as a duplicate of bug 1284684 *** |