FS#69658 - Remove CPPFLAGS and CFLAGS hacks from glibc PKGBUILD?

Attached to Project: Arch Linux
Opened by Christer Solskogen (solskogen) - Tuesday, 16 February 2021, 16:33 GMT
Last edited by Allan McRae (Allan) - Friday, 19 February 2021, 03:49 GMT
Task Type General Gripe
Category System
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

With this diff glibc builds fine. Are those hacks still needed?

diff --git a/repos/core-x86_64/PKGBUILD b/repos/core-x86_64/PKGBUILD
index 2f0b594..3a38dca 100644
--- a/repos/core-x86_64/PKGBUILD
+++ b/repos/core-x86_64/PKGBUILD
@@ -44,6 +44,10 @@ prepare() {
}

build() {
+ CFLAGS="${CPPFLAGS} ${CFLAGS}"
+ CXXFLAGS="${CPPFLAGS} ${CFLAGS}"
+ unset CPPFLAGS
+
local _configure_flags=(
--prefix=/usr
--with-headers=/usr/include
@@ -69,28 +73,11 @@ build() {
echo "sbindir=/usr/bin" >> configparms
echo "rootsbindir=/usr/bin" >> configparms

- # remove fortify for building libraries
- CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
-
- #
- CFLAGS=${CFLAGS/-fno-plt/}
- CXXFLAGS=${CXXFLAGS/-fno-plt/}
- LDFLAGS=${LDFLAGS/,-z,now/}
-
"$srcdir/glibc/configure" \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
${_configure_flags[@]}

- # build libraries with fortify disabled
- echo "build-programs=no" >> configparms
- make
-
- # re-enable fortify for programs
- sed -i "/build-programs=/s#no#yes#" configparms
-
- echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
- echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make

# build info pages manually for reprducibility
@@ -105,26 +92,12 @@ build() {
echo "sbindir=/usr/bin" >> configparms
echo "rootsbindir=/usr/bin" >> configparms

- # remove fortify for building libraries
- CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
- CFLAGS=${CFLAGS/-fno-plt/}
- CXXFLAGS=${CXXFLAGS/-fno-plt/}
-
"$srcdir/glibc/configure" \
--host=i686-pc-linux-gnu \
--libdir=/usr/lib32 \
--libexecdir=/usr/lib32 \
${_configure_flags[@]}

- # build libraries with fortify disabled
- echo "build-programs=no" >> configparms
- make
-
- # re-enable fortify for programs
- sed -i "/build-programs=/s#no#yes#" configparms
-
- echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
- echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make

}
@@ -132,9 +105,6 @@ build() {
check() {
cd glibc-build

- # remove fortify in preparation to run test-suite
- sed -i '/FORTIFY/d' configparms
-
# some failures are "expected"
make check || true
}
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 19 February 2021, 03:49 GMT
Reason for closing:  Won't fix
Additional comments about closing:  breaks stuff
Comment by Emil (xexaxo) - Tuesday, 16 February 2021, 17:21 GMT
(Disclaimer: I'm not a TU/Developer)
Removing workarounds is great but consider that a) there should be _no_ increase in the testsuite failures and b) these workarounds might be due to "issues" in other packages. Ideally there would be inline bug references for each one - feel free to check through the log [1] and produce a neat list ;-)


[1] https://github.com/archlinux/svntogit-packages/blob/packages/glibc/trunk/PKGBUILD
Comment by Christer Solskogen (solskogen) - Tuesday, 16 February 2021, 17:37 GMT
It looks like it was added ~10 years ago, but no explanation about why.
Comment by Allan McRae (Allan) - Tuesday, 16 February 2021, 20:46 GMT
Did you check the testsuite?
Comment by Christer Solskogen (solskogen) - Tuesday, 16 February 2021, 22:16 GMT
With these changes I get on 64bit:

Summary of test results:
16 FAIL
4337 PASS
16 UNSUPPORTED
13 XFAIL
6 XPASS

On lib32:
12 FAIL
4263 PASS
15 UNSUPPORTED
13 XFAIL
6 XPASS

On the original lib32 fails while 64bit I get this:

Summary of test results:
4353 PASS
16 UNSUPPORTED
13 XFAIL
6 XPASS
Comment by Christer Solskogen (solskogen) - Tuesday, 16 February 2021, 23:26 GMT
No, scrap that. My mistake.
I get the same results.
Comment by Allan McRae (Allan) - Wednesday, 17 February 2021, 00:50 GMT
Looks like they fixed those issues since I handed this package off several years back. I'm slowly doing a clean up and documentation of the toolchain PKGBUILDs, so will remove these at some stage.
Comment by Allan McRae (Allan) - Wednesday, 17 February 2021, 01:54 GMT
I just run this in our build system, and it does have issues...

current:
FAIL: elf/tst-cpu-features-cpuinfo
FAIL: misc/test-errno-linux
FAIL: misc/tst-mlock2
FAIL: misc/tst-pkey
FAIL: time/tst-adjtime
FAIL: time/tst-clock2


without flags:
FAIL: elf/circleload1
FAIL: elf/constload1
FAIL: elf/dblload
FAIL: elf/dblunload
FAIL: elf/ifuncmain6pie
FAIL: elf/lateglobal
FAIL: elf/reldep6
FAIL: elf/resolvfail
FAIL: elf/tst-audit4
FAIL: elf/tst-audit5
FAIL: elf/tst-audit6
FAIL: elf/tst-audit7
FAIL: elf/tst-cpu-features-cpuinfo
FAIL: elf/tst-global1
FAIL: elf/tst-initfinilazyfail
FAIL: elf/tst-latepthread
FAIL: misc/test-errno-linux
FAIL: misc/tst-mlock2
FAIL: misc/tst-pkey
FAIL: time/tst-adjtime
FAIL: time/tst-clock2


Comment by Christer Solskogen (solskogen) - Wednesday, 17 February 2021, 07:11 GMT
Yeah, I saw that too. But theey disappeared when I installed it, and compiled glibc again (and ran the test suite again)

Edit: No they didn't. I was testing the wrong build.
Comment by Allan McRae (Allan) - Wednesday, 17 February 2021, 07:33 GMT
The compile and testing of glibc will not be affected by the verison of glibc you have installed.
Comment by Allan McRae (Allan) - Wednesday, 17 February 2021, 07:35 GMT
Anyway - my guess is that it is the -no-plt and -z,now parts that cause the testsuite errors. It is possible the FORTIFY_SOURCE stuff can move to CFLAGS (will likely happen by default soon), and not require the shuffle with that.

Loading...