Compiling glibc from source fails in avx headers with: "cannot convert a value of type x to vector type y which has different size"

Viewed 214

I have been trying to build a GNU toolchain that targets my host machine (you could call this a cross compiler or a compiler with a prefix). I have been following these instructions, but differing from them in some of my configuration options and my code versions. I make it to step 6 fine, where I need to build glibc in full. Once there, I get the following compilation error:

In file included from /usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/immintrin.h:55,
                 from /usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/x86intrin.h:32,
                 from ../sysdeps/unix/sysv/linux/x86/hle.h:5,
                 from ../sysdeps/unix/sysv/linux/x86/elision-lock.c:22:
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h: In function '_mm_roundscale_round_ss':
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h:9147:10: error: cannot convert a value of type 'int' to vector type '__vector(4) float' which has different size
 9147 |          (__v4sf) __B, __imm, __R);
      |          ^
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h: In function '_mm_roundscale_round_sd':
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h:9156:11: error: cannot convert a value of type 'int' to vector type '__vector(2) double' which has different size
 9156 |           (__v2df) __B, __imm, __R);
      |           ^
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h: In function '_mm_roundscale_ss':
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h:14789:10: error: cannot convert a value of type 'int' to vector type '__vector(4) float' which has different size
14789 |          _MM_FROUND_CUR_DIRECTION);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h: In function '_mm_roundscale_sd':
/usr/local/gnu-cross/lib/gcc/x86_64-linux-gnu/9.2.0/include/avx512fintrin.h:14798:10: error: cannot convert a value of type 'int' to vector type '__vector(2) double' which has different size
14798 |          _MM_FROUND_CUR_DIRECTION);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [/home/<user>/src/gnu_src/env-prep/preshing/build-glibc/sysd-rules:77: /home/<user>/src/gnu_src/env-prep/preshing/build-glibc/nptl/elision-lock.o] Error 1
make[2]: Leaving directory '/home/<user>/src/gnu_src/env-prep/preshing/glibc-2.32/nptl'
make[1]: *** [Makefile:470: nptl/subdir_lib] Error 2
make[1]: Leaving directory '/home/<user>/src/gnu_src/env-prep/preshing/glibc-2.32'
make: *** [Makefile:9: all] Error 2

I am unsure how to go about fixing this error, and I have found next-to-no information online regarding it. I thought that disabling AVX when compiling might fix this, but I would like to stay away from that if possible (I also didn't see a direct way to do this while compiling glibc).

The versions of the source I am building are below. I am able to change the glibc version, but the others need to stay the same (I am doing comparisons of GNU-specific and musl-specific toolchains).

  • binutils-2.33.1
  • glibc-2.32
  • gcc-9.2.0
  • gmp-6.1.2
  • mpc-1.1.0
  • mpfr-4.0.2

My system has gcc-10.2.1 and glibc-2.31.

My differing configurations are as follows:

# binutils
../binutils-2.33.1/configure --prefix=/usr/local/gnu-cross --target=x86_64-linux-gnu --disable-multilib --enable-deterministic-archives --disable-separate-code --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --with-sysroot=/usr/local/gnu-cross/x86_64-linux-gnu

# gcc
../gcc-9.2.0/configure \
    --prefix=/usr/local/gnu-cross \
    --target=x86_64-linux-gnu \
    --build=x86_64-pc-linux-gnu \
    --host=x86_64-pc-linux-gnu \
    --with-sysroot=/usr/local/gnu-cross/x86_64-linux-gnu \
    --with-native-system-header-dir=/include \
    --enable-languages=c,c++                \
    --enable-default-pie                    \
    --disable-assembly                  \
    --disable-werror                    \
    --disable-multilib                  \
    --enable-tls                        \
    --disable-libmudflap                    \
    --disable-libsanitizer                  \
    --disable-gnu-indirect-function             \
    --disable-libmpx                    \
    --enable-libstdcxx-time=rt

# glibc
../glibc-2.32/configure --prefix=/usr/local/gnu-cross/x86_64-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-headers=/usr/local/gnu-cross/x86_64-linux-gnu/include --disable-multilib libc_cv_forced_unwind=yes

Thank you for your help!

UPDATE

I tried dialing back my configure options to the basic ones in the article linked above, but I still get the same errors. This leads me to believe that the errors are the result of a missing step or that the steps laid out in the article are dated.

0 Answers
Related