Somehow, AwesomeWM/Inkscape and/or and C file compile, run, but do nothing. Take the following reproducer: ```c #include <cairo.h> #include <cairo-svg.h> int main() { cairo_surface_t *surface = cairo_svg_surface_create("/tmp/foo2.svg",100,100); cairo_t *cr = cairo_create(surface); cairo_set_source_rgb(cr, 1, 0, 0); cairo_rectangle(cr, 0,0,100,100); cairo_fill(cr); cairo_show_page(cr); cairo_surface_destroy(surface); cairo_destroy(cr); return 0; } ``` `gcc ~/main.c -I /usr/include/cairo -lcairo -o /tmp/cairo` Produce the following output on Gentoo: ``` <?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" viewBox="0 0 100 100"> </svg> ``` But in other distribution, does: ``` <?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" viewBox="0 0 100 100"> <rect x="-10" y="-10" width="120" height="120" fill="rgb(100%, 0%, 0%)" fill-opacity="1"/> </svg> ``` Note that the `rect` is present in the normal output, but not the gentoo output. This is true for all backends, including `xcb`. Inkscape just crashes, AwesomeWM runs but displays nothing. Reproducible: Always Steps to Reproduce: 1. Install Gentoo with Cairo as of 2024-08-01 2. Run the reproducer 3. See if it contains `rect` or not Actual Results: `rect` is not present in the reproducer Expected Results: `rect` is present in the reproducer It seems it's somewhere in a dependency. I compiled various versions of Cairo with sane CFLAGS and still reproduced. `cairo-trace` shows nothing, which is highly suspicious. `ltrace` works: ```txt CAIRO_TRACE_SO="/usr/lib64/cairo/libcairo-trace.so" ltrace /tmp/cairo cairo_svg_surface_create(0x55d3e0851018, 0x7fff4d25e798, 0x7fff4d25e7a8, 0x55d3e0852d78) = 0x55d3ff73ed70 cairo_create(0x55d3ff73ed70, 8, 0, 1) = 0x55d3ff73f160 cairo_set_source_rgb(0x55d3ff73f160, 0x55d3ff73ed70, 0, 0x55d3ff73ee38) = 0 cairo_rectangle(0x55d3ff73f160, 0x55d3ff73f760, 1, 176) = 0 cairo_fill(0x55d3ff73f160, 4, 5, 0) = 0 cairo_show_page(0x55d3ff73f160, 0x55d3ff73f860, 32, 0) = 0 cairo_surface_destroy(0x55d3ff73ed70, 1, 1, 545) = 0x55d3ff73ed88 cairo_destroy(0x55d3ff73f160, 1, 3, 545) = 0 +++ exited (status 0) +++ ``` I also tried gcc14 and clang. Alongside `ld.bfd` and `ld.gold`. It didn't change anything. Soooo, some package, somewhere don't like my CFLAGS, but I have no clue which one.
It seems to work for me. I get the following output from your test program: > <?xml version="1.0" encoding="UTF-8"?> > <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" viewBox="0 0 100 100"> > <rect x="-10" y="-10" width="120" height="120" fill="rgb(100%, 0%, 0%)" fill-opacity="1"/> > </svg> x11-libs/cairo-1.18.0::gentoo was built with the following: USE="X glib (-aqua) (-debug) -gtk-doc -test" ABI_X86="64 -32 -x32"
Please also share emerge --info and if there's anything interesting about your system.
(In reply to Sam James from comment #2) > Please also share emerge --info and if there's anything interesting about > your system. Yeah, about that... But more seriously, obviously this is something specific to my system. If this was more widespread, a lot of people would be affected. That being said, something somewhere has a bug and it's probably worth identifying and fixing (upstream?). It's also a regression (upstream?, buggy toolchain?) since the last time I did a clean Gentoo install (~2 years ago), I used the same `make.conf` and AwesomeWM worked fine. I will try to create a Docker container with the same package list and a sane set of `CFLAGS`/`LDFLAGS`, then re-compile them one-by-one with the insane flags until I find WTF triggers the dead-code-elimination or whatever causes the renderer to never get executed. (disclaimer, I am one of AwesomeWM maintainer. Someone reported a similar bug on Discord a while back, but I didn't believe it at the time and blamed a buggy graphic driver. Since the SVG also doesn't render, it confirms this has nothing to do with X or the DRM driver. Since `ltrace` shows the `rectangle` call and the SVG doesn't have it, means this is somewhere around the Cairo backend execution, but not the outout container itself). ```sh Portage 3.0.65 (python 3.12.4-final-0, default/linux/amd64/23.0/systemd, gcc-13, glibc-2.40, 6.10.3-gentoo-dist x86_64) ================================================================= System uname: Linux-6.10.3-gentoo-dist-x86_64-Intel-R-_Core-TM-_i7-8565U_CPU_@_1.80GHz-with-glibc2.40 KiB Mem: 16175700 total, 317328 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Sun, 04 Aug 2024 06:30:00 +0000 Head commit of repository gentoo: 785fabc290082f78800b8550af716304098d0521 sh bash 5.2_p32 ld GNU ld (Gentoo 2.42 p6) 2.42.0 app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.2_p32::gentoo dev-build/autoconf: 2.71-r7::gentoo, 2.72-r1::gentoo dev-build/automake: 1.16.5-r2::gentoo, 1.17-r1::gentoo dev-build/cmake: 3.30.1::gentoo dev-build/libtool: 2.4.7-r4::gentoo dev-build/make: 4.4.1-r1::gentoo dev-build/meson: 1.5.0::gentoo dev-lang/perl: 5.40.0::gentoo dev-lang/python: 3.12.4_p2::gentoo, 3.13.0_beta4::gentoo dev-lang/rust-bin: 1.79.0::gentoo sys-apps/baselayout: 2.15::gentoo sys-apps/sandbox: 2.39::gentoo sys-apps/systemd: 256.2::gentoo sys-devel/binutils: 2.42-r2::gentoo sys-devel/binutils-config: 5.5.2::gentoo sys-devel/clang: 17.0.6::gentoo, 18.1.8::gentoo sys-devel/gcc: 13.2.1_p20240210::gentoo, 14.1.1_p20240622::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/llvm: 17.0.6-r2::gentoo, 18.1.8-r1::gentoo sys-kernel/linux-headers: 6.9::gentoo (virtual/os-headers) sys-libs/glibc: 2.40::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-jobs: 1 sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 3 sync-rsync-extra-opts: Binary Repositories: gentoobinhost priority: 1 sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE dlj-1.1 skype-eula googleearth AdobeFlash-9.0.31.0 AdobeFlash-10 AdobeFlash-10.1 Oracle-BCLA-JavaSE google-chrome NVIDIA-r2 linux-fw-redistributable" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O3 -march=native -mtune=native -msse -msse2 -msse3 -mmmx -mno-3dnow -pipe -frename-registers -ftree-vectorize -fweb -fomit-frame-pointer -freorder-blocks -fno-ident -fmerge-all-constants -ftree-loop-im -fno-stack-protector -fgcse-after-reload -mfpmath=sse -mtune=native -fPIC -ggdb -g3 -w" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /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/sandbox.d" CXXFLAGS="-O3 -march=native -mtune=native -msse -msse2 -msse3 -mmmx -mno-3dnow -pipe -frename-registers -ftree-vectorize -fweb -fomit-frame-pointer -freorder-blocks -fno-ident -fmerge-all-constants -ftree-loop-im -fno-stack-protector -fgcse-after-reload -mfpmath=sse -mtune=native -fPIC -ggdb -g3 -w" DISTDIR="/var/cache/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="-O2 -pipe" 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 merge-wait metadata-transfer 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="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="C.UTF8" LDFLAGS="-Wl,--hash-style=gnu,--as-needed,-O1" LEX="flex" MAKEOPTS=" -j4 -s" 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" SHELL="/bin/bash" USE="7Zip 7z X a52 aaa aac aalib acl acpi aiglx alsa amd64 apm avi bash-completion bidi blender-game bluetooth btrfs bzip2 c c++0x c++11 cd-r cdda cddb cdio cet cg cpp crypt css cxx dbus directfb divx double-precision dri drm dts dv dvb encode exif faad fat ffmpeg flac flash freeimage freetype ftp g3dvl gdbm geolocation gif glitz gpu graphite h264 hashstyle html httpd icecast iconv introspection ipv6 irc jpeg kde kdeenablefinal kf6compat kvm libnotify libtirpc live lm_sensors lto lua luajit lzma m4a m4p m4v mad matroska mdnsresponder mdnsresponder-compat mmx mmxext mp2 mp3 mp4 mpeg mplayer multilib mysql mythtv ncurses nptl nvenc ogg oggvorbis openal opencl openexr opengl openmp optimisememory oss pam pam-console pcre pdf pdfimport png pnm povray qml qt3support qt5 qt6 quicktime radio rar readline real realmedia sdl seccomp server skins smp spell spice sqlite sqlite3 sse sse2 sse3 ssl ssse3 startup-notification stream svg systemd szip test-rust theora threads truetype udev udisks unicode upnp usb v4l v4l2 vaapi vcd vdpau virt-network vlc vlm vorbis webdav-neon webm win32codecs wmf wmp x264 xattr xcomposite xephyr xine xinerama xpm xscreensaver xulrunner xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_12" ALSA_CARDS="hda-intel" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" 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="keyboard mouse evdev lirc" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="luajit lua5-1" LUA_TARGETS="luajit" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" QEMU_SOFTMMU_TARGETS="arm i386 x86_64 kvm" QEMU_USER_TARGETS="arm i386 x86_64 kvm" RUBY_TARGETS="ruby21" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS ```
(In reply to Emmanuel Lepage Vallee from comment #3) Sorry, I thought I replied already. Just want to say thanks for getting it. Having to communicate that part is often the trickiest bit. Once you have it nailed down (even if you need more hints or help then), let me know and I'll try my best.