compiler errors - Unable to compile a4tech-bloody-linux-driver on Linux Mint 18, nor Ubuntu 16.04 -


since bought a4tech bloody v8 mouse, install driver linux, linux mint 18 (ubuntu 16.04 based).

i found driver on github:

https://github.com/maxmati/a4tech-bloody-linux-driver


since there no documentation how install it, far figured out how prepare compilation:

first installed cmake:

sudo apt-get install cmake 

then prepared make follows:

cmake . 

i attach output future reference, don't see error there:

-- c compiler identification gnu 5.4.0 -- cxx compiler identification gnu 5.4.0 -- check working c compiler: /usr/bin/cc -- check working c compiler: /usr/bin/cc -- works -- detecting c compiler abi info -- detecting c compiler abi info - done -- detecting c compile features -- detecting c compile features - done -- check working cxx compiler: /usr/bin/c++ -- check working cxx compiler: /usr/bin/c++ -- works -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done -- detecting cxx compile features -- detecting cxx compile features - done -- configuring done -- generating done -- build files have been written to: /home/vlastimil/downloads/a4tech-bloody-linux-driver-master 

i have tried of steps suggested on issue page: https://github.com/maxmati/a4tech-bloody-linux-driver/issues/10

but when running this:

rm cmakecache.txt && cmake . && make clean && make 

i these errors:

scanning dependencies of target bloody [ 33%] building cxx object cmakefiles/bloody.dir/main.cpp.o [ 66%] building cxx object cmakefiles/bloody.dir/mouse.cpp.o [100%] linking cxx executable bloody cmakefiles/bloody.dir/mouse.cpp.o: in function `mouse::init()': mouse.cpp:(.text+0x18): undefined reference `libusb_init' mouse.cpp:(.text+0x64): undefined reference `libusb_set_debug' cmakefiles/bloody.dir/mouse.cpp.o: in function `mouse::discoverdevices()': mouse.cpp:(.text+0xa5): undefined reference `libusb_get_device_list' mouse.cpp:(.text+0x10a): undefined reference `libusb_get_device_descriptor' mouse.cpp:(.text+0x14c): undefined reference `libusb_open' mouse.cpp:(.text+0x16e): undefined reference `libusb_kernel_driver_active' mouse.cpp:(.text+0x18d): undefined reference `libusb_detach_kernel_driver' mouse.cpp:(.text+0x1a6): undefined reference `libusb_close' mouse.cpp:(.text+0x1cc): undefined reference `libusb_get_device_address' mouse.cpp:(.text+0x215): undefined reference `libusb_free_device_list' cmakefiles/bloody.dir/mouse.cpp.o: in function `mouse::~mouse()': mouse.cpp:(.text+0x366): undefined reference `libusb_close' mouse.cpp:(.text+0x391): undefined reference `libusb_exit' cmakefiles/bloody.dir/mouse.cpp.o: in function `mouse::writetomouse(unsigned char*, unsigned long)': mouse.cpp:(.text+0x497): undefined reference `libusb_control_transfer' cmakefiles/bloody.dir/mouse.cpp.o: in function `mouse::readfrommouse(unsigned char*, unsigned long, unsigned char*, unsigned long)': mouse.cpp:(.text+0x548): undefined reference `libusb_control_transfer' cmakefiles/bloody.dir/mouse.cpp.o: in function `mouse::listdevices()': mouse.cpp:(.text+0x6af): undefined reference `libusb_get_device' mouse.cpp:(.text+0x6c6): undefined reference `libusb_get_device_descriptor' collect2: error: ld returned 1 exit status cmakefiles/bloody.dir/build.make:120: recipe target 'bloody' failed make[2]: *** [bloody] error 1 cmakefiles/makefile2:67: recipe target 'cmakefiles/bloody.dir/all' failed make[1]: *** [cmakefiles/bloody.dir/all] error 2 makefile:83: recipe target 'all' failed make: *** [all] error 2 

locate libusb.h 

tells me, exists in:

/usr/include/libusb-1.0/libusb.h 

but trying manually compile g++:

g++ main.cpp -lusb-1.0 

says, did not find it:

in file included main.cpp:2:0: mouse.h:8:20: fatal error: libusb.h: no such file or directory compilation terminated. 

confusing.


list of files generated looks well:

ll  total 124k -rw-r--r-- 1 vlastimil vlastimil 6.3k nov 17 15:25 build.make -rw-r--r-- 1 vlastimil vlastimil  276 nov 17 15:25 cmake_clean.cmake -rw-r--r-- 1 vlastimil vlastimil  551 nov 17 15:25 cxx.includecache -rw-r--r-- 1 vlastimil vlastimil  799 nov 17 15:25 dependinfo.cmake -rw-r--r-- 1 vlastimil vlastimil  445 nov 17 15:25 depend.internal -rw-r--r-- 1 vlastimil vlastimil  274 nov 17 15:25 depend.make -rw-r--r-- 1 vlastimil vlastimil  255 nov 17 15:25 flags.make -rw-r--r-- 1 vlastimil vlastimil  182 nov 17 15:25 link.txt -rw-r--r-- 1 vlastimil vlastimil 9.9k nov 17 15:25 main.cpp.o -rw-r--r-- 1 vlastimil vlastimil  69k nov 17 15:25 mouse.cpp.o -rw-r--r-- 1 vlastimil vlastimil   64 nov 17 15:25 progress.make 

i unable link them binary file, tried directly:

/usr/bin/g++ -std=c++11 -i/usr/include/libusb-1.0 -l/usr/lib/x86_64-linux-gnu -lusb-1.0 main.cpp.o mouse.cpp.o -o bloody  mouse.cpp.o: in function `mouse::init()': mouse.cpp:(.text+0x18): undefined reference `libusb_init' mouse.cpp:(.text+0x64): undefined reference `libusb_set_debug' mouse.cpp.o: in function `mouse::discoverdevices()': mouse.cpp:(.text+0xa5): undefined reference `libusb_get_device_list' mouse.cpp:(.text+0x10a): undefined reference `libusb_get_device_descriptor' mouse.cpp:(.text+0x14c): undefined reference `libusb_open' mouse.cpp:(.text+0x16e): undefined reference `libusb_kernel_driver_active' mouse.cpp:(.text+0x18d): undefined reference `libusb_detach_kernel_driver' mouse.cpp:(.text+0x1a6): undefined reference `libusb_close' mouse.cpp:(.text+0x1cc): undefined reference `libusb_get_device_address' mouse.cpp:(.text+0x215): undefined reference `libusb_free_device_list' mouse.cpp.o: in function `mouse::~mouse()': mouse.cpp:(.text+0x366): undefined reference `libusb_close' mouse.cpp:(.text+0x391): undefined reference `libusb_exit' mouse.cpp.o: in function `mouse::writetomouse(unsigned char*, unsigned long)': mouse.cpp:(.text+0x497): undefined reference `libusb_control_transfer' mouse.cpp.o: in function `mouse::readfrommouse(unsigned char*, unsigned long, unsigned char*, unsigned long)': mouse.cpp:(.text+0x548): undefined reference `libusb_control_transfer' mouse.cpp.o: in function `mouse::listdevices()': mouse.cpp:(.text+0x6af): undefined reference `libusb_get_device' mouse.cpp:(.text+0x6c6): undefined reference `libusb_get_device_descriptor' collect2: error: ld returned 1 exit status 

