c0xc / CapacityTester

Use CapacityTester to check if your USB thumb/flash drive lies about its capacity. Graphical tool to detect fake USB drives.
GNU General Public License v3.0
116 stars 16 forks source link

v0.7 build error on ArchLinux #29

Open cyqsimon opened 1 month ago

cyqsimon commented 1 month ago

Hello,

While attempting to bump my AUR package to 0.7, I ran into the following issue when running qmake:

Project ERROR: libusb development package not found

I found this odd since lots of software depend on this package package and I know I've got it installed; and indeed I do: libusb 1.0.27-1. So I wondered if this could be a version mismatch.

pacman -Ss libusb revealed that there is also the package libusb-compat 0.1.8-1, so I tried installing it. Now qmake succeeds, but I got the following errors during make:

src/usbstoragedevice.cpp:849:11: error: invalid preprocessing directive #Since
  849 |         # Since version 1.0.27
      |           ^~~~~

and

src/usbstoragedevice.cpp: In member function ‘libusb_device* UsbStorageDevice::getUsb1Device()’:
src/usbstoragedevice.cpp:850:32: error: too few arguments to function ‘int libusb_init_context(libusb_context**, const libusb_init_option*, int)’
  850 |         r = libusb_init_context(&ctx); //libusb_init is deprecated
      |             ~~~~~~~~~~~~~~~~~~~^~~~~~

Sorry not a CPP dev; not much else I can help with.

Environment

ArchLinux x64, all updates applied as of 2024-08-12.

c0xc commented 3 weeks ago

Hey there, thanks for taking the time to maintain an Arch package.

There's libusb1 (i.e., today's libusb), libusb0 (the outdated one, sometimes called libusb) and libusb-compat which wraps around the latter to look like the former. I wouldn't recommend installing libusb-compat in addition to libusb1. Instead, just a hunch, you could try commenting out line 32 in the pro file before running qmake. Also, try this command on your build system, does it show an error?

pkg-config --libs libusb-1.0

The other error is indeed a typo I'm going to fix. And when I find the time, I'll set up an Arch system to reproduce your build error, but I think I know what's going on.

cyqsimon commented 3 weeks ago

Instead, just a hunch, you could try commenting out line 32 in the pro file before running qmake. Also, try this command on your build system, does it show an error?

Yep qmake succeeds without PKGCONFIG += libusb. pkg-config --libs libusb-1.0 outputs -lusb-1.0 with no errors, which I believe is expected.

So is this something that I would have to do during packaging with a .patch file, or is this something you can fix upstream?

The other error is indeed a typo I'm going to fix. And when I find the time, I'll set up an Arch system to reproduce your build error, but I think I know what's going on.

Awesome; looking forward to it. I'm happy to offer any help if you want it.

c0xc commented 3 weeks ago

Thanks for checking. No, I'm going to fix that (as soon as I can).

I'll have to remove the v0 dependency, that's a dead horse anyway (and it is sort of a version thing as "libusb" refers to v0 on one of my systems, my bad).

Btw. there's another minor thing I wanted to fix (the make writable for all users option), maybe I should add some counter version number to reflect that something has changed.

Again, thanks for the detailed bug report, very helpful.

c0xc commented 6 days ago

I've updated the master branch, it should now build on Arch Linux.

cyqsimon commented 5 days ago

Yep, can confirm master branch is building now. Can you make a new tagged release for this? Thanks.