Search code examples
gccgentoodistcc

<Gentoo Portage> Complation with distcc failed due to the header difference


I'm currently using two laptops. First one is my local one installed gentoo linux on it and second one is my remote machine installed ubuntu on it. And my local one has not so great hardware, I tried distcc to shorten the compilation time on it. So I installed distcc on both my local and remote machine.

I seems works just fine in majority of the time but then this happened.

distcc[310] ERROR: compile ../../deps/v8/third_party/abseil-cpp/absl/crc/crc32c.cc on 192.168.0.4 failed
distcc[310] (dcc_build_somewhere) Warning: remote compilation of '../../deps/v8/third_party/abseil-cpp/absl/crc/crc32c.cc' failed, retrying locally
distcc[310] (dcc_mark_timefile) mark /var/tmp/portage/.distcc/lock/backoff_tcp_192.168.0.4_3632_0
distcc[310] (dcc_build_somewhere) ERROR: failed to distribute and fallbacks are disabled
In file included from /usr/lib/gcc/x86_64-linux-gnu/13/include/immintrin.h:129,
                 from /usr/lib/gcc/x86_64-linux-gnu/13/include/x86intrin.h:32,
                 from ../../deps/v8/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h:33,
                 from ../../deps/v8/third_party/abseil-cpp/absl/crc/internal/crc32c_inline.h:22,
                 from ../../deps/v8/third_party/abseil-cpp/absl/crc/crc32c.h:31,
                 from ../../deps/v8/third_party/abseil-cpp/absl/crc/crc32c.cc:15:
/usr/lib/gcc/x86_64-linux-gnu/13/include/amxtileintrin.h: In function ‘void _tile_loadconfig(const void*)’:
/usr/lib/gcc/x86_64-linux-gnu/13/include/amxtileintrin.h:42:3: error: ‘__builtin_ia32_ldtilecfg’ was not declared in this scope; did you mean ‘__builtin_ia32_rdtscp’?
   42 |   __asm__ volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config)));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
      |   __builtin_ia32_rdtscp
/usr/lib/gcc/x86_64-linux-gnu/13/include/amxtileintrin.h: In function ‘void _tile_storeconfig(void*)’:
/usr/lib/gcc/x86_64-linux-gnu/13/include/amxtileintrin.h:49:3: error: ‘__builtin_ia32_sttilecfg’ was not declared in this scope; did you mean ‘__builtin_ia32_stui’?
   49 |   __asm__ volatile ("sttilecfg\t%X0" : "=m" (*((void **)__config)));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
      |   __builtin_ia32_stui

I matched the version of gcc/g++ and even triplet. The only difference between them is, I guess, local one is built with hardware specific tunes whereas the remote one is just general binary form.

And I checked the problematic headers and indeed they are different. The header was /usr/lib/gcc/x86_64-linux-gnu/13/include/amxtileintrin.h:42

local one is:

#if defined(__x86_64__)
extern __inline void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_tile_loadconfig (const void *__config)
{
  __builtin_ia32_ldtilecfg (__config);
}

and remote one is:

#if defined(__x86_64__) 
extern __inline void 
__attribute__((__gnu_inline__, __always_inline__, __artificial__)) 
_tile_loadconfig (const void *__config) 
{ 
  __asm__ volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config))); 
} 

Since it's the intrinsic or something. (I assumed because the header says don't include it directly.)

I think the problem is that the fact gcc of my local machine is built specifically for that very machine and so is the headers. But, shouldn't distcc just resolve that differences and works?

Why this problem is occurred and how to fix it?

FYI: gcc --verbose on local

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
Target: x86_64-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-13.3.1_p20240614/work/gcc-13-20240614/configure --host=x86_64-linux-gnu --build=x86_64-linux-gnu --prefix=/usr --bindir=/usr/x86_64-linux-gnu/gcc-bin/13 --includedir=/usr/lib/gcc/x86_64-linux-gnu/13/include --datadir=/usr/share/gcc-data/x86_64-linux-gnu/13 --mandir=/usr/share/gcc-data/x86_64-linux-gnu/13/man --infodir=/usr/share/gcc-data/x86_64-linux-gnu/13/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-linux-gnu/13/include/g++-v13 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-linux-gnu/13/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 13.3.1_p20240614 p1' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-cet
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.1 20240614 (Gentoo 13.3.1_p20240614 p1) 
Using built-in specs.

gcc --verbose on remote

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-4ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-XYspKM/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-XYspKM/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Ubuntu 13.2.0-4ubuntu3)

Thank you in advance.


Solution

  • It turns out 0.1 difference in gcc version matters. I assumed it was not the case because it's just minor version and only differs by 1.

    But the builtin function I mentioned was newly introduced in gcc version 13.3.

    So I manually install gcc 13.3 on my remote machine and it works now.

    for short: minor version matters.