Which hidapi for libdc?

41 views
Skip to first unread message

Andy Johnson

unread,
Feb 14, 2020, 3:46:14 PM2/14/20
to Subsurface Divelog
I have built hidapi 0.9.0 from libusb but it creates two libraries, libhidapi-hidraw and libhidapi-libusb. When I configure libdc I have to edit configure.ac to use one or the other. It compiles OK it seems, but when I make subsurface I get unresolved references for the one I didn't select. Is there a different hidapi I should be using or do I even need it at all if I have libusb?

Andy

Dirk Hohndel

unread,
Feb 14, 2020, 3:47:57 PM2/14/20
to Subsurface Divelog
If you just run the build script it should do the right thing. 
Which platform are you building for?

/D

Andy Johnson

unread,
Feb 14, 2020, 4:48:39 PM2/14/20
to Subsurface Divelog
TinyCore. I'm building the package for the distro. I get this when using the build script:

[ 66%] Building CXX object CMakeFiles/subsurface.dir/qrc_map-widget.cpp.o
make[2]: *** No rule to make target '/mnt/sda1/lamp64/test/Subsurface-4.9.3/install-root/lib/libdivecomputer.a', needed by 'subsurface'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:472: CMakeFiles/subsurface.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
+ '[' '' = 1 ']'
+ (( i++  ))
+ (( i < 1  ))

Which is why I'm trying to build it directly using cmake/make. I have a libdivecomputer.a in /usr/local/lib that it finds but then it complains about these:

/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_write':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:754: undefined reference to `hid_write'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_read':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:704: undefined reference to `hid_read_timeout'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_session_unref':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:303: undefined reference to `hid_exit'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_iterator_free':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:550: undefined reference to `hid_free_enumeration'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_close':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:657: undefined reference to `hid_close'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_iterator_new':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:389: undefined reference to `hid_enumerate'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_session_new':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:245: undefined reference to `hid_init'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_iterator_new':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:389: undefined reference to `hid_enumerate'
/usr/local/bin/ld: /usr/local/lib/libdivecomputer.a(usbhid.o): in function `dc_usbhid_open':
/mnt/sda1/lamp64/test/libdc-4.9.3/src/usbhid.c:618: undefined reference to `hid_open_path'

I'm using the Subsurface source tarball. Commands in the script like git fail because it's not a git repository. If I put the libdc source tarball in the subsurface source tree where it belongs then when build.sh runs the libdivecomputer configure it doesn't see hidapi

checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBUSB... yes
checking for HIDAPI... no
checking for BLUEZ... yes

So we're back where we started. Does libdivecomputer need hidapi, or will some computers not work without it?

Andy

Dirk Hohndel

unread,
Feb 14, 2020, 4:58:08 PM2/14/20
to Subsurface Divelog


> On Feb 14, 2020, at 1:48 PM, Andy Johnson <an...@asjohnson.com> wrote:
>
> TinyCore. I'm building the package for the distro.

I continue to be amazed how many distros there are... :-)

> I get this when using the build script:
>
> [ 66%] Building CXX object CMakeFiles/subsurface.dir/qrc_map-widget.cpp.o
> make[2]: *** No rule to make target '/mnt/sda1/lamp64/test/Subsurface-4.9.3/install-root/lib/libdivecomputer.a', needed by 'subsurface'. Stop.
> make[1]: *** [CMakeFiles/Makefile2:472: CMakeFiles/subsurface.dir/all] Error 2
> make: *** [Makefile:141: all] Error 2

There has got to be an error before that in the output because the build script builds libdivecomputer before ever calling cmake on Subsurface.
I would really prefer to fix the build script than to debug issues like this in 'I am manually building things' mode.

Also, please note that Subsurface as a project generally discourages distros from including a Subsurface package (unless they are "rolling release" or "build from source" distros like Arch or Gentoo, respectively.
Debian, Ubuntu, Fedora, OpenSUSE and many others have respected this request.

>
> Which is why I'm trying to build it directly using cmake/make. I have a libdivecomputer.a in /usr/local/lib that it finds but then it complains about these:

Oh, if you build libdivecomputer from their upstream then you are out of luck, anyway, as Subsurface requires our own flavor of libdivecomputer.

> I'm using the Subsurface source tarball. Commands in the script like git fail because it's not a git repository. If I put the libdc source tarball in the subsurface source tree where it belongs then when build.sh runs the libdivecomputer configure it doesn't see hidapi

So where did this libdc tar ball come from?
Fundamentally this is a way of building Subsurface that we don't support.

> So we're back where we started. Does libdivecomputer need hidapi, or will some computers not work without it?

Under Linux you can build without hidapi and it should still work for all HID divecomputers that I'm aware of.

/D

Andy Johnson

unread,
Feb 14, 2020, 6:22:02 PM2/14/20
to Subsurface Divelog


On Friday, February 14, 2020 at 3:58:08 PM UTC-6, Dirk wrote:


Also, please note that Subsurface as a project generally discourages distros from including a Subsurface package (unless they are "rolling release" or "build from source" distros like Arch or Gentoo, respectively.
Debian, Ubuntu, Fedora, OpenSUSE and many others have respected this request.

The appimage is a non-starter, unless you know how to fix this:

$ ./Subsurface-4.9.3-x86_64.AppImage
sh: ./Subsurface-4.9.3-x86_64.AppImage: not found
 $ ldd Subsurface-4.9.3-x86_64.AppImage
./Subsurface-4.9.3-x86_64.AppImage: error while loading shared libraries: ./Subsurface-4.9.3-x86_64.AppImage: ELF file ABI version invalid

It does work on Slackware, so I know it can work, but not on TinyCore. It's kernel version 5.4.3 and ld-2.30, so it's newer than my Slackware box.

Which is why I'm building it from source. This isn't the first time. I built and used 4.7.x a while back, so I'm pretty sure I can do it again.

So where did this libdc tar ball come from?

From the Subsurface git website 'https://github.com/Subsurface-divelog/libdc/tree/Subsurface-NG/src'. Is this not the right one?

Under Linux you can build without hidapi and it should still work for all HID divecomputers that I'm aware of.

OK. I saw some old threads implying otherwise, but they were a few years old so I'll assume those issues were resolved. 

Andy
Reply all
Reply to author
Forward
0 new messages