r/programminghelp • u/itsfakenoone • 2h ago
C Compiling gcc: Undefined references
I am trying to compile gcc from source. I have the source, I got the prerequisites (had to separately install some stuff: gmp, mpfr, mpc), and then I go into the gcc build folder and configure using the command
../gcc-16.2.0-source/configure --prefix="$HOME/downloads/gcc-16.2.0-install" LDFLAGS="-L$HOME/downloads/mpfr-4.2.2-install/lib -t -lm" --disable-multilib(Without the LDFLAGS thing it would complain it couldn't find the gmp/mpfr/mpc libraries)
And then I run "make", and after a long time it shows
fold-const-call.o: In function `fold_const_call_sss(real_value*, combined_fn, real_value const*, real_value const*, real_format const*)':
fold-const-call.cc:(.text+0x624): undefined reference to `mpfr_atan2pi'
fold-const-call.o: In function `fold_const_call_1(combined_fn, tree_node*, tree_node*)':
fold-const-call.cc:(.text+0x2c55): undefined reference to `mpfr_cospi'
fold-const-call.cc:(.text+0x2c72): undefined reference to `mpfr_atanpi'
fold-const-call.cc:(.text+0x2cc8): undefined reference to `mpfr_asinpi'
fold-const-call.cc:(.text+0x2ced): undefined reference to `mpfr_sinpi'
fold-const-call.cc:(.text+0x2d0a): undefined reference to `mpfr_tanpi'
fold-const-call.cc:(.text+0x377b): undefined reference to `mpfr_acospi'
fold-const-call.o: In function `fold_const_call_sss(real_value*, combined_fn, real_value const*, real_value const*, real_format const*)':
fold-const-call.cc:(.text+0x624): undefined reference to `mpfr_atan2pi'
fold-const-call.o: In function `fold_const_call_1(combined_fn, tree_node*, tree_node*)':
fold-const-call.cc:(.text+0x2c55): undefined reference to `mpfr_cospi'
fold-const-call.cc:(.text+0x2c72): undefined reference to `mpfr_atanpi'
fold-const-call.cc:(.text+0x2cc8): undefined reference to `mpfr_asinpi'
fold-const-call.cc:(.text+0x2ced): undefined reference to `mpfr_sinpi'
fold-const-call.cc:(.text+0x2d0a): undefined reference to `mpfr_tanpi'
fold-const-call.cc:(.text+0x377b): undefined reference to `mpfr_acospi'
fortran/simplify.o: In function `gfc_simplify_acosd(gfc_expr*)':
simplify.cc:(.text+0x5cda): undefined reference to `mpfr_acosu'
fortran/simplify.o: In function `gfc_simplify_asind(gfc_expr*)':
simplify.cc:(.text+0x5dca): undefined reference to `mpfr_asinu'
fortran/simplify.o: In function `gfc_simplify_atand(gfc_expr*)':
simplify.cc:(.text+0x5e80): undefined reference to `mpfr_atanu'
fortran/simplify.o: In function `gfc_simplify_atan2d(gfc_expr*, gfc_expr*)':
simplify.cc:(.text+0x6c4f): undefined reference to `mpfr_atan2u'
fortran/simplify.o: In function `gfc_simplify_cosd(gfc_expr*)':
simplify.cc:(.text+0x6de0): undefined reference to `mpfr_cosu'
fortran/simplify.o: In function `gfc_simplify_sind(gfc_expr*)':
simplify.cc:(.text+0x6e70): undefined reference to `mpfr_sinu'
fortran/simplify.o: In function `gfc_simplify_tand(gfc_expr*)':
simplify.cc:(.text+0x6f00): undefined reference to `mpfr_tanu'
fortran/simplify.o: In function `gfc_simplify_cotand(gfc_expr*)':
simplify.cc:(.text+0x6fbe): undefined reference to `mpfr_tanu'
fortran/simplify.o: In function `gfc_simplify_acospi(gfc_expr*)':
simplify.cc:(.text+0x7163): undefined reference to `mpfr_acospi'
fortran/simplify.o: In function `gfc_simplify_asinpi(gfc_expr*)':
simplify.cc:(.text+0x7223): undefined reference to `mpfr_asinpi'
fortran/simplify.o: In function `gfc_simplify_atanpi(gfc_expr*)':
simplify.cc:(.text+0x72ab): undefined reference to `mpfr_atanpi'
fortran/simplify.o: In function `gfc_simplify_atan2pi(gfc_expr*, gfc_expr*)':
simplify.cc:(.text+0x7375): undefined reference to `mpfr_atan2pi'
fortran/simplify.o: In function `gfc_simplify_cospi(gfc_expr*)':
simplify.cc:(.text+0x740b): undefined reference to `mpfr_cospi'
fortran/simplify.o: In function `gfc_simplify_sinpi(gfc_expr*)':
simplify.cc:(.text+0x749b): undefined reference to `mpfr_sinpi'
fortran/simplify.o: In function `gfc_simplify_tanpi(gfc_expr*)':
simplify.cc:(.text+0x752b): undefined reference to `mpfr_tanpi'
fold-const-call.o: In function `fold_const_call_sss(real_value*, combined_fn, real_value const*, real_value const*, real_format const*)':
fold-const-call.cc:(.text+0x624): undefined reference to `mpfr_atan2pi'
fold-const-call.o: In function `fold_const_call_1(combined_fn, tree_node*, tree_node*)':
fold-const-call.cc:(.text+0x2c55): undefined reference to `mpfr_cospi'
fold-const-call.cc:(.text+0x2c72): undefined reference to `mpfr_atanpi'
fold-const-call.cc:(.text+0x2cc8): undefined reference to `mpfr_asinpi'
fold-const-call.cc:(.text+0x2ced): undefined reference to `mpfr_sinpi'
fold-const-call.cc:(.text+0x2d0a): undefined reference to `mpfr_tanpi'
fold-const-call.cc:(.text+0x377b): undefined reference to `mpfr_acospi'
/home/CENSORED/downloads/mpc-1.3.1-install/lib/libmpc.so: undefined reference to `mpfr_fmma'
/home/CENSORED/downloads/mpc-1.3.1-install/lib/libmpc.so: undefined reference to `mpfr_fmms'
collect2: error: ld returned 1 exit status
make[3]: *** [lto1] Error 1
make[3]: *** Waiting for unfinished jobs....
/home/CENSORED/downloads/mpc-1.3.1-install/lib/libmpc.so: undefined reference to `mpfr_fmma'
/home/CENSORED/downloads/mpc-1.3.1-install/lib/libmpc.so: undefined reference to `mpfr_fmms'
/home/CENSORED/downloads/mpc-1.3.1-install/lib/libmpc.so: undefined reference to `mpfr_fmma'
/home/CENSORED/downloads/mpc-1.3.1-install/lib/libmpc.so: undefined reference to `mpfr_fmms'
collect2: error: ld returned 1 exit status
make[3]: *** [lto-dump] Error 1
collect2: error: ld returned 1 exit status
make[3]: *** [f951] Error 1
make[3]: Leaving directory `/home/CENSORED/downloads/gcc-16.2.0-build/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/CENSORED/downloads/gcc-16.2.0-build'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/CENSORED/downloads/gcc-16.2.0-build'
make: *** [all] Error 2I have no idea what to do, I'm not a programmer, I just need this to work so I can move on and use certain programs (like geant4). What do I do? How do I fix this? I am literally genuinely rolling on the floor sobbing right now