#1121124 libselinux: FTBFS on x32: "recompile with -fPIC"

#1121124#5
Date:
2025-11-21 12:37:16 UTC
From:
To:
Hi!

libselinux 3.9-2 FTBFS on x32 (but 3.9-1 was fine):
https://buildd.debian.org/status/fetch.php?pkg=libselinux&arch=x32&ver=3.9-2&stamp=1760853517&raw=0


cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/build/reproducible-path/libselinux-3.9=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -fcf-protection -fno-semantic-interposition -Wall -Wextra -Wdate-time -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DHAVE_STRLCPY -DHAVE_REALLOCARRAY -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/pie-link.specs -Wl,-z,relro -Wl,-z,now -shared -o libselinux.so.1 avc.lo avc_internal.lo avc_sidtab.lo booleans.lo callbacks.lo canonicalize_context.lo checkAccess.lo check_context.lo checkreqprot.lo compute_av.lo compute_create.lo compute_member.lo compute_relabel.lo compute_user.lo context.lo deny_unknown.lo disable.lo enabled.lo fgetfilecon.lo freecon.lo freeconary.lo fsetfilecon.lo get_context_list.lo get_default_type.lo get_initial_context.lo getenforce.lo getfilecon.lo getpeercon.lo init.lo is_customizable_type.lo label.lo label_db.lo label_file.lo label_media.lo label_support.lo label_x.lo lgetfilecon.lo load_policy.lo lsetfilecon.lo mapping.lo matchmediacon.lo matchpathcon.lo policyvers.lo procattr.lo query_user_context.lo regex.lo reject_unknown.lo selinux_check_securetty_context.lo selinux_config.lo selinux_internal.lo selinux_restorecon.lo sestatus.lo setenforce.lo setexecfilecon.lo setfilecon.lo setrans_client.lo seusers.lo sha1.lo stringrep.lo validatetrans.lo -lpcre2-8   -ldl -Wl,-soname,libselinux.so.1,--version-script=libselinux.map,-z,defs,-z,relro
/usr/bin/ld: /tmp/ccWITxzC.ltrans2.ltrans.o: warning: relocation against `selinux_mnt' in read-only section `.text.exit'
/usr/bin/ld: /tmp/ccWITxzC.ltrans0.ltrans.o: relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.16' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:171: libselinux.so.1] Error 1

#1121124#10
Date:
2025-11-24 12:35:52 UTC
From:
To:
For me this seems to be related to LTO (which got enabled in 3.9-3).
Is LTO even supported on x32?