From 5d801a0affa51fe15d1977220250458c86edbd4e Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Jan 24 2022 14:52:51 +0000 Subject: Unset LDFLAGS for config/configure --- diff --git a/nas-1.9.4-Unset-LDFLAGS-for-config-configure.patch b/nas-1.9.4-Unset-LDFLAGS-for-config-configure.patch new file mode 100644 index 0000000..a7a0acc --- /dev/null +++ b/nas-1.9.4-Unset-LDFLAGS-for-config-configure.patch @@ -0,0 +1,70 @@ +From f89c35a7d987e09723ff2e1eab3150309420b2d2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 24 Jan 2022 15:19:56 +0100 +Subject: [PATCH] Unset LDFLAGS for config/configure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Version 1.6e (commit ac668735511a0956ceb3d0f5b82764f9adb2c09a) +started unsetting CFLAGS before invoking ./configure in ./config +directory without any explanation. + +This breaks building on Fedora 36 with GCC 12.0.1 because both +compiler and linker flags need to keep in sync: + +make[2]: Entering directory '/builddir/build/BUILD/nas-1.9.4/config' +sh -c "unset CFLAGS; ./configure" +checking build system type... x86_64-pc-linux-gnu +checking host system type... x86_64-pc-linux-gnu +checking how to print strings... printf +checking for gcc... gcc +checking whether the C compiler works... yes +checking for C compiler default output file name... a.out +checking for suffix of executables... +checking whether we are cross compiling... make[2]: Leaving directory '/builddir/build/BUILD/nas-1.9.4/config' +configure: error: in `/builddir/build/BUILD/nas-1.9.4/config': +configure: error: cannot run C compiled programs. +If you meant to cross compile, use `--host'. +See `config.log' for more details + +config.log contains: + +configure:3382: gcc -o conftest -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/test/fed +ora/nas/nas-1.9.4/.package_note-nas-1.9.4-26.fc36.x86_64.ld conftest.c >&5 +/usr/bin/ld: /tmp/cc1YE5Qg.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE +collect2: error: ld returned 1 exit status +configure:3386: $? = 1 +configure:3393: ./conftest +./configure: line 3395: ./conftest: No such file or directory +configure:3397: $? = 127 +configure:3404: error: in `/home/test/fedora/nas/nas-1.9.4/config': +configure:3406: error: cannot run C compiled programs. + +This clearly shows that linker flags passed from an envirment are used, but +compiler flags aren't. + +I don't understand why the configure script cannot use system-wide +flags, but this patch removes the linker flags either. + +Signed-off-by: Petr Písař +--- + config/Imakefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/Imakefile b/config/Imakefile +index 9687515..4c0515b 100644 +--- a/config/Imakefile ++++ b/config/Imakefile +@@ -13,7 +13,7 @@ INSTALLFLAGS = $(INSTINCFLAGS) + HEADERS = NasConfig.h config.h + + config.h: +- sh -c "unset CFLAGS; ./configure" ++ sh -c "unset CFLAGS LDFLAGS; ./configure" + + includes:: config.h + +-- +2.34.1 + diff --git a/nas.spec b/nas.spec index a76483d..bc58c6d 100644 --- a/nas.spec +++ b/nas.spec @@ -1,7 +1,7 @@ Name: nas Summary: The Network Audio System (NAS) Version: 1.9.4 -Release: 26%{?dist} +Release: 27%{?dist} URL: http://radscan.com/nas.html # README: MIT (main license) # config/aclocal.m4: FSFULLR @@ -42,6 +42,9 @@ Patch1: %{name}-1.9.4-Fix-building-with-GCC-10.patch # Fix a file handle leak, in upsream after 1.9.4, # Patch2: %{name}-1.9.4-AuErrDes.c-fclose-file-on-return-fixes-bug-6.patch +# Unset LDFLAGS for config/configure, proposed to the upstream, +# +Patch3: %{name}-1.9.4-Unset-LDFLAGS-for-config-configure.patch BuildRequires: bison BuildRequires: flex BuildRequires: gcc @@ -98,6 +101,7 @@ Development files and the documentation for Network Audio System. %patch0 -p1 -b .move_AuErrorDB %patch1 -p1 %patch2 -p1 +%patch3 -p1 # Update config.sub to support aarch64, bug #926196 cp -p %{_datadir}/automake-*/config.{sub,guess} config @@ -166,6 +170,9 @@ rm -fv $RPM_BUILD_ROOT%{_libdir}/lib*.a %changelog +* Mon Jan 24 2022 Petr Pisar - 1.9.4-27 +- Unset LDFLAGS for config/configure (upstream bug #9) + * Thu Jan 20 2022 Fedora Release Engineering - 1.9.4-26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild