Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 934337 - dev-libs/protobuf (any version) fails to build with -march=ivybridge
Summary: dev-libs/protobuf (any version) fails to build with -march=ivybridge
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal with 2 votes (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: gcc-14
  Show dependency tree
 
Reported: 2024-06-15 08:07 UTC by Xavier Miller
Modified: 2024-06-26 23:17 UTC (History)
7 users (show)

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


Attachments
build.log (build.log,55.91 KB, text/x-log)
2024-06-15 08:08 UTC, Xavier Miller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Miller 2024-06-15 08:07:09 UTC
fails on a Intel Ivy Brige target, OK on other systems (AMDK8, arm64, armv7, other Intel arches) 

[48/217] /usr/bin/x86_64-pc-linux-gnu-g++ -DGOOGLE_PROTOBUF_CMAKE_BUILD -DGOOGLE_PROTOBUF_NO_RTTI=1 -DHAVE_ZLIB -DLIBPROTOBUF_EXPORTS -DPROTOBUF_USE_DLLS -Dlibprotobuf_EXPORTS -I/var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23
.3_build-abi_x86_64.amd64 -I/var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src -I/var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/third_party/utf8_range  -O2 -pipe -fomit-frame-pointer -march=ivybridge -mtune=
ivybridge -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT CMakeFiles/libprotobuf.dir/src/google/protobuf/json/internal/writer.cc.o -MF CMakeFiles/libprotobuf.dir/src/google/protobuf/json/internal/writer.cc.o.d -o CMakeFiles
/libprotobuf.dir/src/google/protobuf/json/internal/writer.cc.o -c /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/json/internal/writer.cc                                                                  
FAILED: CMakeFiles/libprotobuf.dir/src/google/protobuf/json/internal/writer.cc.o                                                                                                                                                             
/usr/bin/x86_64-pc-linux-gnu-g++ -DGOOGLE_PROTOBUF_CMAKE_BUILD -DGOOGLE_PROTOBUF_NO_RTTI=1 -DHAVE_ZLIB -DLIBPROTOBUF_EXPORTS -DPROTOBUF_USE_DLLS -Dlibprotobuf_EXPORTS -I/var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3_build-
abi_x86_64.amd64 -I/var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src -I/var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/third_party/utf8_range  -O2 -pipe -fomit-frame-pointer -march=ivybridge -mtune=ivybridge
 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT CMakeFiles/libprotobuf.dir/src/google/protobuf/json/internal/writer.cc.o -MF CMakeFiles/libprotobuf.dir/src/google/protobuf/json/internal/writer.cc.o.d -o CMakeFiles/libproto
buf.dir/src/google/protobuf/json/internal/writer.cc.o -c /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/json/internal/writer.cc                                                                           
In file included from /usr/include/absl/numeric/bits.h:48,                                                                                                                                                                                   
                 from /usr/include/absl/strings/cord_buffer.h:36,                                                                                                                                                                            
                 from /usr/include/absl/strings/cord.h:83,                                                                                                                                                                                   
                 from /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/io/zero_copy_stream.h:111,                                                                                                           
                 from /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/io/zero_copy_sink.h:36,                                                                                                              
                 from /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/json/internal/writer.h:48,                                                                                                           
                 from /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/json/internal/writer.cc:31:                                                                                                          
In function ‘constexpr int absl::lts_20230802::numeric_internal::CountLeadingZeroes16(uint16_t)’,                                                                                                                                            
    inlined from ‘constexpr int absl::lts_20230802::numeric_internal::CountLeadingZeroes(T) [with T = unsigned char]’ at /usr/include/absl/numeric/internal/bits.h:240:36,                                                                   
    inlined from ‘constexpr typename std::enable_if<std::is_unsigned<_Tp>::value, int>::type absl::lts_20230802::countl_zero(T) [with T = unsigned char]’ at /usr/include/absl/numeric/bits.h:78:46,                                         
    inlined from ‘constexpr typename std::enable_if<std::is_unsigned<_Tp>::value, int>::type absl::lts_20230802::countl_one(T) [with T = unsigned char]’ at /usr/include/absl/numeric/bits.h:86:21,                                          
    inlined from ‘google::protobuf::json_internal::Utf8Scalar google::protobuf::json_internal::ConsumeUtf8Scalar(absl::lts_20230802::string_view&)’ at /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/json
/internal/writer.cc:168:27,                                                                                                                                                                                                                  
    inlined from ‘void google::protobuf::json_internal::JsonWriter::WriteEscapedUtf8(absl::lts_20230802::string_view)’ at /var/tmp/portage/dev-libs/protobuf-23.3-r4/work/protobuf-23.3/src/google/protobuf/json/internal/writer.cc:294:36:  
/usr/include/absl/numeric/internal/bits.h:173:38: error: ‘__builtin_clzs’ needs isa option -mlzcnt                                                                                                                                           
  173 |   return x == 0 ? 16 : __builtin_clzs(x);                                                                                                                                                                                            
      |                        ~~~~~~~~~~~~~~^~~                                                                                                                                                                                             


Reproducible: Always




# emerge --info '=dev-libs/protobuf-23.3-r4::gentoo'
Portage 3.0.65 (python 3.12.4-final-0, default/linux/amd64/23.0/no-multilib, gcc-14, glibc-2.39-r9, 6.9.4 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.9.4-x86_64-Intel-R-_Core-TM-_i5-3340M_CPU_@_2.70GHz-with-glibc2.39
KiB Mem:    16276124 total,  15182880 free
KiB Swap:   16777056 total,  16777056 free
Timestamp of repository gentoo: Fri, 14 Jun 2024 15:34:02 +0000
Timestamp of repository guru: Fri, 14 Jun 2024 12:36:12 +0000
sh bash 5.2_p26-r3
ld GNU ld (Gentoo 2.42 p3) 2.42.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26-r3::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.29.3::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-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.11.9-r1::gentoo, 3.12.4_p1::gentoo, 3.13.0_beta2_p1::gentoo
dev-lang/rust:             1.78.0::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           18.1.7::gentoo
sys-devel/gcc:             14.1.1_p20240518::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.7::gentoo
sys-devel/llvm:            18.1.7::gentoo
sys-kernel/linux-headers:  6.9::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r9::gentoo
Repositories:

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

audio-overlay
    location: /var/portage/repos/audio-overlay
    masters: gentoo
    volatile: True

guru
    location: /var/portage/repos/guru
    masters: gentoo
    volatile: True

inode64-overlay
    location: /var/portage/repos/inode64-overlay
    masters: gentoo
    volatile: True

local
    location: /usr/local/portage
    masters: gentoo
    volatile: True

crossdev
    location: /data/nas/xavier/portage/e5430/var/db/repos/crossdev
    masters: gentoo
    priority: 10
    volatile: True

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE freedist as-is"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=ivybridge -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul -mcx16 -mf16c -mfsgsbase -mfxsr -msahf -mrdrnd -mxsave -mxsaveopt -mtune=ivybridge"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /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/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=ivybridge -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul -mcx16 -mf16c -mfsgsbase -mfxsr -msahf -mrdrnd -mxsave -mxsaveopt -mtune=ivybridge"
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps y --quiet-build=n --buildpkg"
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 buildpkg buildpkg-live candy config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news 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"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="fr_BE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--as-needed"
LEX="flex"
LINGUAS="fr fr-BE fr-FR nl nl-BE nl-NL en en-GB en-US"
MAKEOPTS="-j7 -l13"
PKGDIR="/var/portage/packages"
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="3dnow 3dnowext X a52 aac acpi alsa amd64 apng branding bzip2 cairo cdda cet crossdev crypt css cups dbus display-manager dlna dri dts dvd egl elogind exif fftw flac fluidsynth gif glamor gles2 gnome-keyring gpm gtk gtk3 gudev gui iconv imagemagick joystick jpeg keyring ladspa lash lcms libcanberra libinput libnotify libsamplerate libtirpc lzma mad midi mmx mng mp3 mpeg mtp ncurses nls ogg opengl openmp opus osc pam pango pcre pdf png policykit powermanagement printsupport python3 qt5 readline rubberband sddm sdl seccomp sna sndfile snmp spell sqlite sse sse2 ssl startup-notification svg symlink system-bootstrap system-llvm test-rust tiff timidity truetype udev udisks unicode upnp upower usb vaapi vdpau vorbis wmf x264 x265 xattr xcb xinerama xkb xml xosd xscreensaver xv xvid xvmc zlib zstd" ABI_X86="64" ADA_TARGET="gcc_12" ALSA_CARDS="hda-intel usb-audio virmidi" 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="aes avx f16c mmx mmxext pclmul popcnt rdrand sse sse2 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" INPUT_DEVICES="keyboard mouse libinput joystick" KERNEL="linux" L10N="fr fr-BE fr-FR nl nl-BE nl-NL en en-GB en-US" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_SLOT="18" LLVM_TARGETS="X86 AMDGPU" 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" QEMU_SOFTMMU_TARGETS="arm i386" QEMU_USER_TARGETS="arm i386" RUBY_TARGETS="ruby31 ruby32" SANE_BACKENDS="hp" VIDEO_CARDS="intel i915" 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, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, 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
Comment 1 Xavier Miller 2024-06-15 08:08:25 UTC
Created attachment 895873 [details]
build.log
Comment 2 Xavier Miller 2024-06-15 08:08:53 UTC
seems related to abseil-cpp but I tried with older versions without any success
Comment 3 Reuben Farrelly 2024-06-16 08:59:56 UTC
I wonder if this is actually caused by gcc-14:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112789

I have the same build problem and I am on the same gcc build too.  But I'm not on an ivybridge processor, on a CPU type of: "KVM Processor v2.0" and the underlying processor as shown in /proc/cpuinfo is an AMD.
Comment 4 Xavier Miller 2024-06-16 09:31:45 UTC
(In reply to Reuben Farrelly from comment #3)
> I wonder if this is actually caused by gcc-14:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112789
> 
> I have the same build problem and I am on the same gcc build too.  But I'm
> not on an ivybridge processor, on a CPU type of: "KVM Processor v2.0" and
> the underlying processor as shown in /proc/cpuinfo is an AMD.

I think the problem is really related to the processor feature requested by protobuf, but not enabled in Intel Ivy Bridge family

if I dump -march=native and -mtune=native, I got -mno-lzcnt in the options.

but even if I add -mno-lzcnt in CFLAGS and rebuild abseil-cpp, protobuf fails because it ask this function that will not work for me.
Comment 5 Xavier Miller 2024-06-16 09:39:19 UTC
I filed a bug at protobuf's GitHub
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-16 09:40:33 UTC
Given we're quite far behind with versions in Gentoo (it's a mess and someone is working on it), I wouldn't assume it's not fixed already upstream.

The code changed in https://github.com/protocolbuffers/protobuf/commit/7315f6d398d2d18443b26c513cbdcdbffaeebaa3 at least.
Comment 7 Xavier Miller 2024-06-16 10:02:08 UTC
(In reply to Sam James from comment #6)
> Given we're quite far behind with versions in Gentoo (it's a mess and
> someone is working on it), I wouldn't assume it's not fixed already upstream.
> 
> The code changed in
> https://github.com/protocolbuffers/protobuf/commit/
> 7315f6d398d2d18443b26c513cbdcdbffaeebaa3 at least.

Hi, Sam!

I did not check that Gentoo in ~arch used a so outdated package...
The patch you link is not sufficient, need more patches or a more recent protobuf release.

I can build protobuf 21.12
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-16 10:12:19 UTC
Hi Xavier!

Thank you for trying to do the right thing as well, not your fault at all, hopefully we can get abseil+protobuf sorted out on our side soon.
Comment 9 Reuben Farrelly 2024-06-17 12:16:03 UTC
(In reply to Reuben Farrelly from comment #3)
> I wonder if this is actually caused by gcc-14:

FTR I have just tested this:

gcc-13 (Gentoo Hardened 13.3.1_p20240614 p17) 13.3.1 20240614 - protobuf 23.3-r4 builds successfully

gcc-14 (Gentoo Hardened 14.1.1_p20240615 p2) 14.1.1 20240615 - protobuf 23.3-r4 fails to build.

It is a workaround at least for anyone who runs into the same problem and finds this bug report.