typedbyte / switch

A library for interacting with Nintendo Switch controllers, written in Haskell.
BSD 3-Clause "New" or "Revised" License
109 stars 6 forks source link

Doesnt work on mac os #2

Open Hakimba opened 3 years ago

Hakimba commented 3 years ago

Hi, i tried to execute the tests and i have those errors.

hakimbaaloudj@MacBook-Pro-de-Hakim switch % cabal test Build profile: -w ghc-8.10.4 -O1 In order, the following will be built (use -v for more details):

  • linear-1.20.9 (lib:linear) (requires build)
  • switch-0.1.0.0 (test:leftJoyCon) (first run)
  • switch-0.1.0.0 (test:proController) (first run)
  • switch-0.1.0.0 (test:rightJoyCon) (first run)
  • GPipe-2.2.5 (lib) (requires build)
  • GPipe-GLFW-1.4.1.4 (lib) (requires build)
  • switch-0.1.0.0 (test:cube) (first run) Starting linear-1.20.9 (all, legacy fallback) Preprocessing test suite 'leftJoyCon' for switch-0.1.0.0.. Building test suite 'leftJoyCon' for switch-0.1.0.0.. Preprocessing test suite 'proController' for switch-0.1.0.0.. Building test suite 'proController' for switch-0.1.0.0.. Preprocessing test suite 'rightJoyCon' for switch-0.1.0.0.. Building test suite 'rightJoyCon' for switch-0.1.0.0.. Linking /Users/hakimbaaloudj/computer-science/projet_perso/joycons/switch/dist-newstyle/build/x86_64-osx/ghc-8.10.4/switch-0.1.0.0/t/leftJoyCon/build/leftJoyCon/leftJoyCon ... Linking /Users/hakimbaaloudj/computer-science/projet_perso/joycons/switch/dist-newstyle/build/x86_64-osx/ghc-8.10.4/switch-0.1.0.0/t/proController/build/proController/proController ... Linking /Users/hakimbaaloudj/computer-science/projet_perso/joycons/switch/dist-newstyle/build/x86_64-osx/ghc-8.10.4/switch-0.1.0.0/t/rightJoyCon/build/rightJoyCon/rightJoyCon ... Undefined symbols for architecture x86_64: "_IORegistryEntryGetPath", referenced from: _create_device_info_with_usage in libHShdp-0.1.7-94b6b9fe.a(hid.o) Undefined symbols for architecture x86_64: "_IORegistryEntryGetPath", referenced from: _create_device_info_with_usage in libHShdp-0.1.7-94b6b9fe.a(hid.o) Undefined symbols for architecture x86_64: "_IORegistryEntryGetPath", referenced from: _create_device_info_with_usage in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceUnscheduleFromRunLoop", referenced from: "_IOHIDDeviceUnscheduleFromRunLoop", referenced from: "_IOHIDDeviceUnscheduleFromRunLoop", referenced from: _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceSetReport", referenced from: "_IOHIDDeviceSetReport", referenced from: "_IOHIDDeviceSetReport", referenced from: _hid_write in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_write in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_write in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_kIOMasterPortDefault", referenced from: "_kIOMasterPortDefault", referenced from: "_kIOMasterPortDefault", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceRegisterInputReportCallback", referenced from: "_IOHIDDeviceRegisterInputReportCallback", referenced from: "_IOHIDDeviceRegisterInputReportCallback", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOObjectRelease", referenced from: "_IOObjectRelease", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOObjectRelease", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceCreate", referenced from: "_IOHIDDeviceCreate", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceCreate", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDManagerCreate", referenced from: "_IOHIDManagerCreate", referenced from: "_IOHIDManagerCreate", referenced from: _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDManagerCopyDevices", referenced from: "_IOHIDManagerCopyDevices", referenced from: "_IOHIDManagerCopyDevices", referenced from: _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IORegistryEntryFromPath", referenced from: "_IORegistryEntryFromPath", referenced from: "_IORegistryEntryFromPath", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceOpen", referenced from: "_IOHIDDeviceOpen", referenced from: "_IOHIDDeviceOpen", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDManagerSetDeviceMatching", referenced from: "_IOHIDManagerSetDeviceMatching", referenced from: "_IOHIDManagerSetDeviceMatching", referenced from: _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceGetProperty", referenced from: "_IOHIDDeviceGetProperty", referenced from: "_IOHIDDeviceGetProperty", referenced from: _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _create_device_info_with_usage in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _create_device_info_with_usage in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _create_device_info_with_usage in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDManagerClose", referenced from: "_IOHIDManagerClose", referenced from: _hid_exit in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_exit in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDManagerClose", referenced from: _hid_exit in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceClose", referenced from: "_IOHIDDeviceClose", referenced from: "_IOHIDDeviceClose", referenced from: _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceScheduleWithRunLoop", referenced from: _read_thread in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceScheduleWithRunLoop", referenced from: _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _read_thread in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceScheduleWithRunLoop", referenced from: _read_thread in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDDeviceRegisterRemovalCallback", referenced from: "_IOHIDDeviceRegisterRemovalCallback", referenced from: "_IOHIDDeviceRegisterRemovalCallback", referenced from: _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_close in libHShdp-0.1.7-94b6b9fe.a(hid.o) "_IOHIDManagerScheduleWithRunLoop", referenced from: "_IOHIDManagerScheduleWithRunLoop", referenced from: "_IOHIDManagerScheduleWithRunLoop", referenced from: _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_init in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_enumerate in libHShdp-0.1.7-94b6b9fe.a(hid.o) _hid_open_path in libHShdp-0.1.7-94b6b9fe.a(hid.o) ld: symbol(s) not found for architecture x86_64 ld: symbol(s) not found for architecture x86_64 ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) clang: error: linker command failed with exit code 1 (use -v to see invocation) clang: error: linker command failed with exit code 1 (use -v to see invocation) gcc' failed in phaseLinker'. (Exit code: 1) gcc' failed in phaseLinker'. (Exit code: 1) gcc' failed in phaseLinker'. (Exit code: 1) Building linear-1.20.9 (all, legacy fallback) Installing linear-1.20.9 (all, legacy fallback) Completed linear-1.20.9 (all, legacy fallback) cabal: Failed to build test:leftJoyCon from switch-0.1.0.0. Failed to build test:proController from switch-0.1.0.0. Failed to build test:rightJoyCon from switch-0.1.0.0.

Setup : mac os Big sur 11.2.3, ghc 8.10.4, cabal 3.4.0.0

typedbyte commented 3 years ago

Hi, thank you for the report. I am not a Mac user myself, but your error seems conceptually similar to chpatrick/haskell-hidapi#3. Are you able to separately build the hidapi library (Hackage)?

Hakimba commented 3 years ago

I just try to "cabal build" haskell-hidapi and it works well

Hakimba commented 3 years ago

I succeed to launch the functions of the test files (for example, i'm able to play with LeftJoyCon) , with stack ghci, but stack test or cabal test do not work, it's really weird. Another question, there is no documentation for your code ?

typedbyte commented 3 years ago

Indeed, this is weird. Under Windows 10, both stack and cabal work just fine. I am glad that it worked out for you, at least somehow. Let's keep the issue open until we figure out what exactly is going on.

Regarding your question: The documentation of public-facing types and functions can be found on Hackage. All the internal stuff is mainly the parsing logic for the reverse engineered protocol.