Package Details: arm-linux-gnueabihf-glibc 2.38-4

Git Clone URL: https://aur.archlinux.org/arm-linux-gnueabihf-glibc.git (read-only, click to copy)
Package Base: arm-linux-gnueabihf-glibc
Description: GNU C Library
Upstream URL: https://www.gnu.org/software/libc/
Licenses: GPL, LGPL
Conflicts: arm-linux-gnueabihf-eglibc, arm-linux-gnueabihf-glibc-headers
Provides: arm-linux-gnueabihf-eglibc, arm-linux-gnueabihf-glibc-headers
Replaces: arm-linux-gnueabihf-glibc-headers
Submitter: tavianator
Maintainer: wgottwalt
Last Packager: wgottwalt
Votes: 36
Popularity: 0.127945
First Submitted: 2015-09-14 15:40 (UTC)
Last Updated: 2023-08-08 14:55 (UTC)

Latest Comments

« First ‹ Previous 1 2

xiretza commented on 2020-05-18 14:50 (UTC)

Hey! First of all, thanks for packaging, toolchains are always a pain. Unfortunately, this package can't be built with OPTIONS=(debug) set in makepkg.conf:

In file included from <command-line>:
./../include/libc-symbols.h:75:3: error: #error "glibc cannot be compiled without optimization"
   75 | # error "glibc cannot be compiled without optimization"
      |   ^~~~~
Traceback (most recent call last):
  File "../scripts/gen-as-const.py", line 120, in <module>
    main()
  File "../scripts/gen-as-const.py", line 116, in main
    consts = glibcextract.compute_c_consts(sym_data, args.cc)
  File "/build/arm-linux-gnueabihf-glibc/src/glibc-2.31/scripts/glibcextract.py", line 62, in compute_c_consts
    subprocess.check_call(cmd, shell=True)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'arm-linux-gnueabihf-gcc -std=gnu11 -fgnu89-inline  -fdebug-prefix-map=/build/arm-linux-gnueabihf-glibc/src=/usr/src/debug -Wall -Wwrite-strings -Wundef -fmerge-all-constants -frounding-math -fstack-protector-strong -Wstrict-prototypes -Wold-style-definition -fmath-errno     -ftls-model=initial-exec      -I../include -I/build/arm-linux-gnueabihf-glibc/src/glibc-build/csu  -I/build/arm-linux-gnueabihf-glibc/src/glibc-build  -I../sysdeps/unix/sysv/linux/arm/le  -I../sysdeps/unix/sysv/linux/arm  -I../sysdeps/arm/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/arm  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/arm/le/armv6  -I../sysdeps/arm/armv6  -I../sysdeps/arm/le  -I../sysdeps/arm/include -I../sysdeps/arm  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/9.2.0/include -isystem /usr/lib/gcc/arm-linux-gnueabihf/9.2.0/include-fixed -isystem /usr/arm-linux-gnueabihf/include -D_LIBC_REENTRANT -include /build/arm-linux-gnueabihf-glibc/src/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h       -DTOP_NAMESPACE=glibc -DGEN_AS_CONST_HEADERS           -MD -MP -MF /build/arm-linux-gnueabihf-glibc/src/glibc-build/rtld-global-offsets.h.dT           -MT '/build/arm-linux-gnueabihf-glibc/src/glibc-build/rtld-global-offsets.h.d /build/arm-linux-gnueabihf-glibc/src/glibc-build/rtld-global-offsets.h' -S -o /tmp/tmp6fa6v5c2/test.s -x c - < /tmp/tmp6fa6v5c2/test.c' returned non-zero exit status 1.

By default (without debug), CFLAGS is empty/unset thanks to !buildflags. This causes glibc to fall back to a default set of flags, -g -O2 (see Makeconfig:327).

Now, when debug is set, DEBUG_CFLAGS from makepkg.conf get appended to CFLAGS. This happens after !buildflags unsets the variables, which has been determined to be intentional/notabug after bringing it up in #archlinux-pacman. With CFLAGS now set to -g -fvar-tracking-assignments, the glibc build system no longer falls back to its defaults, and since there's no -Ox option set, the build fails (I have not found an explanation why glibc needs optimizations to be on, so that's just how it is).

There are a couple possible solutions for this, but I think the safest way is to follow the example of official PKGBUILDS. The riscv64-linux-gnu-glibc PKGBUILD for example always sets CFLAGS to a fixed value - while this fixes the problem, it's not ideal because it discards the extra flags added from DEBUG_CFLAGS. I think the best solution would be this:

diff --git a/PKGBUILD b/PKGBUILD
index c670646..2f1ec20 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -72,13 +72,10 @@ build() {
   echo "sbindir=/bin" >> configparms
   echo "rootsbindir=/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/}
+  # remove hardening options for building libraries
+  export CFLAGS="${CFLAGS} -U_FORTIFY_SOURCE -O2"
+  export CPPFLAGS="${CPPFLAGS} -U_FORTIFY_SOURCE -O2"
+  unset LD_LIBRARY_PATH

   export BUILD_CC=gcc
   export CC=${_target}-gcc

In the normal, non-debug case this behaves exactly the same as the riscv64 glibc (and almost the same as before the change, except no -g being passed by default), and with debug, the debug flags are added while still keeping optimization on and hardening disabled.

tavianator commented on 2019-02-05 01:46 (UTC)

@skogsmaskin: You'll have to build that package first (and its dependencies before it, etc.). Check the pinned post on https://aur.archlinux.org/packages/arm-linux-gnueabihf-gcc/ for the correct order.

skogsmaskin commented on 2019-02-03 13:41 (UTC) (edited on 2019-02-03 13:43 (UTC) by skogsmaskin)

Getting this error from the lastest update:

==> Making package: arm-linux-gnueabihf-glibc 2.28-5 (sø. 03. feb. 2019 kl. 14.39 +0100)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...
error: target not found: arm-linux-gnueabihf-gcc-stage2>=8.2.1+20181127
==> ERROR: 'pacman' failed to install missing dependencies.