Skip to content

Conversation

@timwoj
Copy link
Member

@timwoj timwoj commented May 9, 2025

The version of libkrb5 that comes with macOS is quite old and has problems that cause Zeek's btests to fail. Instead of blindly using it, report an error and tell the user to use the version from Homebrew. That version is known to work.

# If using macOS, make sure that we're not finding the system's libkrb5. It
# an old version, which points you at GSS.framework, which is also deprecated.
if (LibKrb5_LIBRARY AND "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
string(FIND "${LibKrb5_LIBRARY}" "/Library/Developer/CommandLineTools/SDKs"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but also didn't test.

Suggested change
string(FIND "${LibKrb5_LIBRARY}" "/Library/Developer/CommandLineTools/SDKs"
if ( "${LibKrb5_LIBRARY}" MATCHES "..." )
message(FATAL_ERROR)
endif ()

I'm also wondering if there's a define or something in krb5.h that could be used for identifying the wrong/too-old version, but if what you have works 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also wondering if there's a define or something in krb5.h that could be used for identifying the wrong/too-old version, but if what you have works

I looked through it and couldn't find a version number or anything unforunately. The best indicator I could find of it being very old was simply the copyright information. I couldn't tell you what version Apple is actually including here without pulling all of the old tarballs and diffing. It's at least 12 years old, because krb5/krb5@17e2050 changed everything to use stdint.h types and Apple's version doesn't include that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but also didn't test.

string(FIND) is probably better here because the path changes as you install new versions of the macOS SDK:

/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/lib/libkrb5.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libkrb5.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/usr/lib/libkrb5.tbd
/Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk/usr/lib/libkrb5.tbd

I suppose it could match a regex. We definitely do if MATCHES more often than we do string(FIND).

@timwoj timwoj force-pushed the topic/timw/fail-on-macos-system-libkrb5 branch from d866177 to 3a70b8b Compare May 12, 2025 23:43
@timwoj timwoj force-pushed the topic/timw/fail-on-macos-system-libkrb5 branch from 3a70b8b to d04e386 Compare May 12, 2025 23:43
@timwoj timwoj merged commit dce1a7d into master May 12, 2025
1 check passed
@timwoj timwoj deleted the topic/timw/fail-on-macos-system-libkrb5 branch May 12, 2025 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants