Skip to content

fsevents fails to build on darwin macos sonoma 14.6 with error header file not found #65

@iamQ0

Description

@iamQ0

I'm trying to run testcontainers on sonoma 14.6.1 but fsevents which is listed as one of the dependencies, fails to build with the below error:

# github.com/fsnotify/fsevents
../../go/pkg/mod/github.com/fsnotify/[email protected]/wrap.go:7:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Below is my machine info:

❯ uname -v
Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030

I have tried updating/installing XCode and CLTs but still it fails to build.

macOS: 14.6.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4
Rosetta 2: false

Possible issue being :
In the newer versions of MacOS the headers files have been moved from/usr/include to Xcode bundle under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk.
So fsevents is failing to build since its possibly trying to find the files in the original location.

This changed has been applied for new Mac and Xcode versions 10 and above.
Check release notes.

If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so

I have even tried setting appropriate CGO_CFLAGS and CGO_LDFLAGS before running :

#cgo CFLAGS: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/System/Library/Frameworks/CoreServices.framework/Headers

#cgo LDFLAGS: -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -L/usr/lib -framework CoreServices

#include <CoreServices/CoreServices.h>
#include <sys/stat.h>

for cgo to find the header files under the Xcode.app location but the issue remains the same.

Please advice. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions