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.
I think the problem is that %{buildsubdir} gets defined later than %_package_note_flags is added to the flags?
Comment 2Zbigniew 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.