Bug 2055863 - package-notes causes different %{__global_ldflags} between %prep and %build
Summary: package-notes causes different %{__global_ldflags} between %prep and %build
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: package-notes
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact:
URL:
Whiteboard:
Depends On: 2099999
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-17 20:11 UTC by Hans de Goede
Modified: 2022-09-03 16:26 UTC (History)
2 users (show)

Fixed In Version: package-notes-0.5-4.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-03 16:26:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hans de Goede 2022-02-17 20:11:55 UTC
I noticed that package-notes causes different %{__global_ldflags} between %prep and %build.

This is causing a build failure with openmsx for Fedora 36:
https://koji.fedoraproject.org/koji/taskinfo?taskID=82623076

With the error being:
/usr/bin/ld: cannot open linker script file /builddir/build/BUILD/.package_note-openmsx-16.0-5.fc36.x86_64.ld: No such file or directory

The problem is that openmsx uses its own buildsystem written in python and openmsx.spec does the following to generate config files for a "rpm" flavor for openmsx in %setup:

"""
cat > build/flavour-rpm.mk << EOF
# Opt flags.
CXXFLAGS+=%{optflags} -DNDEBUG
LINK_FLAGS+=%{__global_ldflags}

# Dont strip exe, let rpm do it and save debug info
OPENMSX_STRIP:=false
CATAPULT_STRIP:=false
EOF
"""

This results in the troublesome:

/builddir/build/BUILD/.package_note-openmsx-16.0-5.fc36.x86_64.ld

path making it into build/flavour-rpm.mk, where as during %build the file actually gets generated as:

/builddir/build/BUILD/openmsx-16.0/.package_note-openmsx-16.0-5.fc36.x86_64.ld

I assume the issue is %setup is setting the openmsx-16.0 part of the path and that this is not set when the macros in the %prep step get expanded.

For now I've fixed this by just moving the above generation of build/flavour-rpm.mk to %build. But I still thought you should be aware of this issue. At a minimum this issue should be documented somewhere.

Comment 1 Zbigniew Jędrzejewski-Szmek 2022-02-18 08:15:56 UTC
Yes, this is a well-known issue without a good solution so far.
In particular this prompted a cleanup to move all calls from %configure from %prep to %build.
But calling %configure in %prep is wrong for other reasons, while saving link flags like
you'd like to do here is OK and should work.

I'll keep this open for now. I think it'd be easiest to enhance rpm to provide %buildsubdir
earlier, or something equivalent.

Comment 2 Devrim Gündüz 2022-05-17 21:00:12 UTC
This bites every PostgreSQL extension packages that I'm building . Any progress so far?

Thanks! Devrim

Comment 3 Zbigniew Jędrzejewski-Szmek 2022-08-09 09:31:29 UTC
This should be fixed with the new approach in #2099999.

Comment 4 Zbigniew Jędrzejewski-Szmek 2022-09-03 16:26:33 UTC
This should be resolved with the new approach used in F37+. We'll not be changing the implementation
in F36 though, since that'd be likely to cause regressions.


Note You need to log in before you can comment on or make changes to this bug.