Hi. I'm trying to build caffe2 for pytorch and it fails to build without a compilation error: ninja: build stopped: subcommand failed. * ERROR: sci-libs/caffe2-2.2.1-r1::gentoo failed (compile phase): * ninja -v -j32 -l32 failed * * Call stack: * ebuild.sh, line 136: Called src_compile * environment, line 3255: Called cmake_src_compile * environment, line 1330: Called cmake_build * environment, line 1297: Called eninja * environment, line 1878: Called die * The specific snippet of code: * "$@" || die -n "${*} failed"
Created attachment 889403 [details] The build log.
Created attachment 889404 [details] The emerge --info output
Created attachment 889405 [details] The build environment.
*** Bug 928579 has been marked as a duplicate of this bug. ***
> nvcc fatal : Unsupported gpu architecture 'compute_35' > WARNING: caffe2 is being built with its default CUDA compute capabilities: 3.5 and 7.0. > These may not be optimal for your GPU. > > To configure caffe2 with the CUDA compute capability that is optimal for your GPU, > set TORCH_CUDA_ARCH_LIST in your make.conf, and re-emerge caffe2. > For example, to use CUDA capability 7.5 & 3.5, add: TORCH_CUDA_ARCH_LIST=7.5 3.5 > For a Maxwell model GPU, an example value would be: TORCH_CUDA_ARCH_LIST=Maxwell > > You can look up your GPU's CUDA compute capability at https://developer.nvidia.com/cuda-gpus > or by running /opt/cuda/extras/demo_suite/deviceQuery | grep 'CUDA Capability' Nevertheless nvidia-cuda-toolkit-12 only supports 5.0+.
I added TORCH_CUDA_ARCH_LIST="6.1" and I still get the same error.
I've tried switching CFLAGS to "march=native -O2 pipe" and using GCC12 & GCC13 and it fails in both cases even though arch=compute_61. I honestly don't have any other ideas and the error is not descriptive.
Can you add a the build.log for TORCH_CUDA_ARCH_LIST="6.1"?
Created attachment 889534 [details] This is the build log after setting TORCH_CUDA_ARCH_LIST and using GCC12 So I got a similar error in https://bugs.gentoo.org/928605 with media-libs/opencv and I was able to fix it by using GCC12 (as well as disabling the sandbox) based on this Reddit post: https://www.reddit.com/r/Gentoo/comments/1arlsfi/cuda_gcc_too_recent/. However, I have not been able to fix sci-libs/caffe2 with the same approach.
The CC="gcc-12" CXX="g++-12" is causing: > /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libprotobuf.so.23.3.0: undefined reference to `std::ios_base_library_init()@GLIBCXX_3.4.32' > /usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libprotobuf.so.23.3.0: undefined reference to `__cxa_call_terminate@CXXABI_1.3.15' Meaning protobuf was compiled with gcc-13. You don't _ever_ need to set CC or CXX to make cuda work. For most cuda related packages you only need to set the cuda host compiler and the arch. See https://wiki.gentoo.org/wiki/User:Negril/CUDA. For caffe2 you need to add for now: > export TORCH_CUDA_ARCH_LIST="6.1" Making the full env file: > CUDA_VERBOSE="false" > CUDAHOSTCXX="/usr/x86_64-pc-linux-gnu/gcc-bin/12" > TORCH_CUDA_ARCH_LIST="6.1"
Created attachment 889965 [details] The new (3rd) build.log. Hi. So I rebuilt world and now the error I'm getting when building caffe2 is: CMake Error in torch/CMakeLists.txt: Imported target "pybind::pybind11" includes non-existent path "/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. CMake Error in torch/CMakeLists.txt: Imported target "pybind::pybind11" includes non-existent path "/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. CMake Error in torch/CMakeLists.txt: Imported target "pybind::pybind11" includes non-existent path "/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide. CMake Error in functorch/CMakeLists.txt: Imported target "pybind::pybind11" includes non-existent path "/include" in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include: * The path was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and references files it does not provide.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e11aa2639192352d26804f1e45136343ea95844 commit 7e11aa2639192352d26804f1e45136343ea95844 Author: Alfredo Tupone <tupone@gentoo.org> AuthorDate: 2024-10-27 14:00:28 +0000 Commit: Alfredo Tupone <tupone@gentoo.org> CommitDate: 2024-10-27 14:00:28 +0000 sci-libs/caffe2: drop 2.3.0-r3, 2.3.1 Closes: https://bugs.gentoo.org/942335 Closes: https://bugs.gentoo.org/928580 Signed-off-by: Alfredo Tupone <tupone@gentoo.org> sci-libs/caffe2/Manifest | 2 - sci-libs/caffe2/caffe2-2.3.0-r3.ebuild | 294 --------------------------------- sci-libs/caffe2/caffe2-2.3.1.ebuild | 294 --------------------------------- sci-libs/caffe2/metadata.xml | 2 - 4 files changed, 592 deletions(-)
The bug is still there for me. By the way, I believe ninja is supposed to output the command that failed, but it outputs the failed command to stderr, so there might be a problem with redirection of errors in this ebuild. here is my emerge --info '=sci-ml/caffe2-2.7.0::gentoo' Portage 3.0.67 (python 3.13.3-final-0, default/linux/amd64/23.0/desktop, gcc-14, glibc-2.40-r8, 6.6.58-gentoo-r1 x86_64) ================================================================= System Settings ================================================================= System uname: Linux-6.6.58-gentoo-r1-x86_64-13th_Gen_Intel-R-_Core-TM-_i9-13900K-with-glibc2.40 KiB Mem: 30440404 total, 8940224 free KiB Swap: 0 total, 0 free Timestamp of repository vowstar: Thu, 01 May 2025 11:57:16 +0000 Head commit of repository vowstar: 1aed6e05e8cd21498e552dd93070046106eef9b0 Timestamp of repository gentoo: Fri, 02 May 2025 02:45:00 +0000 Head commit of repository gentoo: 453f7fa523bebf196d46e3ad3207a3684a9ffa82 sh bash 5.2_p37 ld GNU ld (Gentoo 2.44 p1) 2.44.0 app-misc/pax-utils: 1.3.8::gentoo app-shells/bash: 5.2_p37::gentoo dev-build/autoconf: 2.13-r8::gentoo, 2.72-r1::gentoo dev-build/automake: 1.16.5-r2::gentoo, 1.17-r1::gentoo dev-build/cmake: 3.31.5::gentoo dev-build/libtool: 2.5.4::gentoo dev-build/make: 4.4.1-r100::gentoo dev-build/meson: 1.7.0::gentoo dev-java/java-config: 2.3.4::gentoo dev-lang/perl: 5.40.2::gentoo dev-lang/python: 3.11.10_p1::gentoo, 3.12.10::gentoo, 3.13.3::gentoo dev-lang/rust-bin: 1.81.0-r100::gentoo, 1.84.1-r2::gentoo, 1.85.1::gentoo llvm-core/clang: 18.1.8-r6::gentoo, 19.1.7::gentoo llvm-core/lld: 18.1.8::gentoo, 19.1.7::gentoo llvm-core/llvm: 18.1.8-r6::gentoo, 19.1.7::gentoo sys-apps/baselayout: 2.17::gentoo sys-apps/openrc: 0.56::gentoo sys-apps/sandbox: 2.39::gentoo sys-devel/binutils: 2.42-r2::gentoo, 2.44::gentoo sys-devel/binutils-config: 5.5.2::gentoo sys-devel/gcc: 13.3.1_p20241025::gentoo, 14.2.1_p20241221::gentoo sys-devel/gcc-config: 2.12.1::gentoo sys-kernel/linux-headers: 6.12::gentoo (virtual/os-headers) sys-libs/glibc: 2.40-r8::gentoo Repositories: vowstar location: /var/db/repos/vowstar sync-type: git sync-uri: https://github.com/gentoo-mirror/vowstar.git masters: gentoo priority: -1001 volatile: False 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-max-age: 3 sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 Binary Repositories: gentoobinhost priority: 1 sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE @FREE linux-fw-redistributable" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=36864 -O2 -pipe" 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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=36864 -O2 -pipe" 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="-march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=36864 -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 multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=36864 -O2 -pipe" GENTOO_MIRRORS="https://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ rsync://mirror.csclub.uwaterloo.ca/gentoo-distfiles http://gentoo.mirrors.tera-byte.com/ rsync://mirrors.tera-byte.com/gentoo" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs" LEX="flex" MAKEOPTS="-j33" 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="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cet crypt cups dbus dri dts dvd dvdr elogind emacs encode exif ffmpeg flac gdbm gif gpm gtk gui iconv icu imagemagick ipv6 jpeg lcms libnotify libtirpc lock lto mad mng mp3 mp4 mpeg multilib ncurses nls nvenc ogg opengl openmp pam pango pcre pdf pipewire png policykit ppds qml qt5 qt6 readline sdl seccomp session sound spell ssl startup-notification svg test-rust threads tiff truetype udev udisks unicode upower usb v4l vaapi vdpau vorbis vulkan wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_14" 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 avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="evdev libinput" KERNEL="linux" 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-2" POSTGRES_TARGETS="postgres17" PYTHON_SINGLE_TARGET="python3_13" PYTHON_TARGETS="python3_13" RUBY_TARGETS="ruby32" VIDEO_CARDS="nvidia 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 Judge Dredd from comment #13) > The bug is still there for me. I forgot to clarify this: I get the same error message from ninja as the original poster, but without the failed command in build.log.
(In reply to Judge Dredd from comment #14) > (In reply to Judge Dredd from comment #13) > > The bug is still there for me. > > I forgot to clarify this: I get the same error message from ninja as the > original poster, but without the failed command in build.log. Please open a new bug and add your build.log