Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile #5

Closed
roglio opened this issue Sep 18, 2022 · 4 comments
Closed

Unable to compile #5

roglio opened this issue Sep 18, 2022 · 4 comments

Comments

@roglio
Copy link

roglio commented Sep 18, 2022

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 .

@Ivan0x17
Copy link

Ivan0x17 commented Mar 23, 2023

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:

libsdl-org/SDL#4923 , for me working

@TuureKaunisto
Copy link

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.

@deltaryz
Copy link

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.

@user-none
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants