Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921183 - dev-util/cbindgen-0.26.0 does not honor CC nor CFLAGS
Summary: dev-util/cbindgen-0.26.0 does not honor CC nor CFLAGS
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-02 09:25 UTC by Mart Raudsepp
Modified: 2024-01-03 07:09 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
cbindgen build.log (cbindgen-build.log,63.79 KB, text/plain)
2024-01-02 09:25 UTC, Mart Raudsepp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mart Raudsepp gentoo-dev 2024-01-02 09:25:31 UTC
Created attachment 881251 [details]
cbindgen build.log

cbindgen isn't honoring CC nor CFLAGS during compiling itself, and even more annoyingly it is at least in that case (maybe all cases though) then locked to `cc` for all other rust packages using cbindgen as well, making them all fail as well when clang and CFLAGS suitable for it are used for their compilation (as gcc doesn't recognize my CFLAGS).
Comment 1 Mart Raudsepp gentoo-dev 2024-01-02 09:26:22 UTC
The reported flags for cbindgen is from a forced gcc installed then, but all consumers of it then need gcc forcing as well as per original description.


Portage 3.0.54 (python 3.11.7-final-0, default/linux/arm64/17.0/desktop/gnome/systemd/merged-usr, gcc-13, glibc-2.38-r7, 6.6.0-asahi+ aarch64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.6.0-asahi+-aarch64-with-glibc2.38
KiB Mem:   198993888 total, 180392496 free
KiB Swap:          0 total,         0 free
Head commit of repository asahi: b0f8b6c7577716f214c3c1584fd89b67c18313c9

sh bash 5.2_p21-r1
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p21-r1::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.11.7::gentoo, 3.12.1_p1::gentoo
dev-lang/rust-bin:         1.74.1::gentoo
dev-util/cmake:            3.28.1::gentoo
dev-util/meson:            1.2.3::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.5::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo, 2.72-r1::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo, 17.0.6::gentoo
sys-devel/gcc:             13.2.1_p20231216::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo, 17.0.6::gentoo
sys-devel/llvm:            16.0.6::gentoo, 17.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r7::gentoo
Repositories:

gentoo
    location: /home/leio/gentoo/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 3

asahi
    location: /var/db/repos/asahi
    sync-type: git
    sync-uri: https://github.com/chadmed/asahi-overlay.git
    masters: gentoo
    volatile: False

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://gentoo.osuosl.org/releases/arm64/binpackages/17.0/arm64

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE"
AR="llvm-ar"
CBUILD="aarch64-unknown-linux-gnu"
CC="clang"
CFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches -flto=thin"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXX="clang++"
CXXFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches -flto=thin"
DISTDIR="/home/distfiles"
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="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches"
GENTOO_MIRRORS="https://mirror.netcologne.de/gentoo/ http://gentoo.mirrors.ovh.net/gentoo-distfiles/ http://ftp.halifax.rwth-aachen.de/gentoo/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-zpack-relative-relocs -flto=thin -Wl,--defsym=__gentoo_check_ldflags__=0"
LEX="flex"
LINGUAS="en et et_EE pl de"
MAKEOPTS="-j26"
OBJCOPY="llvm-objcopy"
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="/tmp"
RANLIB="llvm-ranlib"
RUSTFLAGS="-C linker-plugin-lto -C opt-level=3 -C target-cpu=apple-m2 -C link-arg=-Wl,-z,pack-relative-relocs"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa arm64 bluetooth branding brotli bzip2 cairo cdda cdr clang cli colord crypt cups dbus dri dts dvdr eds encode evo exif flac flatpak fortran gdbm gif gnome gnome-keyring gnome-online-accounts gnome-shell gpm gstreamer gtk gui iconv icu introspection ipv6 jpeg keyring lcms libnotify libtirpc mad mng mp3 mp4 mpeg nautilus ncurses networkmanager nls nptl ogg opengl openmp opus pam pango pcre pdf pipewire png policykit ppds pulseaudio readline screencast sdl seccomp sound spell ssl startup-notification svg sysprof systemd test-rust tiff tracker truetype udev udisks unicode upower usb vorbis vulkan wayland wxwidgets x264 xattr xcb xft xml xv zlib" ADA_TARGET="gnat_2021" 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_ARM="edsp v8 vfp vfp-d32 vfpv3 vfpv4" 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" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en et" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby33" VIDEO_CARDS="fbdev asahi dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

dev-util/cbindgen-0.26.0::gentoo was built with the following:
USE="-debug"
CFLAGS="-march=native -mcpu=native -O3 -pipe -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ggdb"
CXXFLAGS="-march=native -mcpu=native -O3 -pipe -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ggdb"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news nostrip parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
LDFLAGS=""
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-02 09:28:36 UTC
What's the relationship between dev-util/cbindgen and the crates here?

Are you only hitting this with stuff depending on cbindgen (very few pkgs) or stuff which uses a crate which is also from the cbindgen source so it's affected by the same problem?
Comment 3 Mart Raudsepp gentoo-dev 2024-01-02 09:30:47 UTC
Actually I'm not sure anymore why cbindgen itself fails when built with clang settings but it calling `cc`. Maybe some options are honored by gcc and then it's linking with ld instead of lld (clang-common forces lld for me), but that doesn't make that much sense either as CFLAGS are apparently ignored too
Comment 4 Mart Raudsepp gentoo-dev 2024-01-02 09:32:17 UTC
The only relation between cbindgen own failure with clang and crates using cbindgen MIGHT be that MAYBE cbindgen would use clang on its own instead of cc when cbindgen itself is actually built with clang, but I can't be sure. Was just a guess from chadmed that it might lock into its own used CC.
This bug is about cbindgen own build failure and we can make a separate one for cbindgen using crates.
Comment 5 Joonas Niilola gentoo-dev 2024-01-02 10:05:18 UTC
IIRC the CFLAGS thing is a "rust-feature". I'm pretty sure I've succesfully built cbindgen and its rdeps with clang (on amd64), but if I had to guess this may be related to >=rust-1.73 and your

  CBUILD="aarch64-unknown-linux-gnu"

This is currently problematic with Firefox too.
Comment 6 Joonas Niilola gentoo-dev 2024-01-03 07:09:26 UTC
That being said, can you try rust-bin <1.73 (rust-bin-1.72 should work fine), or can you try building the source version of >=1.73 and remember to use that instead of the -bin?