f3fora / lua-nuspell

lua-nuspell is a set of Lua 5.x bindings for Nuspell spellchecking C++ library.
GNU Lesser General Public License v3.0
9 stars 0 forks source link

Fails to install on macOS (12.3) #3

Open dsully opened 2 years ago

dsully commented 2 years ago
$ brew tap nuspell/nuspell
$ brew install nuspell

The above installs nuspell & icu4c, which is a "keg-only" Homebrew formula, meaning it is not symlinked into the Homebrew base prefix. This formula sets ICU_ROOT as it's calling cmake directly: https://github.com/nuspell/homebrew-nuspell/blob/master/Formula/nuspell.rb

$ luarocks install lua-nuspell
Installing https://luarocks.org/lua-nuspell-0.3alpha-1.src.rock

lua-nuspell 0.3alpha-1 depends on lua >= 5.1 (5.4-1 provided by VM)
Warning: unmatched variable LUA_LIBDIR_FILE
Warning: unmatched variable CMAKE_BUILD_TYPE
Warning: unmatched variable LUA_LIBDIR
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found the following ICU libraries:
--   uc (required)
--   data (required)
CMake Error at /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Failed to find all ICU components (missing: ICU_LIBRARY) (found version
  "70.1")
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/FindICU.cmake:335 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /opt/homebrew/lib/cmake/nuspell/NuspellConfig.cmake:2 (find_dependency)
  CMakeLists.txt:18 (find_package)

I can compile manually and avoid cmake via:

PKG_CONFIG_PATH=/opt/homebrew/Cellar/icu4c/*/lib/pkgconfig c++ -fPIC -shared -std=c++17 (pkg-config lua nuspell --libs --cflags | string split -n " ") -o nuspell.so src/nuspell.cxx

However that is not packer friendly.

Any suggestions here? I'm not really familiar with cmake.

f3fora commented 2 years ago

Check #1, in particular: https://github.com/f3fora/lua-nuspell/issues/1#issuecomment-952527892

dsully commented 2 years ago

Thanks - that worked in terms of compiling (should likely be added to the README.md), but also getting a SEGFAULT.

use({
    "f3fora/cmp-nuspell",
    rocks = {
        {
            "lua-nuspell",
            env = {
                ICU_ROOT = "/opt/homebrew/opt/icu4c",
                LUA_LIBDIR = "/opt/homebrew/opt/lua@5.1/lib/",
                LUA_LIBDIR_FILE = "liblua5.1.dylib",
            },
        },
    },
})

I'm running neovim @ HEAD on Monterey with an M1. The stack trace is different from what is in #1

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               nvim [16998]
Path:                  /opt/homebrew/*/nvim
Identifier:            nvim
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        fish [66598]
Responsible:           kitty [82523]
User ID:               501

Date/Time:             2022-03-20 08:35:07.9726 -0700
OS Version:            macOS 12.3 (21E230)
Report Version:        12
Anonymous UUID:        310DF2E2-BD92-A930-435C-190A71C0C7A1

Sleep/Wake UUID:       955A66E1-F268-4960-AC6B-2300B7797BC6

Time Awake Since Boot: 380000 seconds
Time Since Wake:       1406 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0xfffd7ffee9c54c90 -> 0xfffffffee9c54c90 (possible pointer authentication failure)
Exception Codes:       0x0000000000000001, 0xfffd7ffee9c54c90
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [16998]

VM Region Info: 0xfffffffee9c54c90 is not in any region.  Bytes after previous region: 18446638515388501137  
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)
--->  
      UNUSED SPACE AT END

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   liblua.5.1.5.dylib                     0x103f40788 luaS_newlstr + 124
1   liblua.5.1.5.dylib                     0x103f35534 lua_pushlstring + 72
2   liblua.5.1.5.dylib                     0x103f35534 lua_pushlstring + 72
3   liblua.5.1.5.dylib                     0x103f449e0 luaL_findtable + 88
4   liblua.5.1.5.dylib                     0x103f4487c luaL_openlib + 104
5   nuspell.so                             0x10389d330 luaopen_nuspell + 44
6   libluajit-5.1.2.1.0.dylib              0x1035eb978 lj_BC_FUNCC + 44
7   libluajit-5.1.2.1.0.dylib              0x10363a8e4 lj_cf_package_require + 524
8   libluajit-5.1.2.1.0.dylib              0x10363a8e4 lj_cf_package_require + 524
9   libluajit-5.1.2.1.0.dylib              0x1035f859c lua_pcall + 148
10  nvim                                   0x102fc6ee0 nlua_exec_file + 160
11  nvim                                   0x102f6a860 do_source + 1624
12  nvim                                   0x10305b1e4 do_in_cached_path + 660
13  nvim                                   0x10305c514 load_plugins + 328
14  nvim                                   0x102fcfaa8 main + 7276
15  dyld                                   0x103539088 start + 516

Thread 1:
0   libsystem_kernel.dylib                 0x19a2fec40 kevent + 8
1   libuv.1.dylib                          0x1033c9dec uv__io_poll + 756
2   libuv.1.dylib                          0x1033ba808 uv_run + 336
3   nvim                                   0x102f58064 loop_poll_events + 136
4   nvim                                   0x1030b6b7c tui_main + 688
5   libsystem_pthread.dylib                0x19a33626c _pthread_start + 148
6   libsystem_pthread.dylib                0x19a33108c thread_start + 8

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000103464380   x1: 0x0000000103f4eb08   x2: 0x0000000000000007   x3: 0x000000019a34a7c8
    x4: 0x000000000000006c   x5: 0x000000000000006c   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0xfffd800103794c90   x9: 0x00000000bcc98000  x10: 0x0000000103f4eb07  x11: 0x0000000000000000
   x12: 0x00000000d1662a8a  x13: 0x000000000000005f  x14: 0x00000001038a49f4  x15: 0xfffffffffffffff7
   x16: 0x000000019a34a880  x17: 0x0000000103836eb0  x18: 0x0000000000000000  x19: 0x0000000103464380
   x20: 0x0000000000000007  x21: 0x0000000103f4eb08  x22: 0x0000000103464400  x23: 0x0000000103836ee8
   x24: 0x00000000bcc9fb24  x25: 0x00000000fff90000  x26: 0xffffffffffffffff  x27: 0x0000000103836f88
   x28: 0x0000000103836ef0   fp: 0x000000016cf624c0   lr: 0x0000000103f35534
    sp: 0x000000016cf62490   pc: 0x0000000103f40788 cpsr: 0x60001000
   far: 0xfffd7ffee9c54c90  esr: 0x92000004 (Data Abort) byte read Translation fault

