View previous topic :: View next topic |
Author |
Message |
Shadow_Fury Apprentice
Joined: 20 Apr 2021 Posts: 184 Location: 11.435765792823453, 143.05926743686274
|
Posted: Sun Aug 18, 2024 5:46 pm Post subject: libffi fails to emerge |
|
|
attempt to resolve the libffi compilation failure encountered whilst updating world
( previous thread that lead to here)
the issue seems this:
Code: |
configure:4679: ./conftest
safestack CHECK failed: /var/tmp/portage/sys-libs/compiler-rt-sanitizers-17.0.6/work/compiler-rt/lib/safestack/safestack.cpp:95 MAP_FAILED != addr
/var/tmp/portage/dev-libs/libffi-3.4.6/work/libffi-3.4.6/configure: line 4681: 439 Aborted ./conftest$ac_cv_exeext
configure:4683: $? = 134
|
which has me confused, since it appears both when safestack is and isn't enabled for compilation
config.log (from no-safestack, disabled with package.env)
build.log
emerge --info '=dev-libs/libffi-3.4.6::gentoo':
Code: |
Portage 3.0.65 (python 3.12.3-final-0, default/linux/amd64/23.0/llvm, gcc-13, glibc-2.39-r6, 6.6.35-gentoo-dist x86_64)
=================================================================
System Settings
=================================================================
System uname: Linux-6.6.35-gentoo-dist-x86_64-Intel-R-_Core-TM-_i7-6800K_CPU_@_3.40GHz-with-glibc2.39
KiB Mem: 32773816 total, 14051368 free
KiB Swap: 67108860 total, 67108860 free
Timestamp of repository gentoo: Sat, 17 Aug 2024 18:30:00 +0000
Head commit of repository gentoo: 427d7d08f7866c9f5d81f337849a8b712d3e942a
sh bash 5.2_p26-r6
ld LLD 17.0.6 (compatible with GNU linkers)
app-misc/pax-utils: 1.3.7::gentoo
app-shells/bash: 5.2_p26-r6::gentoo
dev-build/autoconf: 2.71-r7::gentoo
dev-build/automake: 1.16.5-r2::gentoo
dev-build/cmake: 3.28.5::gentoo
dev-build/libtool: 2.4.7-r4::gentoo
dev-build/make: 4.4.1-r1::gentoo
dev-build/meson: 1.4.1::gentoo
dev-lang/perl: 5.38.2-r3::gentoo
dev-lang/python: 3.12.3-r1::gentoo
sys-apps/baselayout: 2.15::gentoo
sys-apps/openrc: 0.54.2::gentoo
sys-apps/sandbox: 2.38::gentoo
sys-devel/binutils: 2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang: 17.0.6::gentoo, 18.1.8::gentoo
sys-devel/gcc: 13.2.1_p20240210::gentoo
sys-devel/gcc-config: 2.11::gentoo
sys-devel/lld: 17.0.6::gentoo, 18.1.8::gentoo
sys-devel/llvm: 17.0.6::gentoo, 18.1.8-r1::gentoo
sys-kernel/linux-headers: 6.10::gentoo (virtual/os-headers)
sys-libs/glibc: 2.39-r6::gentoo
Repositories:
gentoo
location: /var/db/repos/gentoo
sync-type: rsync
sync-uri: rsync://rsync.gentoo.org/gentoo-portage
priority: -1000
volatile: False
sync-rsync-verify-metamanifest: yes
sync-rsync-verify-jobs: 1
sync-rsync-extra-opts:
sync-rsync-verify-max-age: 3
local
location: /var/db/repos/local
masters: gentoo
volatile: False
Binary Repositories:
gentoobinhost
priority: 1
sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64_llvm
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="clang -c"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-mtune=native -march=native -O2 -pipe -flto -fvisibility=hidden -ftrivial-auto-var-init=zero -fomit-frame-pointer -ftrapv -mretpoline -fpie -fPIC -fwrapv -fstack-clash-protection -Wl,-z,separate-code -fsanitize=cfi -fsanitize=safe-stack -Wno-error=implicit-function-declaration"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CPP="clang-cpp"
CXX="clang++"
CXXFLAGS="-mtune=native -march=native -O2 -pipe -flto -fvisibility=hidden -ftrivial-auto-var-init=zero -fomit-frame-pointer -ftrapv -mretpoline -fpie -fPIC -fwrapv -fstack-clash-protection -Wl,-z,separate-code -fsanitize=cfi -fsanitize=safe-stack -Wno-error=implicit-function-declaration"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --ask"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-mtune=native -march=native -O2 -pipe -flto -fvisibility=hidden -ftrivial-auto-var-init=zero -fomit-frame-pointer -ftrapv -mretpoline -fpie -fPIC -fwrapv -fstack-clash-protection -Wl,-z,separate-code -fsanitize=cfi -fsanitize=safe-stack -Wno-error=implicit-function-declaration"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance binpkg-request-signature buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox selinux sesandbox sfperms strict strict-keepdir stricter suidctl test unknown-features-filter unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-mtune=native -march=native -O2 -pipe -flto -fvisibility=hidden -ftrivial-auto-var-init=zero -fomit-frame-pointer -ftrapv -mretpoline -fpie -fPIC -fwrapv -fstack-clash-protection -Wl,-z,separate-code -fsanitize=cfi -fsanitize=safe-stack -Wno-error=implicit-function-declaration"
GENTOO_MIRRORS="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/ https://mirror.dogado.de/gentoo https://ftp.agdsn.de/gentoo https://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ https://ftp.gwdg.de/pub/linux/gentoo/ https://ftp.uni-hannover.de/gentoo/ https://mirror.netcologne.de/gentoo/ https://mirror.netzwerge.de/gentoo/ https://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ https://ftp.halifax.rwth-aachen.de/gentoo/ https://ftp.tu-ilmenau.de/mirror/gentoo/ https://ftp.fau.de/gentoo https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ https://ftp.uni-stuttgart.de/gentoo-distfiles/ https://ftp.lysator.liu.se/gentoo/ https://mirrors.tnonline.net/gentoo/gentoo-distfiles/ https://mirror.init7.net/gentoo/"
LANG="C.UTF8"
LD="ld.lld"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
MAKEOPTS="-j12 -l14"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RANLIB="llvm-ranlib"
READELF="llvm-readelf"
SHELL="/bin/bash"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="X a52 aac acl acpi activities alsa amd64 audit branding bzip2 cairo caps cdda cdr cet clang crypt cuda cups dbus declarative dri dts dvd dvdr elogind encode exif flac fortify gdbm gif gpg gpm gui hardened iconv icu ipv6 jemalloc joystick jpeg kde kf6compat kwallet lcms libnotify libtirpc llvm llvm-libunwind lto lvm mad man mng mp3 mp4 mpeg multilib ncurses networkmanager nls nvidia ogg opengl openmp pam pango pcre pdf peer_perms pic pie pipewire plasma png policykit ppds qml qt5 readline rsync-verify screencast sdl seccomp selinux semantic-desktop sound spell ssl ssp startup-notification svg test test-rust tiff truetype ubac udev udisks unicode upower usb vdpau verify-sig vorbis vulkan wayland widgets wxwidgets x264 xattr xcb xft xml xtpax xv xvid xvmc zlib zsh-completions zstd" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput joystick evdev" KERNEL="linux" L10N="en-GB" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="BPF NVPTX X86 AVR" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="nvidia vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset: ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RUSTFLAGS, SIZE, YACC, YFLAGS
|
emerge -pqv '=dev-libs/libffi-3.4.6::gentoo':
Code: |
[ebuild U ] dev-libs/libffi-3.4.6 [3.4.4-r4] USE="test* -debug -exec-static-trampoline -pax-kernel -static-libs" ABI_X86="(32) (64) (-x32)"
|
help is appreciated |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2851
|
Posted: Sun Aug 18, 2024 11:13 pm Post subject: |
|
|
I don't know why this is failing with that option, but I can reproduce if I build with clang and use -fsanitize=safe-stack for 32bit (seems fine for 64bit)
e.g. to reproduce on its own: Code: | $ clang-18 -m32 -fsanitize=safe-stack -x c -o test - <<<"int main(void) { return 0; }"
$ ./test
safestack CHECK failed: /tmp/portage/sys-libs/compiler-rt-sanitizers-18.1.8/work/compiler-rt/lib/safestack/safestack.cpp:95 MAP_FAILED != addr
Aborted | Should have nothing to do with libffi and it's likely everything with USE=abi_x86_32 that's going to fail (e.g. try emerge -1 sys-apps/sandbox), maybe(?) an issue compiler-rt-sanitizers itself, not that I'm familiar with these much.
Did you build the previous versions with that flag and it worked at the time, or added it recently? If the former, maybe a clang bump broke it. Could check if clang-17 works I guess (don't have it installed anymore so haven't tried). |
|
Back to top |
|
|
sam_ Developer
Joined: 14 Aug 2020 Posts: 1948
|
Posted: Sun Aug 18, 2024 11:47 pm Post subject: |
|
|
That said, regarding your options: I don't expect CFI to be usable any time soon as many applications need porting; hidden visibility will break stuff relying on default-exported visibility that needs fixing. -ftrapv vs -fwrapv are contradictory. A bunch of the other settings are either unwise, the same as defaults, or otherwise unnecessary.
If you're going to use a bunch of those, try to become comfortable extracting stuff into standalone testcases as Ionen did. |
|
Back to top |
|
|
Shadow_Fury Apprentice
Joined: 20 Apr 2021 Posts: 184 Location: 11.435765792823453, 143.05926743686274
|
Posted: Mon Aug 19, 2024 12:39 pm Post subject: |
|
|
Ionen wrote: | I don't know why this is failing with that option, but I can reproduce if I build with clang and use -fsanitize=safe-stack for 32bit (seems fine for 64bit)
e.g. to reproduce on its own: Code: | $ clang-18 -m32 -fsanitize=safe-stack -x c -o test - <<<"int main(void) { return 0; }"
$ ./test
safestack CHECK failed: /tmp/portage/sys-libs/compiler-rt-sanitizers-18.1.8/work/compiler-rt/lib/safestack/safestack.cpp:95 MAP_FAILED != addr
Aborted | Should have nothing to do with libffi and it's likely everything with USE=abi_x86_32 that's going to fail (e.g. try emerge -1 sys-apps/sandbox), maybe(?) an issue compiler-rt-sanitizers itself, not that I'm familiar with these much.
Did you build the previous versions with that flag and it worked at the time, or added it recently? If the former, maybe a clang bump broke it. Could check if clang-17 works I guess (don't have it installed anymore so haven't tried). |
sam_ wrote: | That said, regarding your options: I don't expect CFI to be usable any time soon as many applications need porting; hidden visibility will break stuff relying on default-exported visibility that needs fixing. -ftrapv vs -fwrapv are contradictory. A bunch of the other settings are either unwise, the same as defaults, or otherwise unnecessary.
If you're going to use a bunch of those, try to become comfortable extracting stuff into standalone testcases as Ionen did. |
thank you for the advice. i figured out what was actually wrong.
for some reason, unlike most of clang's fsanitize flags, -fsanitize=safe-stack is not cancelled by -fno-sanitize=safe-stack.
once i changed how my package.env setup works, it functions fine.
i also fixed the conflicting flags.
thank you for the help.
final question on this topic: is it possible to override envvars based on whether the package is being built for 32 or 64 bit?
Edit: ok, now i'm confused...
can someone tell me how package.env works? specifically, can you stack ENV profiles?
example:
env/safestack:
Code: |
COMMON_FLAGS="${COMMON_FLAGS} -fsanitize=safe-stack"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
|
env/default-visibility:
Code: |
COMMON_FLAGS="${COMMON_FLAGS} -fvisibility=default"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
|
package.env/00-default:
now, if i do:
package.env/libffi
Code: |
dev-libs/libffi -safestack
|
safestack disables fine (the clang flag disappears)
but, when i do this:
Code: |
dev-libs/libffi -safestack default-visibility
|
it re-appears...
can someone explain to me why this is wrong, and how to do it right? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|