[MacPorts] #68640: clang-18: Undefined symbols on older OSes

MacPorts noreply at macports.org
Mon Feb 3 07:07:54 UTC 2025


#68640: clang-18: Undefined symbols on older OSes
------------------------+----------------------
  Reporter:  snowflake  |      Owner:  (none)
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:             |   Keywords:  haspatch
      Port:  clang-18   |
------------------------+----------------------

Comment (by peterieiqweuiwe):

 Replying to [comment:61 brettyhale]:
 > Replying to [comment:59 cjones051073]:
 > > Above commits implement the changes for clang16-18
 > >
 > > clang17 now works OK for me, tested fine on MacOSX10.11 for a few of
 the previously failing ports.
 > >
 > > clang18 seems to have another issue, e.g. mesa on MacOSX10.11
 >
 > > so for now clang18 is still not allowed on older OSes.
 >
 > I'm having the same issue with Catalina 10.15.7 - clang-17 works fine,
 but I get linker errors for <iostream> file I/O on both clang-18 and
 clang-19 - so I'm restricted to clang-17 for now.

 Same issue here with Catalina 10.15.7 , same linker error occurred when
 using clang++-mp-18 and clang++-mp-19.

 {{{
 clang++-mp-19 -march=haswell -pipe -O0 -g -std=c++17 -v
 -I/opt/local/include -pedantic-errors -o test1.o -c test1.cpp
 clang version 19.1.7
 Target: x86_64-apple-darwin19.6.0
 Thread model: posix
 InstalledDir: /opt/local/libexec/llvm-19/bin
 (...)
 clang++-mp-19 -L/opt/local/lib -v -o test1 test1.o
 clang version 19.1.7
 Target: x86_64-apple-darwin19.6.0
 Thread model: posix
 InstalledDir: /opt/local/libexec/llvm-19/bin
  "/opt/local/libexec/llvm-19/bin/ld" -demangle -lto_library
 /opt/local/libexec/llvm-19/lib/libLTO.dylib -dynamic -arch x86_64
 -platform_version macos 10.15.0 10.15.6 -syslibroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -mllvm -enable-
 linkonceodr-outlining -o test1 -L/opt/local/lib -L/usr/local/lib test1.o
 -lc++ -lSystem
 /opt/local/libexec/llvm-19/lib/clang/19/lib/darwin/libclang_rt.osx.a
 Undefined symbols for architecture x86_64:
   "std::__1::basic_filebuf<char, std::__1::char_traits<char>
 >::basic_filebuf()", referenced from:
       std::__1::basic_ifstream<char, std::__1::char_traits<char>
 >::basic_ifstream() in test1.o
   "std::__1::basic_filebuf<char, std::__1::char_traits<char>
 >::~basic_filebuf()", referenced from:
       std::__1::basic_ifstream<char, std::__1::char_traits<char>
 >::~basic_ifstream() in test1.o
   "VTT for std::__1::basic_ifstream<char, std::__1::char_traits<char> >",
 referenced from:
       std::__1::basic_ifstream<char, std::__1::char_traits<char>
 >::basic_ifstream() in test1.o
       std::__1::basic_ifstream<char, std::__1::char_traits<char>
 >::~basic_ifstream() in test1.o
   "vtable for std::__1::basic_ifstream<char, std::__1::char_traits<char>
 >", referenced from:
       std::__1::basic_ifstream<char, std::__1::char_traits<char>
 >::basic_ifstream() in test1.o
   NOTE: a missing vtable usually means the first non-inline virtual member
 function has no definition.
 ld: symbol(s) not found for architecture x86_64
 clang++: error: linker command failed with exit code 1 (use -v to see
 invocation)
 }}}

 Here is the source code:

 {{{
 #include <fstream>
 using namespace std;

 int main(void)
 {
     ifstream x;
     return 0;
 }

 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/68640#comment:65>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list