sixaxispairer icon indicating copy to clipboard operation
sixaxispairer copied to clipboard

Unable to compile

Open roglio opened this issue 3 years ago • 3 comments

Hi, already tried a lot of tricks to overcome my issue but nothing: the cmake . continue to tell me "WARNING: Target "sixaxispairing" requests linking to directory "/usr/local/lib". Targets may link only to libraries. CMake is dropping the item." It does complete the configuration but executing make the linker fails its job: "/usr/bin/ld: CMakeFiles/sixaxispairing.dir/main.c.o: in function `main'"

My environment is latest linux mint (ubuntu derivative). The library hidapi from https://github.com/signal11/hidapi was compiled and installed successfully.

What I'm doing wrong?

PS: please do a release for each platform because on internet I found some installer for windows that are infected by trojans PPS: correct cmake .. to cmake .

roglio avatar Sep 18 '22 10:09 roglio

Hi, already tried a lot of tricks to overcome my issue but nothing: the cmake . continue to tell me "WARNING: Target "sixaxispairing" requests linking to directory "/usr/local/lib". Targets may link only to libraries. CMake is dropping the item."

It does complete the configuration but executing make the linker fails its job: "/usr/bin/ld: CMakeFiles/sixaxispairing.dir/main.c.o: in function `main'"

My environment is latest linux mint (ubuntu derivative). The library hidapi from https://github.com/signal11/hidapi was compiled and installed successfully.

What I'm doing wrong?

PS: please do a release for each platform because on internet I found some installer for windows that are infected by trojans

PPS: correct cmake .. to cmake .

for compile main.c , you i need a hidapi.h library steps:

  1. brew install hidapi (brew is a package manager for macos)
  2. modify the header of library in main.c

example: #include </opt/homebrew/Cellar/hidapi/0.13.1/include/hidapi/hidapi.h> "the directory can changed"

for me this software not working

in alternative can use this:

https://github.com/libsdl-org/SDL/issues/4923 , for me working

Ivan0x17 avatar Mar 23 '23 10:03 Ivan0x17

Editing the full path of hidapi.h to main.c worked for me as well. I ran brew ls hidapi to find out the install location and used ./bin/sixaxispairing to run it instead of the ./bin/sixaxispairer mentioned in the readme.

TuureKaunisto avatar Jun 07 '23 20:06 TuureKaunisto

I'm on Manjaro, and hidapi installed with sudo pacman -S hidapi did not work. Something about this install was completely invisible to cmake, possibly missing some header files?

CMake Error at CMakeModules/FindHIDAPI.cmake:33 (message):
  Could NOT find HIDAPI
Call Stack (most recent call first):
  CMakeLists.txt:10 (find_package)

I figured out, I could use nix's version of hidapi which does include all necessary files.

nix install -iA nixpkgs.hidapi

installing 'hidapi-0.14.0'
these 2 paths will be fetched (0.07 MiB download, 0.25 MiB unpacked):
  /nix/store/8lci9gx0hsnqj9d9acck88ykz82rd8g6-hidapi-0.14.0
  /nix/store/l5rikw17zv01gx6gc90dvxpja5ciy1r0-libusb-1.0.26

make note of that install path, now, edit CMakeLists.txt and replace line 10 with the following: (substitute this path for whatever your hidapi install directory is)

# Specify the location of HIDAPI's header files
include_directories(/nix/store/8lci9gx0hsnqj9d9acck88ykz82rd8g6-hidapi-0.14.0/include)

# Specify the location of HIDAPI's library
link_directories(/nix/store/8lci9gx0hsnqj9d9acck88ykz82rd8g6-hidapi-0.14.0/lib)

# Add HIDAPI as a library
add_library(hidapi STATIC IMPORTED)
set_target_properties(hidapi PROPERTIES IMPORTED_LOCATION /nix/store/8lci9gx0hsnqj9d9acck88ykz82rd8g6-hidapi-0.14.0/lib/libhidapi-libusb.so)

Also, replace ${HIDAPI_LIBRARIES} with hidapi in the last line:

target_link_libraries (${PROJECT_NAME} hidapi ${PLATFORM_LIBS})

It should now compile successfully.

deltaryz avatar Mar 19 '24 18:03 deltaryz

I updated the cmake to be more modern and do a better job finding hidapi. You can use -DCMAKE_PREFIX_PATH to specify a specific location if hidapi is installed in a non-standard place.

user-none avatar Sep 06 '24 15:09 user-none