简体   繁体   中英

What do I need to call CSBackupIsItemExcluded (probably from either Frameworks or Core Services) on macOS Big Sur?

Prior to updating to Big Sur today, I was able (on Mojave) to command-line compile/link a C program that calls CSBackupIsItemExcluded and CFURLCreateFromFileSystemRepresentation.

I achieved this (on Mojave) by linking:

cc cbget.o \
     /System/Library/Frameworks/Carbon.framework/Carbon \
     /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
   -o cbget

I remember it taking me days to find this out (and find/download the files) a year or two ago, and now I can't recall what I did:( (Yeah, this time I'm taking better notes!)

If I try the above, it fails...those files/directories don't exist on Big Sur.

If I omit them, linking fails (expectedly) with:

Undefined symbols for architecture x86_64: "_CFURLCreateFromFileSystemRepresentation", referenced from: _handle_file in cbget-b22970.o "_CSBackupIsItemExcluded", referenced from: _handle_file in cbget-b22970.o

I can't rely on XCode to magically find anything... I'm compiling/linking from the command line.

I know that CSBackupIsItemExcluded is still in the OS... because the version of the program compiled/linked under Mojave that uses it runs just fine (and lets me toggle "don't backup" for files from the command line).

BTW, moving from Mojave to Big Sur, I was surprised to find "/usr/include" has disappeared, and that the Apple-supplied "cc" magically knows to look at: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 for things like "#include <stdint.h>"

thanks for any pointers! Stan

I can believe that the Carbon framework might have disappeared (Apple deprecated it a long time ago) but not CoreFoundation. CoreFoundation is one of the first things loaded when booting and a lot of other things depend on it.

Having said that though, if you do need Carbon (and it's still around) then I think you want to link against:

/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon

rather than:

/System/Library/Frameworks/Carbon.framework/Carbon


CFURLCreateFromFileSystemRepresentation is part of CoreFoundation.

CSBackupIsItemExcluded is part of CoreServices, so try linking with that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM