Coder Social home page Coder Social logo

hfsevents's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hfsevents's Issues

Version 0.2.0 maintenance/update

The package is (mostly) not broken, but there is some maintenance that can be done:

  • add functionality introduced by recent macOS (is there anything that should be added?)
  • fix deprecation errors, switch to newer API, potentially drop support for very old macOS versions
  • remove osVersion, this was originally meant only to query for file level events. they have been supported for a very long time now
  • revisit callback model, having a pipe and a pthread for every watch uses more resources than necessary perhaps, maybe we can do without

Any other requests?

Requires cereal < 0.4

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.

"c_fsevents.o: No such file or directory" build error with GHC 9.8

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 

Hackage docs

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.

not detecting files saved by Intellij IDEA ?

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 ?)

warnings & crashes

@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

Missing CoreServices.h

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

need to set -pgma clang -pgmc clang on mac

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

Fails to load on macOS Big Sur.

$ 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.

Build error on Yosemite

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

fatal error: 'CoreServices/CoreServices.h' file not found OS X Catalina

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

Encountering user error (could not create file system event stream)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.