Re: libstdc++.so did not link cause of libm.a was not compiled with fpic

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

 



On 13/06/2024 13:10, Klaus Rudolph via Gcc-help wrote:
> I try to cross compile gcc 14.1.0 for an older arm linux.
> 
> During compilation it fails with a long list of linking problems for
> libstdc++.so
> 
> I configured gcc with:
> ../configure --prefix=/opt/armv7_$(GCC_VERSION) --enable-languages=c,c++
> --with-sysroot=/opt/podman_debian8/merged --enable-multiarch
> --with-fpu=vfpv3-d16 --with-mode=thumb --with-arch=armv7-a
> --target=arm-linux-gnueabihf --disable-multilib --with-stdc++lib=static
> 
> Is it possible to add/remove some flags for ./configure to get the new
> compiler to work even with the libm.a library from the target system
> which was not compiled with fPic.
> 

I don't know if this could work.  I certainly don't think I've ever tried it before, but it's really beyond my sphere of expertise.  If you're building a shared libstdc++ that links against a static libm, I certainly don't think you want to be pulling the symbols from libm into your shared library (that would cause it to export symbols that should be in libm itself).

R.

> Thanks
>  Klaus
> 
> #### full error message:
> 
> libtool: link:
> /home/krud/compiler_install/gcc-14.1.0/build_armv7/./gcc/xgcc
> -shared-libgcc
> -B/home/krud/compiler_install/gcc-14.1.0/build_armv7/./gcc -nostdinc++
> -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/src
> -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/src/.libs
> -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/libsupc++/.libs
> -B/opt/armv7_14.1.0/arm-linux-gnueabihf/bin/
> -B/opt/armv7_14.1.0/arm-linux-gnueabihf/lib/ -isystem
> /opt/armv7_14.1.0/arm-linux-gnueabihf/include -isystem
> /opt/armv7_14.1.0/arm-linux-gnueabihf/sys-include     -fPIC -DPIC
> -D_GLIBCXX_SHARED -shared -nostdlib
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/crti.o
> /home/krud/compiler_install/gcc-14.1.0/build_armv7/./gcc/crtbeginS.o
> .libs/compatibility.o .libs/compatibility-debug_list.o
> .libs/compatibility-debug_list-2.o .libs/compatibility-atomic-c++0x.o
> .libs/compatibility-c++0x.o .libs/compatibility-chrono.o
> .libs/compatibility-condvar.o .libs/compatibility-thread-c++0x.o
> -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a
> ../src/c++98/.libs/libc++98convenience.a
> ../src/c++11/.libs/libc++11convenience.a
> ../src/c++17/.libs/libc++17convenience.a
> ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole-archive
> -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/libsupc++/.libs
> -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/src
> -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/src/.libs
> -lm -L/home/krud/compiler_install/gcc-14.1.0/build_armv7/./gcc
> -L/opt/armv7_14.1.0/arm-linux-gnueabihf/bin
> -L/opt/armv7_14.1.0/arm-linux-gnueabihf/lib
> -L/opt/podman_debian8/merged/lib/arm-linux-gnueabihf
> -L/opt/podman_debian8/merged/lib
> -L/opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf
> -L/opt/podman_debian8/merged/usr/lib -lc -lgcc_s
> /home/krud/compiler_install/gcc-14.1.0/build_armv7/./gcc/crtendS.o
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/crtn.o  -Wl,-O1
> -Wl,-z -Wl,relro -Wl,--gc-sections
> -Wl,--version-script=libstdc++-symbols.ver   -Wl,-soname
> -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.33
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(s_atan.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(s_sin.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `__sincostab' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(s_tan.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_acos.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_asin.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_atan2.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_cosh.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_exp.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_fmod.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_hypot.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_log.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_log10.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_pow.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_sinh.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(w_sqrt.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `_LIB_VERSION' can not be used
> when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(branred.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(dosincos.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpa.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpatan.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpsqrt.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(sincos32.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(k_standard.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_asin.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_atan2.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_exp.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_fmod.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_log.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_pow.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(e_sqrt.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(s_rint.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(doasin.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpatan2.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `mpone' can not be used when
> making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mplog.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(slowpow.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(halfulp.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpexp.o):
> relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be
> used when making a shared object; recompile with -fPIC
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpa.o): in
> function `__dvd':
> (.text+0xf60): dangerous relocation: unsupported relocation
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(mpsqrt.o):
> in function `__mpsqrt':
> (.text+0x168): dangerous relocation: unsupported relocation
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(sincos32.o):
> in function `__sin32':
> (.text+0x2f0): dangerous relocation: unsupported relocation
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(sincos32.o):
> in function `__cos32':
> (.text+0x3f8): dangerous relocation: unsupported relocation
> (.text+0x3fc): dangerous relocation: unsupported relocation
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(sincos32.o):
> in function `__mpranred':
> (.text+0x5d0): dangerous relocation: unsupported relocation
> (.text+0x5d4): dangerous relocation: unsupported relocation
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(sincos32.o):
> in function `__mpsin':
> (.text+0x6c0): dangerous relocation: unsupported relocation
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(sincos32.o):
> in function `__mpcos':
> (.text+0x7a8): dangerous relocation: unsupported relocation
> /opt/armv7_14.1.0/arm-linux-gnueabihf/bin/ld:
> /opt/podman_debian8/merged/usr/lib/arm-linux-gnueabihf/libm.a(k_standard.o)(.text+0x46a):
> unresolvable R_ARM_THM_MOVW_ABS_NC relocation against symbol
> `stderr@@GLIBC_2.4'
> collect2: error: ld returned 1 exit status
> make[6]: *** [Makefile:764: libstdc++.la] Fehler 1
> make[6]: Verzeichnis
> „/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/src“
> wird verlassen
> make[5]: *** [Makefile:797: all-recursive] Fehler 1
> make[5]: Verzeichnis
> „/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3/src“
> wird verlassen
> make[4]: *** [Makefile:577: all-recursive] Fehler 1
> make[4]: Verzeichnis
> „/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3“
> wird verlassen
> make[3]: *** [Makefile:502: all] Fehler 2
> make[3]: Verzeichnis
> „/home/krud/compiler_install/gcc-14.1.0/build_armv7/arm-linux-gnueabihf/libstdc++-v3“
> wird verlassen
> make[2]: *** [Makefile:14092: all-target-libstdc++-v3] Fehler 2
> make[2]: Verzeichnis
> „/home/krud/compiler_install/gcc-14.1.0/build_armv7“ wird verlassen
> make[1]: *** [Makefile:1070: all] Fehler 2
> make[1]: Verzeichnis
> „/home/krud/compiler_install/gcc-14.1.0/build_armv7“ wird verlassen
> 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux