ld: framework not found HIServices

tofutimtofutim Tim UyUSUniversity ✭✭
edited September 8 in Xamarin.Mac

Hi, I am trying to access some functions from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework. This used to work (I think) in Xamarin Studio but since switching to Visual Studio for Mac I am getting an error where HIServices is not found. Code from before looked like

        public const string ApplicationServicesHIServicesFramework =
            "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/HIServices";

        [DllImport(ApplicationServicesHIServicesFramework, EntryPoint = "AXIsProcessTrustedWithOptions")]
        static extern sbyte _AXIsProcessTrustedWithOptions(IntPtr nsDictionaryRef);

        public static bool AXIsProcessTrustedWithOptions(NSDictionary dict)
        {
            return _AXIsProcessTrustedWithOptions(dict.Handle) != 0;
        }

This parallels the CoreText string from ObjCRuntime.Constants. Did something change in VSfM? How can I get this to work again?

xcrun does have HIServices added in:

xcrun -sdk macosx clang -g -mmacosx-version-min=10.9 -arch x86_64 -fobjc-runtime=macosx -ObjC -framework CoreFoundation -framework Security -framework CoreServices -framework SystemConfiguration -framework CoreGraphics -framework CoreText -framework CoreVideo -framework GameController -framework AppKit -framework ImageIO -framework MapKit -framework MediaAccessibility -framework MediaToolbox -framework Foundation -framework SceneKit -framework Accelerate -framework QuickLook -framework AudioToolbox -framework QuartzCore -framework ApplicationServices -framework VideoToolbox -framework Carbon -framework AVFoundation -framework AudioUnit -framework CoreLocation -framework GLKit -framework OpenGL -framework CoreMIDI -framework WebKit -framework Accounts -framework Quartz -framework CoreData -framework IOBluetooth -framework CoreMedia -framework CoreWLAN -framework EventKit -framework JavaScriptCore -framework MediaLibrary -framework GameKit -framework QTKit -framework SpriteKit -framework AVKit -framework ScriptingBridge -framework Social -framework StoreKit -framework HIServices -weak_framework NotificationCenter -weak_framework Intents -weak_framework GameplayKit -weak_framework LocalAuthentication -weak_framework MediaPlayer -weak_framework Metal -weak_framework MetalKit -weak_framework ModelIO -weak_framework MultipeerConnectivity -weak_framework SafariServices -weak_framework CloudKit -weak_framework Contacts -weak_framework FinderSync ...

This seems to be added automatically, since when I comment out the dllimport, it doesn't show up. I believe this it is doing the equivalent of LinkWith.

Answers

  • tofutimtofutim Tim Uy USUniversity ✭✭
    edited September 8

    I've tried different strings for the Framework location, including /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk but these give me HIServices not found. So xcrun is finding it but not able to load it somehow.

  • tofutimtofutim Tim Uy USUniversity ✭✭

    It is a clang or path issue:

    Tims-MacBook-Air:scratch tim$ clang -framework HIServices
    ld: framework not found HIServices
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Tims-MacBook-Air:scratch tim$ clang -framework CoreText
    Undefined symbols for architecture x86_64:
    "_main", referenced from:
    implicit entry/start for main executable
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Tims-MacBook-Air:scratch tim$

Sign In or Register to comment.