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

undefined reference Device.cc #1

Open
fourpoint opened this issue Feb 5, 2019 · 5 comments
Open

undefined reference Device.cc #1

fourpoint opened this issue Feb 5, 2019 · 5 comments

Comments

@fourpoint
Copy link

Hi, I can't compile your code. Can you please help?

/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::~Device()': Device.cc:(.text+0x10): undefined reference to libusb_release_interface'
Device.cc:(.text+0x1f): undefined reference to libusb_close' Device.cc:(.text+0x2b): undefined reference to libusb_exit'
Device.cc:(.text+0x4f): undefined reference to libusb_attach_kernel_driver' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::m_read()':
Device.cc:(.text+0xc4): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::m_write(b6::Packet)':
Device.cc:(.text+0x18b): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::m_sendCommand(b6::CMD)':
Device.cc:(.text+0x23f): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::stopCharging()':
Device.cc:(.text+0x1075): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::Device()':
Device.cc:(.text+0x127b): undefined reference to libusb_init' Device.cc:(.text+0x1295): undefined reference to libusb_open_device_with_vid_pid'
Device.cc:(.text+0x12a8): undefined reference to libusb_kernel_driver_active' Device.cc:(.text+0x12b8): undefined reference to libusb_claim_interface'
Device.cc:(.text+0x12ff): undefined reference to libusb_detach_kernel_driver' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::setBuzzers(bool, bool)':
Device.cc:(.text+0x1635): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::setCycleTime(int)':
Device.cc:(.text+0x17db): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::setTempLimit(int)':
Device.cc:(.text+0x195b): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::setCapacityLimit(bool, int)':
Device.cc:(.text+0x1b45): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::setTimeLimit(bool, int)':
Device.cc:(.text+0x1d75): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o):Device.cc:(.text+0x2292): more undefined references to libusb_interrupt_transfer' follow
collect2: error: ld returned 1 exit status
CMakeFiles/ChargeGuru.dir/build.make:151: recipe for target 'ChargeGuru' failed
make[2]: *** [ChargeGuru] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ChargeGuru.dir/all' failed
make[1]: *** [CMakeFiles/ChargeGuru.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@maciek134
Copy link
Owner

@fourpoint you seem to be missing libusb. You need these libraries: qt5 qtcharts libusb-1.0 libb6 along with their development headers if your package manager doesn't install them (on Arch you are set, on Ubuntu for example you need to run sudo apt install libusb-1.0-0-dev).

It may also be a difference in apt, as I now see that in there it's libusb-1.0-0 instead of libusb-1.0.

@Pokornz
Copy link

Pokornz commented Jul 3, 2021

Hi @maciek134 ,
I'm encountering the same issue as @fourpoint . I made sure to install all the dependencies, and while libb6 installation went smoothly, the charge-guru failed at compilation. Here's my output:

make
[ 20%] Automatic MOC and UIC for target ChargeGuru
[ 20%] Built target ChargeGuru_autogen
[ 40%] Linking CXX executable ChargeGuru
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::~Device()':
Device.cc:(.text+0x10): undefined reference to `libusb_release_interface'
Device.cc:(.text+0x1f): undefined reference to `libusb_close'
Device.cc:(.text+0x2b): undefined reference to `libusb_exit'
Device.cc:(.text+0x4f): undefined reference to `libusb_attach_kernel_driver'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::m_read()':
Device.cc:(.text+0xc4): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::m_write(b6::Packet)':
Device.cc:(.text+0x18b): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::m_sendCommand(b6::CMD)':
Device.cc:(.text+0x23f): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::stopCharging()':
Device.cc:(.text+0x10a5): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::Device()':
Device.cc:(.text+0x12ab): undefined reference to `libusb_init'
Device.cc:(.text+0x12c5): undefined reference to `libusb_open_device_with_vid_pid'
Device.cc:(.text+0x12d8): undefined reference to `libusb_kernel_driver_active'
Device.cc:(.text+0x12e8): undefined reference to `libusb_claim_interface'
Device.cc:(.text+0x132f): undefined reference to `libusb_detach_kernel_driver'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::setBuzzers(bool, bool)':
Device.cc:(.text+0x1665): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::setCycleTime(int)':
Device.cc:(.text+0x180b): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::setTempLimit(int)':
Device.cc:(.text+0x198b): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::setTimeLimit(bool, int)':
Device.cc:(.text+0x1b75): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function `b6::Device::setCapacityLimit(bool, int)':
Device.cc:(.text+0x1da5): undefined reference to `libusb_interrupt_transfer'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o):Device.cc:(.text+0x22c2): more undefined references to `libusb_interrupt_transfer' follow
collect2: error: ld returned 1 exit status
CMakeFiles/ChargeGuru.dir/build.make:151: recipe for target 'ChargeGuru' failed
make[2]: *** [ChargeGuru] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ChargeGuru.dir/all' failed
make[1]: *** [CMakeFiles/ChargeGuru.dir/all] Error 2
Makefile:83: recipe for target 'all' failed

As you can see, libusb-1.0-0 is installed:

sudo apt-get install libusb-1.0
[sudo] password for pokornz: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libusb-1.0-0' for regex 'libusb-1.0'
Note, selecting 'libusb-1.0-0-dev' for regex 'libusb-1.0'
Note, selecting 'libusb-1.0-doc' for regex 'libusb-1.0'
libusb-1.0-0 is already the newest version (2:1.0.21-2).
libusb-1.0-0-dev is already the newest version (2:1.0.21-2).
libusb-1.0-doc is already the newest version (2:1.0.21-2).
The following packages were automatically installed and are no longer required:
  libc-ares2 libhttp-parser2.7.1 linux-hwe-5.4-headers-5.4.0-54 linux-hwe-5.4-headers-5.4.0-65
  linux-hwe-5.4-headers-5.4.0-66 linux-hwe-5.4-headers-5.4.0-67 nodejs-doc
  qml-module-qtquick-dialogs qml-module-qtquick-privatewidgets
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

@maciek134
Copy link
Owner

maciek134 commented Jul 6, 2021

@Pokornz I'll spin up a Ubuntu VM and take a look. Which version do you use?

@Pokornz
Copy link

Pokornz commented Jul 6, 2021

@Pokornz I'll spin up a Ubuntu VM and take a look. Which version do you use?

Ubuntu version? 18.04.5 LTS

@vanastasis
Copy link

Was this ever resolved ? would like to use it

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

4 participants