pkgsrc-Users archive

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

macOS SDK selection woes, Darwin.mk out of date



I'm trying to build 2024Q4 on several macOS versions over 4 computers.
Mostly it's ok.

One system is a newish (2019 :-) mac that is up to date:

  $ sw_vers -productVersion
  15.1.1

I had boostrapped in April 2023 and my bootstrap mk.conf is
unremarkable:

  # Example /opt/pkg/etc/mk.conf file produced by bootstrap-pkgsrc
  # Sun Apr  2 12:25:38 EDT 2023

  .ifdef BSD_PKG_MK       # begin pkgsrc settings

  ABI=                    64
  PKGSRC_COMPILER=        clang
  CC=                     clang
  CXX=                    clang++
  CPP=                    ${CC} -E
  CLANGBASE=              /usr

  PKG_DBDIR=              /opt/pkg/pkgdb
  LOCALBASE=              /opt/pkg
  SYSCONFBASE=            /opt/pkg/etc
  VARBASE=                /opt/pkg/var
  PKG_TOOLS_BIN=          /opt/pkg/sbin
  PKGINFODIR=             info
  PKGMANDIR=              man

  TOOLS_PLATFORM.sh?=             /opt/pkg/bin/mksh
  TOOLS_PLATFORM.awk?=            /opt/pkg/bin/nawk
  TOOLS_PLATFORM.sed?=            /opt/pkg/bin/nbsed

  .if exists(/etc/mk.conf)
  .include "/etc/mk.conf"
  .endif
  .endif                  # end pkgsrc settings


I have Command Line Tools, and many packages build and work.

Trying to build cmake I get

  ---------------------------------------------
  CMake 3.31.1, Copyright 2000-2024 Kitware, Inc. and Contributors
  C compiler on this system is: clang -O2 -I/opt/pkg/include  
  ---------------------------------------------
  Error when bootstrapping CMake:
  Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
  Please specify one using environment variable CXX.
  The C++ flags are "-O2 -I/opt/pkg/include".
  They can be changed using the environment variable CXXFLAGS.
  See cmake_bootstrap.log for compilers attempted.
  ---------------------------------------------
  Log of errors: /private/tmp/devel/cmake/work/cmake-3.31.1/Bootstrap.cmk/cmake_bootstrap.log
  ---------------------------------------------


Reading that, there is an error iostream not found.   I see iostream in
all three installed SDKs:

  $ find  /Library/Developer/CommandLineTools -name iostream
  /Library/Developer/CommandLineTools/SDKs/MacOSX15.1.sdk/usr/include/c++/v1/iostream
  /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/iostream
  /Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/iostream

and the 15.1 sdk is default:

  $ xcrun --show-sdk-path
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

  $ ls -l /Library/Developer/CommandLineTools/SDKs
  total 0
  lrwxr-xr-x  1 root  wheel   14 Nov 19 17:30 MacOSX.sdk -> MacOSX15.1.sdk
  drwxr-xr-x  7 root  wheel  224 Nov 12  2022 MacOSX13.1.sdk
  drwxr-xr-x  7 root  wheel  224 Jul  8  2024 MacOSX14.5.sdk
  lrwxr-xr-x  1 root  wheel   14 Nov 19 17:29 MacOSX14.sdk -> MacOSX14.5.sdk
  drwxr-xr-x  7 root  wheel  224 Oct 10 19:11 MacOSX15.1.sdk
  lrwxr-xr-x  1 root  wheel   14 Nov 19 17:29 MacOSX15.sdk -> MacOSX15.1.sdk

Writing foo.cc:

  #include <iostream>

and running "clang -c foo.cc" I get an error

  Apple clang version 16.0.0 (clang-1600.0.26.4)
  Target: x86_64-apple-darwin24.1.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin
   "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx15.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name foo.cc -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=15.1 -fvisibility-inlines-hidden-static-local-var -fno-modulemap-allow-subdirectory-search -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 1115.7.3 -v -fcoverage-compilation-dir=/Users/gdt -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/16 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/16/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -fdeprecated-macro -fdebug-compilation-dir=/Users/gdt -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -clang-vendor-feature=+disableAtImportPrivateFrameworkInImplementationError -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/cz/xp8v49_s3bsdvqkp66jdd8hc0000gp/T/foo-54ee1e.o -x c++ foo.cc
  clang -cc1 version 16.0.0 (clang-1600.0.26.4) default target x86_64-apple-darwin24.1.0
  ignoring nonexistent directory "/usr/local/include"
  ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
  ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
  #include "..." search starts here:
  #include <...> search starts here:
   /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
   /Library/Developer/CommandLineTools/usr/lib/clang/16/include
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
   /Library/Developer/CommandLineTools/usr/include
   /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
  End of search list.
  foo.cc:1:10: fatal error: 'iostream' file not found
      1 | #include <iostream>
        |          ^~~~~~~~~~
  1 error generated.

but there is a c++/v1 subdir path.


On a 2017 MBP stuck on 13:

  $ sw_vers  -productversion
  13.7.1

the clang invocation succeeds.  It lacks the 15.1 sdk, and oddly the
default is pointing to 14.2

  $ l /Library/Developer/CommandLineTools/SDKs/
  total 0
  lrwxr-xr-x  1 root  wheel   14 Dec 18  2023 MacOSX.sdk -> MacOSX14.2.sdk
  drwxr-xr-x  7 root  wheel  224 Jun 28  2023 MacOSX12.3.sdk
  lrwxr-xr-x  1 root  wheel   14 Jun 28  2023 MacOSX12.sdk -> MacOSX12.3.sdk
  drwxr-xr-x  7 root  wheel  224 Dec 18  2023 MacOSX13.3.sdk
  lrwxr-xr-x  1 root  wheel   14 Dec 18  2023 MacOSX13.sdk -> MacOSX13.3.sdk
  drwxr-xr-x  7 root  wheel  224 Nov 13  2023 MacOSX14.2.sdk
  lrwxr-xr-x  1 root  wheel   14 Dec 18  2023 MacOSX14.sdk -> MacOSX14.2.sdk


Looking at mk/platform/Darwin.mk, the comments about versions stops at
13.  I remember there used to be a table mapping os version to sdk
version, but I can't find that now.  bootkstrap/README.Darwin mentions
OSX_SDK_MAP, but that's not in mk/platform/Darwin.mk.  I remember there
being more detail in README.Darwin, but perhaps it's all obsolete and
was gc'd.


Is pkgsrc working for others on 15.1?  Any clues?


Home | Main Index | Thread Index | Old Index