Date: Sun, 17 Apr 2022 19:21:11 -0700 From: Mark Millard <marklmi@yahoo.com> To: freebsd-ports@freebsd.org, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Use of lang/gcc*'s g++* via the likes of USE_GCC=11:build+ in ports when a -Wl,-rpath=/usr/local/lib/gcc* is required: How? Message-ID: <90BF482E-BE98-4783-8440-9FA0E03E3D88@yahoo.com> References: <90BF482E-BE98-4783-8440-9FA0E03E3D88.ref@yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I'll use g++11 as an example here. By no means is the issue limited to g++11 . Also, the general issue is not limited to the specifics of the other aspects of the example I report below. EXAMPLE PROBLEM: FreeBSD's /lib/libgcc_s.so.1 is insufficient for what aarch64 g++11 code generation expects to be provided. Programs can be built but end up with notices that start with: ld-elf.so.1: /lib/libgcc_s.so.1: version GCC_4.5.0 required by . . . not found Sometimes the ". . ." is /usr/local/lib/gcc11/libstdc++.so.6 . Other times it does not get that far because the program itself has the issue before shared libraries are bound. A simple 6 line program on aarch64 can show the issue: # more fp-binding-failure-aarch64.cpp #include <cmath> volatile long double v=3DNAN; int main() { return std::isnan(v) ? 1 : 0; } # g++11 fp-binding-failure-aarch64.cpp # ./a.out ld-elf.so.1: /lib/libgcc_s.so.1: version GCC_4.5.0 required by = /usr/home/root/c_tests/a.out not found The a.out has its own reference to=20 __unordtf2@GCC_4.5.0 : # nm -a a.out | grep '@GCC_[4-9]\.' | more U=20 __unordtf2@GCC_4.5.0 For reference . . . # ldd a.out a.out: libstdc++.so.6 =3D> /usr/local/lib/gcc11/libstdc++.so.6 = (0x83000000) libm.so.5 =3D> /lib/libm.so.5 (0x81834000) libgcc_s.so.1 =3D> /lib/libgcc_s.so.1 (0x8275a000) libc.so.7 =3D> /lib/libc.so.7 (0x845f3000) Use of -Wl,-rpath=3D/usr/local/lib/gcc11 avoids the example's failure by using gcc11's libgcc_s.so.1 instead of FreeBSD's. gcc11's libgcc_s.so.1 is more likely to accurately cover the g++11 compiler's potential range of code generation. I've no clue what all g++11 targeting aarch64 generates that also would not be found in /lib/libgcc_s.so.1 on aarch64. Similarly, I do not know what examples might exist for other FreeBSD platforms. But aarch64 is tier 1 these days, if that matters for this subject area. THE QUESTION: How does one use the likes of USE_GCC=3D11:build+ and also supply the appropriate -Wl,-rpath=3D/usr/local/lib/gcc?? to match which g++ is actually used? There is an analogous question for when using a linker command line directly instead (no -Wl, prefix). =3D=3D=3D Mark Millard marklmi at yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?90BF482E-BE98-4783-8440-9FA0E03E3D88>