i wondering if linker's error (?)


the last idea had link 2 object files together:

g++ -o output main.cpp.o mouse.cpp.o 

but ended same above direct attempt.


compiler version is:

g++-5.real (ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 

i don't know how proceed further. thank hints.

ok, had lot of trouble this, figured out.

there may better solutions, , if so, please add yours.

copy file, whatever reason not found linker compiling folder:

cp /usr/include/libusb-1.0/libusb.h ./ 

and manualy invoke compiling:

g++ -std=c++11 main.cpp mouse.cpp -i. -l. -l/usr/lib/x86_64-linux-gnu/  -lusb-1.0 -o "mouse-set-backlight" 

this create mouse-set-backlight file, @ moment not recognize mouse. try resolve tomorrow.


fix bloody v8 core 2:

edit file:

mouse.h 

change line:

static const int bloody_v8_pid = 0x11f5; 

to:

static const int bloody_v8_pid = 0x36e1; 

and compile again.


how fix unknown versions of bloody mouse, generally:

dmesg | grep mouse 

the output should mine:

[462227.138026] hid-generic 0003:09da:36e1.0005: input,hidraw1: usb hid v1.11 mouse [company usb device] on usb-0000:00:14.0-2/input1 

look part:

hid-generic 0003:09da:36e1.0005 

where third part of address, in case 36e1 is, need.

add 0x prefix it, i.e. 0x36e1

finally, edit mouse.h how did above.

and compile again.


Comments

Popular posts from this blog

c# - AutoMapper - What's difference between Condition and PreCondition -

python - ImportError: Missing required dependencies ['numpy'] -