Bug 2043864 - Generated compiler flags do no match location of generated file
Summary: Generated compiler flags do no match location of generated file
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: package-notes
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-22 10:40 UTC by Mattias Ellert
Modified: 2022-01-22 12:36 UTC (History)
13 users (show)

Fixed In Version: udt-4.11-20.fc36
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-22 12:36:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mattias Ellert 2022-01-22 10:40:35 UTC
Description of problem:

From the log of the mass rebuild of package "udt":

/usr/bin/ld: cannot open linker script file /builddir/build/BUILD/.package_note-udt-4.11-20.fc36.x86_64.ld: No such file or directory
collect2: error: ld returned 1 exit status

The file is created by the build, but at a different location:

/builddir/build/BUILD/udt4/.package_note-udt-4.11-19.fc36.x86_64.ld

Note the /.../udt4/... component in the actual filename missing from the filename in the compiler flag:

-Wl,-dT,/builddir/build/BUILD/.package_note-udt-4.11-20.fc36.x86_64.ld

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

redhat-rpm-config-211-1.fc36

How reproducible:

Always

Steps to Reproduce:
1. Build "udt" in Fedora rawhide

Actual results:

Failing build due to mismatch between compiler flag and actual file location.

Expected results:

Successful build.

Additional info:

If I revert the recent change and remove the use of buildsubdir in the macro the build succeeds.

# diff -u /tmp/macros.package-notes-srpm.old /tmp/macros.package-notes-srpm.new 
--- /tmp/macros.package-notes-srpm.old	2022-01-21 18:23:27.000000000 +0100
+++ /tmp/macros.package-notes-srpm.new	2022-01-22 11:23:19.297476184 +0100
@@ -1,7 +1,7 @@
 # Add an ELF note with information about the package the code was compiled for.
 # See https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
 # for details.
-%_package_note_file     %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.package_note-%{name}-%{version}-%{release}.%{_arch}.ld
+%_package_note_file     %{_builddir}/.package_note-%{name}-%{version}-%{release}.%{_arch}.ld
 
 %_package_note_flags    %{?_package_note_file:%{?name:%["%_target_cpu" == "noarch"?"":"-Wl,-dT,%{_package_note_file}"]}}
 

You can't use the buildsubdir macro in the %prep section, since it is not defined there. And since the macros with compiler and link flags are often used in code preraration you can't use them in the definitions of those macros. Please revert this change - the filename used was perfectly fine before this change.

Comment 1 Miro Hrončok 2022-01-22 11:06:36 UTC
I think the problem is that %{buildsubdir} gets defined later than %_package_note_flags is added to the flags?

Comment 2 Zbigniew Jędrzejewski-Szmek 2022-01-22 12:15:20 UTC
I tried to figure out why the name is not defined in this case, while it works in other cases, and
I couldn't figure it out. But just doing '%global _package_notes_file …' works well. I pushed
a commit with that directly to rawhide and it's building now.


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