[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#974710: mipsel: undefined reference to `__divsi3' (fenicsx-performance-tests FTBFS)



Package: gcc-10
Version: 10.2.0-17
Severity: important

On mipsel, fenicsx-performance-tests 0.0~git20201022.8913e0f-1 has
started failing to build.

The main error is "undefined reference to __divsi3'",
as well as __umodsi3

Excerpt from the build log is:

[ 71%] Building CXX object CMakeFiles/dolfinx-scaling-test.dir/mesh.cpp.o
/usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_TIMER_DYN_LINK -DDOLFINX_VERSION=\"2019.2.9.99\" -DEIGEN_MAX_ALIGN_BYTES=32 -DHAS_SLEPC -I"/<<PKGBUILDDIR>>/obj-mipsel-linux-gnu" -I"/<<PKGBUILDDIR>>/src" -isystem /usr/lib/python3/dist-packages/ffcx/codegeneration -isystem /usr/include/eigen3 -isystem /usr/include/hdf5/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include -isystem /usr/lib/petscdir/petsc3.14/mipsel-linux-gnu-real/include -isystem /usr/lib/slepcdir/slepc3.14/mipsel-linux-gnu-real/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -pthread -std=c++17 -march=native -Wall -Wextra -pedantic -Werror -Ofast -o CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o -c "/<<PKGBUILDDIR>>/src/main.cpp"
/usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_TIMER_DYN_LINK -DDOLFINX_VERSION=\"2019.2.9.99\" -DEIGEN_MAX_ALIGN_BYTES=32 -DHAS_SLEPC -I"/<<PKGBUILDDIR>>/obj-mipsel-linux-gnu" -I"/<<PKGBUILDDIR>>/src" -isystem /usr/lib/python3/dist-packages/ffcx/codegeneration -isystem /usr/include/eigen3 -isystem /usr/include/hdf5/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include -isystem /usr/lib/petscdir/petsc3.14/mipsel-linux-gnu-real/include -isystem /usr/lib/slepcdir/slepc3.14/mipsel-linux-gnu-real/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -pthread -std=c++17 -o CMakeFiles/dolfinx-scaling-test.dir/mesh.cpp.o -c "/<<PKGBUILDDIR>>/src/mesh.cpp"
/usr/bin/cc -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_TIMER_DYN_LINK -DDOLFINX_VERSION=\"2019.2.9.99\" -DEIGEN_MAX_ALIGN_BYTES=32 -DHAS_SLEPC -I"/<<PKGBUILDDIR>>/obj-mipsel-linux-gnu" -I"/<<PKGBUILDDIR>>/src" -isystem /usr/lib/python3/dist-packages/ffcx/codegeneration -isystem /usr/include/eigen3 -isystem /usr/include/hdf5/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include -isystem /usr/lib/petscdir/petsc3.14/mipsel-linux-gnu-real/include -isystem /usr/lib/slepcdir/slepc3.14/mipsel-linux-gnu-real/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -pthread -march=native -Ofast -o CMakeFiles/dolfinx-scaling-test.dir/Elasticity.c.o -c "/<<PKGBUILDDIR>>/obj-mipsel-linux-gnu/Elasticity.c"
[ 85%] Building C object CMakeFiles/dolfinx-scaling-test.dir/Poisson.c.o
/usr/bin/cc -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_TIMER_DYN_LINK -DDOLFINX_VERSION=\"2019.2.9.99\" -DEIGEN_MAX_ALIGN_BYTES=32 -DHAS_SLEPC -I"/<<PKGBUILDDIR>>/obj-mipsel-linux-gnu" -I"/<<PKGBUILDDIR>>/src" -isystem /usr/lib/python3/dist-packages/ffcx/codegeneration -isystem /usr/include/eigen3 -isystem /usr/include/hdf5/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include/openmpi -isystem /usr/lib/mipsel-linux-gnu/openmpi/include -isystem /usr/lib/petscdir/petsc3.14/mipsel-linux-gnu-real/include -isystem /usr/lib/slepcdir/slepc3.14/mipsel-linux-gnu-real/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -pthread -march=native -Ofast -o CMakeFiles/dolfinx-scaling-test.dir/Poisson.c.o -c "/<<PKGBUILDDIR>>/obj-mipsel-linux-gnu/Poisson.c"
[100%] Linking CXX executable dolfinx-scaling-test
/usr/bin/c++ -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -Wl,-z,relro -pthread CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o CMakeFiles/dolfinx-scaling-test.dir/mesh.cpp.o CMakeFiles/dolfinx-scaling-test.dir/Elasticity.c.o CMakeFiles/dolfinx-scaling-test.dir/Poisson.c.o -o dolfinx-scaling-test  -Wl,-rpath,/usr/lib/mipsel-linux-gnu/openmpi/lib:/usr/lib/mipsel-linux-gnu/hdf5/openmpi:/usr/lib/slepcdir/slepc3.14/mipsel-linux-gnu-real/lib:/usr/lib/petscdir/petsc3.14/mipsel-linux-gnu-real/lib: /usr/lib/mipsel-linux-gnu/libdolfinx_real.so.2019.2.9.99 /usr/lib/mipsel-linux-gnu/libboost_program_options.so.1.71.0 /usr/lib/mipsel-linux-gnu/libboost_timer.so.1.71.0 /usr/lib/mipsel-linux-gnu/libboost_chrono.so.1.71.0 /usr/lib/mipsel-linux-gnu/openmpi/lib/libmpi_cxx.so /usr/lib/mipsel-linux-gnu/openmpi/lib/libmpi.so /usr/lib/mipsel-linux-gnu/hdf5/openmpi/libhdf5.so /usr/lib/mipsel-linux-gnu/libsz.so /usr/lib/mipsel-linux-gnu/libz.so /usr/lib/mipsel-linux-gnu/libdl.so /usr/lib/mipsel-linux-gnu/libm.so /usr/lib/slepcdir/slepc3.14/mipsel-linux-gnu-real/lib/libslepc_real.so /usr/lib/petscdir/petsc3.14/mipsel-linux-gnu-real/lib/libpetsc_real.so
/usr/bin/ld: CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o: in function `void Eigen::internal::check_rows_cols_for_overflow<-1>::run<int>(int, int)':
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
/usr/bin/ld: /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
/usr/bin/ld: /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
/usr/bin/ld: /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
/usr/bin/ld: /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
/usr/bin/ld: CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o:/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: more undefined references to `__divsi3' follow
/usr/bin/ld: CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o: in function `unsigned int std::__detail::__to_chars_len<unsigned int>(unsigned int, int)':
/usr/include/c++/10/bits/charconv.h:61: undefined reference to `__udivsi3'
/usr/bin/ld: /usr/include/c++/10/bits/charconv.h:62: undefined reference to `__udivsi3'
/usr/bin/ld: CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o: in function `void std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int)':
/usr/include/c++/10/bits/charconv.h:86: undefined reference to `__umodsi3'
/usr/bin/ld: /usr/include/c++/10/bits/charconv.h:86: undefined reference to `__umodsi3'
/usr/bin/ld: /usr/include/c++/10/bits/charconv.h:87: undefined reference to `__udivsi3'
/usr/bin/ld: /usr/include/c++/10/bits/charconv.h:87: undefined reference to `__udivsi3'
/usr/bin/ld: CMakeFiles/dolfinx-scaling-test.dir/main.cpp.o: in function `void Eigen::internal::check_rows_cols_for_overflow<-1>::run<int>(int, int)':
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
/usr/bin/ld: /usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:46: undefined reference to `__divsi3'
collect2: error: ld returned 1 exit status

