rjeczalik / notify

File system event notification library on steroids.
MIT License
900 stars 128 forks source link

build error from mac osx 10.15 fatal error: 'CoreServices/CoreServices.h' file not found #196

Open huahuayu opened 3 years ago

huahuayu commented 3 years ago

hi, when I build a project which depends on notify in mac osx 10.15 , it gets below error

the detail step is described here: would you please to check: https://github.com/ethereum/go-ethereum/issues/21835

error info

# github.com/rjeczalik/notify
../../pkg/mod/github.com/rjeczalik/notify@v0.9.1/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../pkg/mod/github.com/rjeczalik/notify@v0.9.1/watcher_fsevents_cgo.go:10:10: note: did not find header 'CoreServices.h' in framework 'CoreServices' (loaded from '/System/Library/Frameworks')
1 error generated.
huahuayu commented 3 years ago

but I see the header is here

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Headers/CoreServices.h

I made symbolic links to /usr/local/include/ but not working, it seems loaded from '/System/Library/Frameworks', I don't know the specific path, why not read from /usr/local/include/

sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Headers/*  /usr/local/include/
huahuayu commented 3 years ago

below ln is work!

sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Headers /System/Library/Frameworks/CoreServices.framework
huahuayu commented 3 years ago

but after this been fixed, another issue occurs :(

# github.com/rjeczalik/notify
In file included from ../../pkg/mod/github.com/rjeczalik/notify@v0.9.1/watcher_fsevents_cgo.go:10:
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:23:10: fatal error: 'AE/AE.h' file not found
#include <AE/AE.h>
         ^~~~~~~~~
1 error generated.
rjeczalik commented 3 years ago

Hey @huahuayu, you need to ensure your xcode installation is sound, as well your system packages. Please see those issues for a reference:

https://github.com/rjeczalik/notify/issues/180 https://github.com/rjeczalik/notify/issues/165

huahuayu commented 3 years ago

I have read the issue you linked, no use.

I have latest xcode from appstore, I installed it three days ago, and today it's has 12.2 updates, I upgrade as well.

Now my xcode version is : 12.2

I am trying download 12.3 beta.xip ...

huahuayu commented 3 years ago

xcode 12.3 beta is installed, no use

rjeczalik commented 3 years ago

@huahuayu There are some others topic on this very issue:

https://trac.macports.org/ticket/46628

In other words it is not an issue with notify, it is an issue with devel packages on the system. Something is apparently missing, notify has not way of fixing that.

You could try using kqueue on macOS, which does not require working CGO -

go build -tags kqueue <you cmd>
huahuayu commented 3 years ago

I upgrade to macos 11, and it removes the ln I created in /System/Library/Frameworks/CoreServices.framework, the issue is still there

$ go build ./...
# gopkg.in/olebedev/go-duktape.v3
In file included from _cgo_export.c:4:
debugger.go:23:13: warning: unused function '_duk_debugger_attach' [-Wunused-function]
# github.com/rjeczalik/notify
../go/pkg/mod/github.com/rjeczalik/notify@v0.9.1/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../go/pkg/mod/github.com/rjeczalik/notify@v0.9.1/watcher_fsevents_cgo.go:10:10: note: did not find header 'CoreServices.h' in framework 'CoreServices' (loaded from '/System/Library/Frameworks')
1 error generated.