Binary Images:
       0x103f30000 -        0x103f4ffff liblua.5.1.5.dylib (*) <da571e57-2bf1-313a-a563-b05f5ece60b7> /opt/homebrew/*/liblua.5.1.5.dylib
       0x103898000 -        0x10389ffff nuspell.so (*) <9157377d-7db0-3a48-ac44-4c2592de0f12> /Users/USER/*/nuspell.so
       0x1035e8000 -        0x103657fff libluajit-5.1.2.1.0.dylib (*) <feb66655-ec39-3102-8e8d-f23139809bac> /opt/homebrew/*/libluajit-5.1.2.1.0.dylib
       0x102e98000 -        0x10314ffff nvim (*) <515691c5-1b4f-3245-b368-b7c0041315cf> /opt/homebrew/*/nvim
       0x103534000 -        0x103593fff dyld (*) <fbb89662-e6f2-3434-b542-f75185ac5e74> /usr/lib/dyld
       0x19a2f7000 -        0x19a32efff libsystem_kernel.dylib (*) <1d7b3b8e-75a1-34ea-aa52-9f7c23155c55> /usr/lib/system/libsystem_kernel.dylib
       0x1033b4000 -        0x1033cffff libuv.1.dylib (*) <cdfcf91d-ee99-3134-8db4-c7d146b20462> /opt/homebrew/*/libuv.1.dylib
       0x19a32f000 -        0x19a33bfff libsystem_pthread.dylib (*) <cee8bc77-6923-34d9-89a3-6f8f7279605e> /usr/lib/system/libsystem_pthread.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=632.4M resident=0K(0%) swapped_out_or_unallocated=632.4M(100%)
Writable regions: Total=1.0G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.0G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                   32K        1 
MALLOC                           233.2M       30 
MALLOC guard page                   96K        4 
MALLOC_MEDIUM (reserved)         360.0M        3         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       56.0M        2 
Stack                             16.0M        2 
VM_ALLOCATE                       9616K       76 
__AUTH                              53K       12 
__AUTH_CONST                      1031K       45 
__DATA                             499K       52 
__DATA_CONST                      3186K       59 
__DATA_DIRTY                        93K       23 
__LINKEDIT                       585.6M       16 
__OBJC_CONST                        37K        6 
__OBJC_RO                         82.9M        1 
__OBJC_RW                         3152K        1 
__TEXT                            46.8M       63 
__UNICODE                          592K        1 
dyld private memory               1024K        1 
shared memory                       32K        2 
===========                     =======  ======= 
TOTAL                              1.7G      401 
TOTAL, minus reserved VM space     1.0G      401 

-----------
Full Report
-----------

{"app_name":"nvim","timestamp":"2022-03-20 08:35:08.00 -0700","app_version":"","slice_uuid":"515691c5-1b4f-3245-b368-b7c0041315cf","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.3 (21E230)","incident_id":"A3607369-1638-48F0-9F89-313002AF9912","name":"nvim"}
{
  "uptime" : 380000,
  "procLaunch" : "2022-03-20 08:35:07.6749 -0700",
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,2",
  "procStartAbsTime" : 9253998945917,
  "coalitionID" : 2046,
  "osVersion" : {
    "train" : "macOS 12.3",
    "build" : "21E230",
    "releaseType" : "User"
  },
  "captureTime" : "2022-03-20 08:35:07.9726 -0700",
  "incident" : "A3607369-1638-48F0-9F89-313002AF9912",
  "bug_type" : "309",
  "pid" : 16998,
  "procExitAbsTime" : 9254005348127,
  "translated" : false,
  "cpuType" : "ARM-64",
  "procName" : "nvim",
  "procPath" : "\/opt\/homebrew\/*\/nvim",
  "parentProc" : "fish",
  "parentPid" : 66598,
  "coalitionName" : "net.kovidgoyal.kitty",
  "crashReporterKey" : "310DF2E2-BD92-A930-435C-190A71C0C7A1",
  "responsiblePid" : 82523,
  "responsibleProc" : "kitty",
  "wakeTime" : 1406,
  "sleepWakeUUID" : "955A66E1-F268-4960-AC6B-2300B7797BC6",
  "sip" : "enabled",
  "vmRegionInfo" : "0xfffffffee9c54c90 is not in any region.  Bytes after previous region: 18446638515388501137  \n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-\/rwx SM=NUL  ...(unallocated)\n--->  \n      UNUSED SPACE AT END",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000001, 0xfffd7ffee9c54c90","rawCodes":[1,-703692109689712],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0xfffd7ffee9c54c90 -> 0xfffffffee9c54c90 (possible pointer authentication failure)"},
  "termination" : {"flags":0,"code":11,"namespace":"SIGNAL","indicator":"Segmentation fault: 11","byProc":"exc handler","byPid":16998},
  "vmregioninfo" : "0xfffffffee9c54c90 is not in any region.  Bytes after previous region: 18446638515388501137  \n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-\/rwx SM=NUL  ...(unallocated)\n--->  \n      UNUSED SPACE AT END",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":4569062,"threadState":{"x":[{"value":4349903744},{"value":4361349896},{"value":7},{"value":6882109384},{"value":108},{"value":108},{"value":0},{"value":0},{"value":18446040390621023376},{"value":3167322112},{"value":4361349895},{"value":0},{"value":3513133706},{"value":95},{"value":4354361844},{"value":18446744073709551607},{"value":6882109568,"symbolLocation":0,"symbol":"_platform_strlen"},{"value":4353912496},{"value":0},{"value":4349903744},{"value":7},{"value":4361349896},{"value":4349903872},{"value":4353912552},{"value":3167353636},{"value":4294508544},{"value":18446744073709551615},{"value":4353912712},{"value":4353912560}],"flavor":"ARM_THREAD_STATE64","lr":{"value":4361246004},"cpsr":{"value":1610616832},"fp":{"value":6123037888},"sp":{"value":6123037840},"esr":{"value":2449473540,"description":"(Data Abort) byte read Translation fault"},"pc":{"value":4361291656,"matchesCrashFrame":1},"far":{"value":18446040381599861904}},"queue":"com.apple.main-thread","frames":[{"imageOffset":67464,"symbol":"luaS_newlstr","symbolLocation":124,"imageIndex":0},{"imageOffset":21812,"symbol":"lua_pushlstring","symbolLocation":72,"imageIndex":0},{"imageOffset":21812,"symbol":"lua_pushlstring","symbolLocation":72,"imageIndex":0},{"imageOffset":84448,"symbol":"luaL_findtable","symbolLocation":88,"imageIndex":0},{"imageOffset":84092,"symbol":"luaL_openlib","symbolLocation":104,"imageIndex":0},{"imageOffset":21296,"symbol":"luaopen_nuspell","symbolLocation":44,"imageIndex":1},{"imageOffset":14712,"symbol":"lj_BC_FUNCC","symbolLocation":44,"imageIndex":2},{"imageOffset":338148,"symbol":"lj_cf_package_require","symbolLocation":524,"imageIndex":2},{"imageOffset":338148,"symbol":"lj_cf_package_require","symbolLocation":524,"imageIndex":2},{"imageOffset":66972,"symbol":"lua_pcall","symbolLocation":148,"imageIndex":2},{"imageOffset":1240800,"symbol":"nlua_exec_file","symbolLocation":160,"imageIndex":3},{"imageOffset":862304,"symbol":"do_source","symbolLocation":1624,"imageIndex":3},{"imageOffset":1847780,"symbol":"do_in_cached_path","symbolLocation":660,"imageIndex":3},{"imageOffset":1852692,"symbol":"load_plugins","symbolLocation":328,"imageIndex":3},{"imageOffset":1276584,"symbol":"main","symbolLocation":7276,"imageIndex":3},{"imageOffset":20616,"symbol":"start","symbolLocation":516,"imageIndex":4}]},{"id":4569063,"frames":[{"imageOffset":31808,"symbol":"kevent","symbolLocation":8,"imageIndex":5},{"imageOffset":89580,"symbol":"uv__io_poll","symbolLocation":756,"imageIndex":6},{"imageOffset":26632,"symbol":"uv_run","symbolLocation":336,"imageIndex":6},{"imageOffset":786532,"symbol":"loop_poll_events","symbolLocation":136,"imageIndex":3},{"imageOffset":2222972,"symbol":"tui_main","symbolLocation":688,"imageIndex":3},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":7},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":7}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4361224192,
    "size" : 131072,
    "uuid" : "da571e57-2bf1-313a-a563-b05f5ece60b7",
    "path" : "\/opt\/homebrew\/*\/liblua.5.1.5.dylib",
    "name" : "liblua.5.1.5.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4354310144,
    "size" : 32768,
    "uuid" : "9157377d-7db0-3a48-ac44-4c2592de0f12",
    "path" : "\/Users\/USER\/*\/nuspell.so",
    "name" : "nuspell.so"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4351492096,
    "size" : 458752,
    "uuid" : "feb66655-ec39-3102-8e8d-f23139809bac",
    "path" : "\/opt\/homebrew\/*\/libluajit-5.1.2.1.0.dylib",
    "name" : "libluajit-5.1.2.1.0.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4343824384,
    "size" : 2850816,
    "uuid" : "515691c5-1b4f-3245-b368-b7c0041315cf",
    "path" : "\/opt\/homebrew\/*\/nvim",
    "name" : "nvim"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4350754816,
    "size" : 393216,
    "uuid" : "fbb89662-e6f2-3434-b542-f75185ac5e74",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6881767424,
    "size" : 229376,
    "uuid" : "1d7b3b8e-75a1-34ea-aa52-9f7c23155c55",
    "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
    "name" : "libsystem_kernel.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4349181952,
    "size" : 114688,
    "uuid" : "cdfcf91d-ee99-3134-8db4-c7d146b20462",
    "path" : "\/opt\/homebrew\/*\/libuv.1.dylib",
    "name" : "libuv.1.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6881996800,
    "size" : 53248,
    "uuid" : "cee8bc77-6923-34d9-89a3-6f8f7279605e",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 6878707712,
  "size" : 3136438272,
  "uuid" : "00edbaf8-9281-3f26-b94f-e6a315e3a659"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=632.4M resident=0K(0%) swapped_out_or_unallocated=632.4M(100%)\nWritable regions: Total=1.0G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.0G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nKernel Alloc Once                   32K        1 \nMALLOC                           233.2M       30 \nMALLOC guard page                   96K        4 \nMALLOC_MEDIUM (reserved)         360.0M        3         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       56.0M        2 \nStack                             16.0M        2 \nVM_ALLOCATE                       9616K       76 \n__AUTH                              53K       12 \n__AUTH_CONST                      1031K       45 \n__DATA                             499K       52 \n__DATA_CONST                      3186K       59 \n__DATA_DIRTY                        93K       23 \n__LINKEDIT                       585.6M       16 \n__OBJC_CONST                        37K        6 \n__OBJC_RO                         82.9M        1 \n__OBJC_RW                         3152K        1 \n__TEXT                            46.8M       63 \n__UNICODE                          592K        1 \ndyld private memory               1024K        1 \nshared memory                       32K        2 \n===========                     =======  ======= \nTOTAL                              1.7G      401 \nTOTAL, minus reserved VM space     1.0G      401 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "61af99aeda72d16a4beb7756",
      "factorPackIds" : {
        "SIRI_DIALOG_ASSETS" : "622f5255d14f83424df66885"
      },
      "deploymentId" : 240000052
    },
    {
      "rolloutId" : "6112dda2fc54bc3389840642",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "622f59b5d14f83424df668af"
      },
      "deploymentId" : 240000086
    }
  ],
  "experiments" : [

  ]
}
}
f3fora commented 2 years ago

https://github.com/f3fora/lua-nuspell/issues/1#issuecomment-954480575

Does it work outside nvim installing via luarocks?

dsully commented 2 years ago

Yes, same issue as #1, but different stack trace which appears to be in liblua5.1 as opposed to Neovim.

So maybe something with how luaopen_nuspell is calling here?

#if LUA_VERSION_NUM >= 502
    luaL_newlib(L, Finder_Regs);
#else
    luaL_register(L, PROJECT_NAME, Finder_Regs);
#