Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#68312 closed defect (fixed)

gcc13 C++ library linking error

Reported by: haberg-1 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: cjones051073 (Chris Jones)
Port: gcc13

Description (last modified by ryandesign (Ryan Carsten Schmidt))

There is a gcc13 C++ library linking error [1], which does not appear with gcc12 or clang-17, when compiling [2]: The name replace_cold, as in [1], appears only in the static libraries libstdc++.a and libstdc++fs.a, and not the dynamic library libstdc++.6.dylib. It does not appear in the gcc12 C++ libraries.

Undefined symbols for architecture x86_64:
  "__ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcmPKcmm", referenced from:
      __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm in database-lexer.o
      __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm in database-parser.o
      __ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_replaceEmmPKcm in directive-lexer.o
  1. https://savannah.gnu.org/git/?group=metalogic-inference

Change History (14)

comment:1 Changed 12 months ago by reneeotten (Renee Otten)

Keywords: sonoma removed
Port: gcc13 added; gcc12 removed

comment:2 Changed 12 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:3 Changed 12 months ago by cjones051073 (Chris Jones)

Gcc13 is NOT yet a production compiler. This should be made clear,via the port notes…

comment:4 Changed 12 months ago by cjones051073 (Chris Jones)

Just to add, i suspect this is beause the default runtime is not yet provided via gcc13 but gcc12. I will updatethis once i am sure gcc13 builds on al platforms we need to support.

Last edited 12 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:5 Changed 12 months ago by haberg-1

You might change the gcc13 dependency to clang-17 instead of clang-16, as gcc13 is not functional yet. Right now, if one has only installed clang-17, clang-16 will have to be built, which is lengthy, and then it is thrown away with "port reclaim".

The port gcc13 was added because clang-14, on which gcc12 depends, did not originally work on MacOS 14 Sonoma, but that has been fixed now.

comment:6 Changed 12 months ago by haberg-1

Also, gcc-devel points to an old GCC 13 development version, before it was released. It should probably point to GCC 14, which is the current development version.

Last edited 12 months ago by haberg-1 (previous) (diff)

comment:7 Changed 12 months ago by cjones051073 (Chris Jones)

gcc is now the primary runtime provider. Please update your ports to the latest versions and try again.

If it still fails you will need to provider a simple reproducer for anyone to investigate, the above is not enough, I am not going to spend time trying to figure out what I need to do myself from that web link.

comment:8 Changed 12 months ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:9 Changed 12 months ago by haberg-1

It linked now. Does the gcc-13 library depend on clang-14? The port gcc13 depends on clang-16, whereas the current release is clang-17.

For the record, the program metalogic-inference mentioned downloads with: git clone https://git.savannah.gnu.org/git/metalogic-inference.git

Then configure in a parallel directory, in case the dependent GMP is in /usr/local/, by: ../metalogic-inference/configure CXX=/opt/local/bin/g++-mp-13 CXXFLAGS=-g CC=/opt/local/bin/gcc-mp-13 CPPFLAGS="-g -I/usr/local/include -I/opt/local/include" LDFLAGS="-L /usr/local/lib"

For the linking issue discussed here, it suffices to check the directory src: cd src && make -j

comment:10 Changed 12 months ago by cjones051073 (Chris Jones)

gcc13 itself has no dependencies on any clang port. The dependency you see on clang-16 is only via the gcc13-libcxx which is a small sub-port designed to provide the libc++ header implementation to be used when you use g++ with the -stdlib=libc++ option it now supports.

Also note this is only a build dependency, not a lib or runtime one. Once you have binary tarballs for gcc13 available, you will never need to see this dependency yourself.

The dependency is intentionally clang-16, not clang-17, as gcc does not support the very latest version in this case. Its the same reason why gcc12-libcxx uses clang-14, as thats the newest libc++ implementation that gcc12 supports.

Last edited 12 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:11 Changed 12 months ago by cjones051073 (Chris Jones)

Resolution: fixed
Status: newclosed

comment:12 Changed 12 months ago by haberg-1

For those build dependencies, they are installed for the build and then removed by "port reclaim", which is very time consuming on a slow computer. :-) —I guess, I should make "port install" on those, until the binaries arrive.

comment:13 Changed 12 months ago by cjones051073 (Chris Jones)

yes, either refrain from running 'port reclaim' until the binary tarballs are available, so reinstalling them is quick, or manually label them as requested (which 'port install' would do) in which case port reclaim will not remove them.

comment:14 Changed 12 months ago by haberg-1

Thanks for the advice!

Note: See TracTickets for help on using tickets.