Skip to content

Variable to find the SDK directories on macOS #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brianquinlan opened this issue Mar 8, 2023 · 3 comments · Fixed by #2007
Closed

Variable to find the SDK directories on macOS #471

brianquinlan opened this issue Mar 8, 2023 · 3 comments · Fixed by #2007
Labels
lang-objective_c Related to Objective C support package:ffigen type-enhancement A request for a change that isn't a bug

Comments

@brianquinlan
Copy link
Contributor

Apple seems to move around it's framework headers. Currently, on my machine, they have paths like:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h

previously they looked like:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h

It would be nice to have a magic variable that can be used in ffigen.yaml so that you can write paths like this:

$SDK/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Versions/C/Headers/NSDictionary.h

@brianquinlan brianquinlan added type-enhancement A request for a change that isn't a bug lang-objective_c Related to Objective C support labels Mar 8, 2023
@liamappelbe liamappelbe transferred this issue from dart-archive/ffigen Nov 15, 2023
parlough pushed a commit to parlough/native that referenced this issue Apr 8, 2024
@liamappelbe liamappelbe moved this to Backlog in ObjC/Swift interop Apr 10, 2024
@stuartmorgan-g
Copy link

stuartmorgan-g commented Sep 4, 2024

@liamappelbe I'm assuming "Backlog" means this isn't on the short-term roadmap currently? This seems like a blocker for adoption in flutter/packages, because any hard-coded path is not guaranteed to work for anyone else, since Xcode can be moved or renamed.

Having a variable that ffigen will map to the value of xcode-select -p is the only way to make a config file that is portable to other developers/machines.

@liamappelbe
Copy link
Contributor

Ok, I can bump the priority on this one

@liamappelbe
Copy link
Contributor

liamappelbe commented Feb 18, 2025

Played around with some options. I think we'll want a few different variables:

  • $XCODE: xcode-select -p
    • eg /Applications/Xcode.app/Contents/Developer
  • $IOS_SDK: xcrun --show-sdk-path --sdk iphoneos
    • eg /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.2.sdk
  • $MACOS_SDK: xcrun --show-sdk-path --sdk macosx
    • eg /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-objective_c Related to Objective C support package:ffigen type-enhancement A request for a change that isn't a bug
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants