UrbanskiDawid / usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable

Basic functionality of usb2lin06 device implemented for use in linux
40 stars 11 forks source link

libusb errors #6

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi, First of all thanks for the library, would be really helpful. However, I can't compile the examples since I have some libusb dependencies problems. Do you any possible idea ?

make build make -C Controler make[1]: Entering directory '/home/parallels/Desktop/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable-master/EXAMPLES/Controler' g++ -std=c++1y -lstdc++ -lusb-1.0 -I../../ -o statusReport.o -c statusReport.cpp g++ -std=c++1y -lstdc++ -lusb-1.0 -I../../ -o usb2linException.o -c usb2linException.cpp g++ -std=c++1y -lstdc++ -lusb-1.0 -I../../ -o usb2lin06Controler.o -c usb2lin06Controler.cpp make[1]: Leaving directory '/home/parallels/Desktop/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable-master/EXAMPLES/Controler' g++ -std=c++1y -lstdc++ -lusb-1.0 -o example-getStatus getStatus.cpp -I ./Controler/ -I ../ ./Controler/.o /tmp/ccgmT93S.o: In function `printDescriptor(libusb_device_handle)': getStatus.cpp:(.text+0xcd): undefined reference to libusb_get_device' getStatus.cpp:(.text+0xed): undefined reference tolibusb_get_device_descriptor' /tmp/ccgmT93S.o: In function main': getStatus.cpp:(.text+0x1164): undefined reference tolibusb_get_string_descriptor_ascii' ./Controler/usb2lin06Controler.o: In function usb2lin06::controler::usb2lin06Controler::usb2lin06Controler(bool)': usb2lin06Controler.cpp:(.text+0x42): undefined reference tolibusb_init' usb2lin06Controler.cpp:(.text+0xcb): undefined reference to libusb_set_debug' usb2lin06Controler.cpp:(.text+0x174): undefined reference tolibusb_close' usb2lin06Controler.cpp:(.text+0x18f): undefined reference to libusb_exit' ./Controler/usb2lin06Controler.o: In functionusb2lin06::controler::usb2lin06Controler::~usb2lin06Controler()': usb2lin06Controler.cpp:(.text+0x22f): undefined reference to libusb_close' usb2lin06Controler.cpp:(.text+0x24a): undefined reference tolibusb_exit' ./Controler/usb2lin06Controler.o: In function usb2lin06::controler::findFirstDevice(libusb_context*, libusb_device**)': usb2lin06Controler.cpp:(.text+0xa53): undefined reference tolibusb_get_device_list' usb2lin06Controler.cpp:(.text+0xab2): undefined reference to libusb_get_device_descriptor' ./Controler/usb2lin06Controler.o: In functionusb2lin06::controler::usb2lin06Controler::openDevice()': usb2lin06Controler.cpp:(.text+0xbd0): undefined reference to libusb_open' usb2lin06Controler.cpp:(.text+0xc60): undefined reference tolibusb_kernel_driver_active' usb2lin06Controler.cpp:(.text+0xc82): undefined reference to libusb_detach_kernel_driver' usb2lin06Controler.cpp:(.text+0xd0c): undefined reference tolibusb_claim_interface' ./Controler/usb2lin06Controler.o: In function usb2lin06::controler::usb2lin06Controler::sendUSBcontrolTransfer(usb2lin06::sCtrlURB const&, unsigned char*)': usb2lin06Controler.cpp:(.text+0x101d): undefined reference tolibusb_control_transfer' collect2: error: ld returned 1 exit status Makefile:24: recipe for target 'build' failed make: *** [build] Error 1

UrbanskiDawid commented 7 years ago

hi please verify that you have libusb-1.0

on Debian you can install this via: $ sudo apt-get install libusb-1.0-0-dev

ghost commented 7 years ago

Yup I have: Reading package lists... Done Building dependency tree
Reading state information... Done libusb-1.0-0-dev is already the newest version (2:1.0.20-1). 0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded

UrbanskiDawid commented 7 years ago

OK please let me know what os + version are you using.

I will attempt to reproduce this issue and fix it (max 1day)

ghost commented 7 years ago

ok, my os is ubuntu 16.04

UrbanskiDawid commented 7 years ago

hi fix has been uploaded, @caffaware please let me know if it works for you.

ghost commented 7 years ago

Compiling now works, so thanks. But I can't get it to run now, maybe something stupid ?

parallels@ubuntu:~/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable/EXAMPLES$ sudo make debug make -C Controler debug make[1]: Entering directory '/home/parallels/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable/EXAMPLES/Controler' g++ -std=c++1y -DDEBUG -g -I../../ -I/usr/include/libusb-1.0 -o statusReport.o -c statusReport.cpp g++ -std=c++1y -DDEBUG -g -I../../ -I/usr/include/libusb-1.0 -o usb2linException.o -c usb2linException.cpp g++ -std=c++1y -DDEBUG -g -I../../ -I/usr/include/libusb-1.0 -o usb2lin06Controler.o -c usb2lin06Controler.cpp In file included from usb2lin06Controler.cpp:9:0: usb2lin06Controler.cpp: In member function ‘bool usb2lin06::controler::usb2lin06Controler::move(int16_t)’: usb2lin06Controler.h:24:89: warning: too many arguments for format [-Wformat-extra-args]

define DEBUGOUT(...) fprintf(stderr,"DEBUG %s:%d %s\n",FILE, LINE,__VA_ARGS__);

                                                                                     ^

usb2lin06Controler.cpp:246:3: note: in expansion of macro ‘DEBUGOUT’ DEBUGOUT("move()",targetHeight); ^ usb2lin06Controler.cpp: In member function ‘int usb2lin06::controler::usb2lin06Controler::sendUSBcontrolTransfer(const usb2lin06::sCtrlURB&, unsigned char*)’: usb2lin06Controler.h:24:89: warning: too many arguments for format [-Wformat-extra-args]

define DEBUGOUT(...) fprintf(stderr,"DEBUG %s:%d %s\n",FILE, LINE,__VA_ARGS__);

                                                                                     ^

usb2lin06Controler.cpp:306:3: note: in expansion of macro ‘DEBUGOUT’ DEBUGOUT("sendUSBcontrolTransfer()",data); ^ make[1]: Leaving directory '/home/parallels/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable/EXAMPLES/Controler' g++ -std=c++1y -DDEBUG -g -lstdc++ -lusb-1.0 -I ./Controler/ -I ../ -I/usr/include/libusb-1.0 -o example-getStatus -c getStatus.cpp g++ -std=c++1y -DDEBUG -g -lstdc++ -lusb-1.0 -I ./Controler/ -I ../ -I/usr/include/libusb-1.0 -o example-moveTo -c moveTo.cpp In file included from moveTo.cpp:8:0: moveTo.cpp: In function ‘bool moveTo(usb2lin06::controler::usb2lin06Controler&, uint16_t)’: ./Controler/usb2lin06Controler.h:24:89: warning: too many arguments for format [-Wformat-extra-args]

define DEBUGOUT(...) fprintf(stderr,"DEBUG %s:%d %s\n",FILE, LINE,__VA_ARGS__);

                                                                                     ^

moveTo.cpp:29:5: note: in expansion of macro ‘DEBUGOUT’ DEBUGOUT("moveTo()",target) ^ moveTo.cpp: In function ‘int main(int, char**)’: ./Controler/usb2lin06Controler.h:24:89: warning: too many arguments for format [-Wformat-extra-args]

define DEBUGOUT(...) fprintf(stderr,"DEBUG %s:%d %s\n",FILE, LINE,__VA_ARGS__);

                                                                                     ^

moveTo.cpp:87:3: note: in expansion of macro ‘DEBUGOUT’ DEBUGOUT("main() - move to targetHeight",targetHeight); ^ g++ -std=c++1y -DDEBUG -g -lstdc++ -lusb-1.0 -I ./Controler/ -I ../ -I/usr/include/libusb-1.0 -o example-getHeight -c getHeight.cpp

parallels@ubuntu:~/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable/EXAMPLES$ sudo chmod +x example-getStatus parallels@ubuntu:~/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable/EXAMPLES$ sudo ./example-getStatus ./example-getStatus: 2: ./example-getStatus: Syntax error: "(" unexpected parallels@ubuntu:~/usb2lin06-HID-in-linux-for-LINAK-Desk-Control-Cable/EXAMPLES$

UrbanskiDawid commented 7 years ago

fixed, please pull and try again. @caffaware please let me know if this fix works for you.

ghost commented 7 years ago

thanks, it works ! Awesome. Did you see my e-mail about a professional question (prowise) ?