tech-pkg archive

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

Re: lang/gcc12 on mac



On 6/24/24 03:23, Jonathan Perkin wrote:
* On 2024-06-23 at 22:29 BST, Jason Bacon wrote:

On 6/23/24 12:48, Jonathan Perkin wrote:
* On 2024-06-23 at 13:21 BST, Jason Bacon wrote:

+.if !defined(CLTOOLS_VERSION)
+CLTOOLS_VERSION!=      pkgutil
--pkg-info=com.apple.pkg.CLTools_Executables | awk '$$1 == "version:" {
print $2 }'
+.endif

This isn't accurate, on my host it returns the same as you, but I do not use this, I use Xcode installed under /Applications which is a completely different version.

I would do it based on CC_VERSION, which needs some work for clang. Ideally I'd like to see it be the same as OPSYS_VERSION where we can perform numeric comparisons rather than string matching.


CC_VERSION seems to be clang-15.0.0 for both SDK 13.3 and 14.4.

Running the following to get all predefined cpp macros:

cc -dM -E -x c /dev/null

The only difference in the output for 13.3 and 14.4 is

< #define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 130300
< #define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ 130300
---
#define __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 140000
#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ 140000

If you're trying to differentiate between SDKs rather than compilers then yeh we could do it based on one of those macros.  Something like this:

   --- mk/platform/Darwin.mk    29 Apr 2024 13:57:55 -0000    1.140
   +++ mk/platform/Darwin.mk    24 Jun 2024 08:16:59 -0000
   @@ -134,0 +135,5 @@
   +.if !defined(OSX_SDK_VERSION)
  +OSX_SDK_VERSION!=    ${CC} -isysroot ${OSX_SDK_PATH} -dM -E -x c /dev/null | awk '/OS_VERSION_MIN/ {print $$3}'
   +MAKEFLAGS+=        OSX_SDK_VERSION=${OSX_SDK_VERSION}
   +.endif
   +

Seems to work correctly with overriding MACOSX_DEPLOYMENT_TARGET and OSX_SDK_PATH:

   $ bmake -v OSX_SDK_VERSION
   140000

   $ bmake MACOSX_DEPLOYMENT_TARGET=12.3 -v OSX_SDK_VERSION
   120300

  $ bmake OSX_SDK_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -v OSX_SDK_VERSION
   110300

Cheers,


This is showing the OS version, not the SDK version. I believe __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ is 140000 for any SDK 15.x, so this doesn't distinguish between, say, 15.2 and 15.3. 15.3 is the first to cause problems with gcc12 according to what I've read.

Regarding the current state of gcc12:

The issue is with GCC's "safe-ctype" conflicting with the system ctype. Indirect includes differ by platform, so this approach is really squirrely.

I played around with some platform-agnostic patches. I was able to fix the breakage caused by SDK 15.3 patches on NetBSD 10, but this fix broke gcc12 on Alma8.

So I scrapped that approach is just wrapped the SDK 15.3 patches in #ifdef __APPLE__. I'm hoping that they won't break the build on other Darwin and SDK versions, but I have no way to test that.

Currently, wip/gcc12 builds fine on macOS 14.5 + SDK 15.3, NetBSD 10, and Alma 8.

Best,

	J

--
Life is a game.  Play hard.  Play fair.  Have fun.



Home | Main Index | Thread Index | Old Index