[MacPorts] #71053: clang @19.1.1_0+analyzer: can't find standard headers

MacPorts noreply at macports.org
Fri Oct 11 04:12:56 UTC 2024


#71053: clang @19.1.1_0+analyzer: can't find standard headers
---------------------------+---------------------
  Reporter:  paul-j-lucas  |      Owner:  (none)
      Type:  defect        |     Status:  new
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.10.2
Resolution:                |   Keywords:  ventura
      Port:  clang-19      |
---------------------------+---------------------

Comment (by kencu):

 somehow, when you built clang-19, it did not build with a proper reference
 to the SDK and SDK headers.

 Compare:

 {{{
 % clang-mp-19 -v foo.c
 clang version 19.1.1
 Target: x86_64-apple-darwin24.0.0
 Thread model: posix
 InstalledDir: /opt/local/libexec/llvm-19/bin
  "/opt/local/libexec/llvm-19/bin/clang" -cc1 -triple x86_64-apple-
 macosx15.0.0 -Wundef-prefix=TARGET_OS_ -Werror=undef-prefix -Wdeprecated-
 objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -dumpdir a-
 -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-
 value-names -main-file-name foo.c -mrelocation-model pic -pic-level 2
 -mframe-pointer=all -ffp-contract=on -fno-rounding-math -funwind-tables=2
 -target-sdk-version=15.0 -fcompatibility-qualified-id-block-type-checking
 -fvisibility-inlines-hidden-static-local-var -fdefine-target-os-macros
 -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -fdebug-
 compilation-dir=/Users/cunningh -target-linker-version 1115.7.3 -v
 -fcoverage-compilation-dir=/Users/cunningh -resource-dir
 /opt/local/libexec/llvm-19/lib/clang/19 -isysroot
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
 -I/usr/local/include -internal-isystem
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include
 -internal-isystem /opt/local/libexec/llvm-19/lib/clang/19/include
 -internal-externc-isystem
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
 -ferror-limit 19 -stack-protector 1 -fblocks -fencode-extended-block-
 signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-
 odr-check-in-gmf -fmax-type-align=16 -fcolor-diagnostics
 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o
 /var/folders/mn/s7mk_ptj3d39y51m_hpjnrpm0000gn/T/foo-7b0e5d.o -x c foo.c
 clang -cc1 version 19.1.1 based upon LLVM 19.1.1 default target x86_64
 -apple-darwin24.0.0
 ignoring nonexistent directory "/usr/local/include"
 ignoring nonexistent directory
 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
 ignoring nonexistent directory
 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
 #include "..." search starts here:
 #include <...> search starts here:
  /opt/local/libexec/llvm-19/lib/clang/19/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
 (framework directory)
 End of search list.
  "/opt/local/libexec/llvm-19/bin/ld" -demangle -lto_library
 /opt/local/libexec/llvm-19/lib/libLTO.dylib -no_deduplicate -dynamic -arch
 x86_64 -platform_version macos 15.0.0 15.0 -syslibroot
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
 -mllvm -enable-linkonceodr-outlining -o a.out -L/usr/local/lib
 /var/folders/mn/s7mk_ptj3d39y51m_hpjnrpm0000gn/T/foo-7b0e5d.o -lSystem
 /opt/local/libexec/llvm-19/lib/clang/19/lib/darwin/libclang_rt.osx.a
 }}}

 I realize you think that the headers in Xcode or the SDK in the CLTs
 should not be used, however -- they do need to be used, otherwise the
 compiler is broken, as you are demonstrating.

 Now, I have no idea how you built clang-19 exactly to force it to ignore
 the SDK. It is impossible for me to know that without knowing what you
 did.

 But if you want clang-19 to work, you'll have to undo it.

 Or you can just uninstall your version that you built, and use the
 prebuilt binary that presumably should exist by now.

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


More information about the macports-tickets mailing list