luite / hfsevents Goto Github PK
View Code? Open in Web Editor NEWHaskell bindings for the OS X FSEvents API - Event based filesystem monitoring
License: BSD 3-Clause "New" or "Revised" License
Haskell bindings for the OS X FSEvents API - Event based filesystem monitoring
License: BSD 3-Clause "New" or "Revised" License
Is it possible to avoid using a pipe for communicating between C to Haskell? A pipe uses 2 fds. It will be much more scalable if we can do away with those fds.
Haskell stack runs out of fds on OSX while using filewatch via fsnotify
. Please see commercialhaskell/stack#1979 .
The package is (mostly) not broken, but there is some maintenance that can be done:
osVersion
, this was originally meant only to query for file level events. they have been supported for a very long time nowAny other requests?
error: unknown type name 'uuid_string_t'; did you mean 'io_string_t'?
Result of:
cabal-dev install -v3 hfsevents > hfsevents-fail.log
You cannot get hfsevents
working with ghc 7.7 (soon 7.8) because it requires cereal ==0.3.*
, which does not compile with base ==4.7
. Allowing cereal-0.4.0.0
and building hfsevents
seems to work.
Is there a reason that hfsevents
specifies cereal < 0.4
? If not, the requirement should be removed so that it works with ghc >= 7.7.
hfsevents builds for me with GHC 9.6 but not with 9.8. Would anyone have ideas on this error ?
$ stack build hfsevents --stack-yaml stack9.8.yaml
Warning: Stack has not been tested with GHC versions 9.8 and above, and using 9.8.1, this may fail.
hfsevents> configure
hfsevents> Configuring hfsevents-0.1.6...
hfsevents> build
hfsevents> Preprocessing library for hfsevents-0.1.6..
hfsevents> Building library for hfsevents-0.1.6..
hfsevents> [1 of 1] Compiling System.OSX.FSEvents
hfsevents> ar: .stack-work/dist/aarch64-osx/ghc-9.8.1/build/cbits/c_fsevents.o: No such file or directory
Error: [S-7282]
Stack failed to execute the build plan.
While executing the build plan, Stack encountered the error:
[S-7011]
While building package hfsevents-0.1.6 (scroll up to its section to see the error) using:
/Users/simon/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_6HauvNHV_3.10.2.0_ghc-9.8.1 --verbose=1 --builddir=.stack-work/dist/aarch64-osx/ghc-9.8.1 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Would you mind manually uploading the documentation for this library to Hackage? Their auto-generated docs fail since this library requires linking to some OS X only code which their build servers don't have.
The easiest way to do it is to use this script.
Thanks.
Thanks for hfsevents, which is used in hledger-ui via fsnotify. I am seeing events when I save a file from emacs, but not when I save it from IDEA. Here's a log from both.. any ideas ?
module Main where
import System.OSX.FSEvents
import Control.Monad
import Control.Concurrent
main = do
es <- eventStreamCreate ["."] 1.0 True True True print
replicateM 30 (threadDelay 10000000)
putStrLn "destroying event stream"
eventStreamDestroy es
replicateM 30 (threadDelay 10000000)
~/src/hledger$ ./hfstest
[EMACS:]
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.#a.j", eventId = 610728226, eventFlags = 262400}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/a.j", eventId = 610728235, eventFlags = 70656}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.#a.j", eventId = 610728238, eventFlags = 262912}
[IDEA:]
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.git/index.lock", eventId = 610728402, eventFlags = 65792}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.git/index.lock", eventId = 610728414, eventFlags = 66304}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/a.j___jb_tmp___", eventId = 610728631, eventFlags = 71936}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/a.j", eventId = 610728635, eventFlags = 83968}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/a.j___jb_old___", eventId = 610728638, eventFlags = 68096}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.idea/workspace.xml___jb_tmp___", eventId = 610728688, eventFlags = 71936}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.idea/workspace.xml", eventId = 610728692, eventFlags = 83968}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.idea/workspace.xml___jb_old___", eventId = 610728695, eventFlags = 68096}
Event {eventPath = "/Users/simon/src/PLAINTEXTACCOUNTING/hledger/.git/index.lock", eventId = 610728701, eventFlags = 66304}
(Also, in that test program, what's the reason for destroying the event stream, and for waiting afterward ?)
@mdittmer & I are seeing some issues using this lib. The problem is that it is not 100% reproduceable. I just got these errors when starting up my program, after it creates some watches:
2012-09-03 06:22 watch[86593] (CarbonCore.framework) _createAndAddRunLoopSource(): failed assertion 'streamRef->d2f_port != MACH_PORT_NULL'
2012-09-03 06:22 watch[86593] (CarbonCore.framework) FSEventStreamScheduleWithRunLoop: ERROR: _createAndAddRunLoopSource(...) => (os/kern) failure (5)
2012-09-03 06:22 watch[86593] (CarbonCore.framework) streamRef->cfRunLoopSourceRef != NULL || streamRef->event_source != NULL(): failed assertion: Must call FSEventStreamScheduleWithRunLoop() before calling FSEventStreamStart()
I am also seeing this a little bit after the watches are placed:
zsh: bus error dist/build/watch/watch
cabal install hfsevents-0.1.3 causes an error as follows.
My environment is Mac OSX 10.8.2 + Haskell platform 2012.4.0.0
When calling
cabal install hfsevents
I get
[1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, dist/build/System/OSX/FSEvents.p_o )
cbits/c_fsevents.m:1:39:
error: CoreServices/CoreServices.h: No such file or directory
Building hfsevents-0.1.5... Preprocessing library hfsevents-0.1.5... [1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, dist/build/System/OSX/FSEvents.o ) gcc-4.8: error: language objective-c not recognized gcc-4.8: error: language objective-c not recognized
if i pass -pgmc clang -pgma clang things work out fine
$ cabal repl
Build profile: -w ghc-8.8.4 -O1
In order, the following will be built (use -v for more details):
- hfsevents-0.1.6 (lib) (ephemeral targets)
Preprocessing library for hfsevents-0.1.6..
GHCi, version 8.8.4: https://www.haskell.org/ghc/ :? for help
<command line>: user specified .o/.so/.DLL could not be loaded (not found)
Whilst trying to load: (framework) Cocoa
Additional directories searched: (none)
cabal: repl failed for hfsevents-0.1.6.
Here's output.
[1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, dist/build/System/OSX/FSEvents.o )
In file included from /usr/include/os/object.h:75:0:
0,
from /usr/include/dispatch/dispatch.h:48,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19,
from cbits/c_fsevents.m:1:
/usr/include/objc/NSObject.h:22:1:
error: unknown type name 'instancetype'
- (instancetype)self;
^
/usr/include/objc/NSObject.h:36:1:
error: unknown type name 'instancetype'
- (instancetype)retain OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:38:1:
error: unknown type name 'instancetype'
- (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
^
/usr/include/objc/NSObject.h:60:1:
error: unknown type name 'instancetype'
- (instancetype)init;
^
/usr/include/objc/NSObject.h:62:1:
error: unknown type name 'instancetype'
+ (instancetype)new;
^
/usr/include/objc/NSObject.h:63:1:
error: unknown type name 'instancetype'
+ (instancetype)allocWithZone:(struct _NSZone *)zone;
^
/usr/include/objc/NSObject.h:64:1:
error: unknown type name 'instancetype'
+ (instancetype)alloc;
^
In file included from /usr/include/dispatch/dispatch.h:51:0:
0,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19,
from cbits/c_fsevents.m:1:
/usr/include/dispatch/object.h:143:15:
error: expected identifier or '(' before '^' token
typedef void (^dispatch_block_t)(void);
^
/usr/include/dispatch/object.h:362:3:
error: unknown type name 'dispatch_block_t'
dispatch_block_t notification_block);
^
cbits/c_fsevents.m: In function 'osVersion':
cbits/c_fsevents.m:106:4:
warning: 'Gestalt' is deprecated (declared at /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Gestalt.h:123) [-Wdeprecated-declarations]
Gestalt(gestaltSystemVersionMajor, majorVersion);
^
cbits/c_fsevents.m:107:4:
warning: 'Gestalt' is deprecated (declared at /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Gestalt.h:123) [-Wdeprecated-declarations]
Gestalt(gestaltSystemVersionMinor, minorVersion);
^
cbits/c_fsevents.m:108:4:
warning: 'Gestalt' is deprecated (declared at /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Gestalt.h:123) [-Wdeprecated-declarations]
Gestalt(gestaltSystemVersionBugFix, bugFixVersion);
^
Failed to install hfsevents-0.1.5
cabal: Error: some packages failed to install:
hfsevents-0.1.5 failed during the building phase. The exception was:
ExitFailure 1
I am facing an above issue when running cabal install hfsevents
. This is very similar to #3
Error message I get:
Resolving dependencies...
Build profile: -w ghc-8.10.1 -O1
In order, the following will be built (use -v for more details):
- hfsevents-0.1.6 (lib) (requires build)
Starting hfsevents-0.1.6 (lib)
Building hfsevents-0.1.6 (lib)
Failed to build hfsevents-0.1.6.
Build log ( /Users/serhiip/.cabal/logs/ghc-8.10.1/hfsvnts-0.1.6-e6f8b654.log
):
Configuring library for hfsevents-0.1.6..
Preprocessing library for hfsevents-0.1.6..
Building library for hfsevents-0.1.6..
[1 of 1] Compiling System.OSX.FSEvents ( System/OSX/FSEvents.hs, dist/build/System/OSX/FSEvents.o, dist/build/System/OSX/FSEvents.dyn_o )
cbits/c_fsevents.m:1:10: error:
fatal error: 'CoreServices/CoreServices.h' file not found
|
1 | #include <CoreServices/CoreServices.h>
| ^
#include <CoreServices/CoreServices.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
`cc' failed in phase `C Compiler'. (Exit code: 1)
cabal: Failed to build hfsevents-0.1.6. See the build log above for details.
I have Xcode freshly installed and I am able to locate header file at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Headers/CoreServices.h
but defining this env var (in my .zshrc) like this doesn't help
export CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Headers/"
UPD: log of cabal install with -v3 https://pastebin.com/FDygnfQB
I'm getting this on OS X 10.12.6 Sierra and it reproduces when running ghcid --command="./hadrian/ghci.sh"
on ghc repo as was initially reported here. I'm not sure how to create a smaller reproduction case yet, but I can provide more information if it's not reproducible outside my machine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.