Full log at
https://buildd.debian.org/status/logs.php?pkg=fenicsx-performance-tests&arch=mipsel
https://buildd.debian.org/status/fetch.php?pkg=fenicsx-performance-tests&arch=mipsel&ver=0.0%7Egit20201022.8913e0f-1&stamp=1605323049&raw=0


The error message doesn't really make sense in the context of
fenicsx-performance-tests itself, or in eigen3 where the error is
triggered (noting also it is triggered in
/usr/include/c++/10/bits/charconv.h)

Discussing at #debian-devel on IRC, Jessica Clarke suggests the use of
-march=native may be involved. gcc docs say this flag is supposed to
be supported on mipsel.  Is there a bug here selecting the appropriate
processor?

Jessica's diagnosis from IRC:
<jrtc27> uh yeah that shouldn't be happening, mipsel can do division in hardware so doesn't have the si libfuncs (only the di ones for 64-bit integers)
...
<jrtc27> my guess would be that something about the loongson3a-specific division instructions breaks
...
<jrtc27> it'd be interesting to see what gcc things -march=native is on that buildd
<jrtc27> there's some hairy logic that disables the traditional mips mul/div on loongson architectures
<jrtc27> with the intent that the loongson-specific patterns then match
...
<jrtc27> -march=gs464 -mno-loongson-ext
<jrtc27> tor -march=loongson3a -mno-loongson-ext
<jrtc27> *or
<jrtc27> that gets gcc to emit libcalls, not hard float instructions
<Rizzer> could it be a bug in the latest gcc10? march=native picking the wrong processor?
<jrtc27> there's at least one bug in gcc
<Rizzer> nothing mips-specific in the changelog for recent uploads though
<jrtc27> I don't know what exactly -march=native decides; maybe -mno-loongson-ext is intended, maybe not
<jrtc27> but regardless, loongson3a without loongson-ext *should* fall back on the traditional mips instructions
<jrtc27> ISA_AVOID_DIV_HILO however doesn't account for TARGET_LOONGSON_EXT being false
<jrtc27> when TARGET_GS464 is true
<jrtc27> as the loongson division instructions are gated on TARGET_LOONGSON_2EF || TARGET_LOONGSON_EXT
<Rizzer> How certain is it a bug in gcc-10?  Is it certain enough for me to file a bug report against gcc-10 ?
<jrtc27> 99%
<jrtc27> well, 100% really
<jrtc27> if it means to use the libcalls in that weird case, it needs to include the functions in libgcc
<jrtc27> but I'm 99.99999% sure it doesn't want to use soft ... division


Jessica prepared a minimal test case to reproduce the problem at http://paste.debian.net/1172394/
(sid_mipsel-dchroot)$ echo 'int div(int x, int y) { return x / y; } int mod(int x, int y) { return x % y; }' | cc -x c - -o - -S -march=loongson3a -mno-loongson-ext | grep si3
	.globl	__divsi3
	lw	$2,%call16(__divsi3)($28)
	.reloc	1f,R_MIPS_JALR,__divsi3
	.globl	__modsi3
	lw	$2,%call16(__modsi3)($28)
	.reloc	1f,R_MIPS_JALR,__modsi3
	
	


Reply to: