notify icon indicating copy to clipboard operation
notify copied to clipboard

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

Open huahuayu opened this issue 3 years ago • 8 comments

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/[email protected]/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../pkg/mod/github.com/rjeczalik/[email protected]/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 avatar Nov 12 '20 09:11 huahuayu

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 avatar Nov 12 '20 09:11 huahuayu

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 avatar Nov 13 '20 02:11 huahuayu

but after this been fixed, another issue occurs :(

# github.com/rjeczalik/notify
In file included from ../../pkg/mod/github.com/rjeczalik/[email protected]/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.

huahuayu avatar Nov 13 '20 02:11 huahuayu

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

rjeczalik avatar Nov 13 '20 06:11 rjeczalik

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 avatar Nov 13 '20 09:11 huahuayu

xcode 12.3 beta is installed, no use

huahuayu avatar Nov 14 '20 02:11 huahuayu

@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>

rjeczalik avatar Nov 14 '20 14:11 rjeczalik

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/[email protected]/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../go/pkg/mod/github.com/rjeczalik/[email protected]/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 avatar Nov 16 '20 09:11 huahuayu