asmagill / hammerspoon_asm

Hammerspoon modules in progress...
MIT License
52 stars 12 forks source link

Fatal Error on iMac running 10.10.5 #3

Closed latenitefilms closed 8 years ago

latenitefilms commented 8 years ago

I just tried using axuielement on one of our iMac running 10.10.5 and it breaks Hammerspoon with the following error:

-- Loading extension: uielement
*** ERROR: error loading module 'hs._asm.axuielement.internal' from file '/Users/latenitebravo/.hammerspoon/hs/_asm/axuielement/internal.so':
    dlopen(/Users/latenitebravo/.hammerspoon/hs/_asm/axuielement/internal.so, 6): Symbol not found: _CVMetalTextureCacheGetTypeID
  Referenced from: /Users/latenitebravo/.hammerspoon/hs/_asm/axuielement/internal.so (which was built for Mac OS X 10.12)
  Expected in: /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo
 in /Users/latenitebravo/.hammerspoon/hs/_asm/axuielement/internal.so
stack traceback:
    [C]: in ?
    [C]: in function 'rawrequire'
    ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:449: in function 'require'
    .../latenitebravo/.hammerspoon/hs/_asm/axuielement/init.lua:30: in main chunk
    [C]: in function 'rawrequire'
    ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:449: in function 'require'
    /Users/latenitebravo/.hammerspoon/init.lua:56: in main chunk
    [C]: in function 'xpcall'
    ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:481: in function 'hs._coresetup.setup'
    (...tail calls...)
asmagill commented 8 years ago

The code which converts data types from their internal representation to lua was designed to be useful in a larger context, perhaps eventually being added to one of our internal frameworks so it doesn't have to be repeated. However, now that I've played with axuielement for a while, I think I can remove most of the "extra types" since they aren't relevant to Accessibility.

This is a long way of saying that the module currently has code to identify variable types it will never use... and some of them are newer than 10.10... if the conversion code ever gets made into a reusable library, additional code should be added to detect the OS version and work around this... however, the simplest fix, which I can include in some updates I plan to add tonight, is to simply remove the data types that I now know Accessibility never uses.

latenitefilms commented 8 years ago

Awesome - thank you!!

latenitefilms commented 8 years ago

I fixed this by commenting out lines 156 and 157 in internal.m:

    //lua_pushstring(L, "CVMetalTexture") ;        lua_seti(L, -2, (lua_Integer)CVMetalTextureGetTypeID()) ;
    //lua_pushstring(L, "CVMetalTextureCache") ;   lua_seti(L, -2, (lua_Integer)CVMetalTextureCacheGetTypeID()) ;
asmagill commented 8 years ago

The current version at https://github.com/asmagill/hs._asm.axuielement/ has these extraneous types removed as well, but since I'm still working on the search rewrite, I hadn't really posted about it yet! Guess I should have here, but glad you got it working for you for now!

latenitefilms commented 8 years ago

No worries at all! Thanks @asmagill!