Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

libhidapi

1 view
Skip to first unread message

Thomas Orgelmacher

unread,
Feb 27, 2022, 7:00:23 AM2/27/22
to
Hallo Zusammen!

Ich versuche gerade eine Relais-Karte mittels libhidapi
anzusteuern und bekomme das Beipielprogramm nicht übersetzt.
Genauer gesagt: ich kann es nicht linken.

Es geht um dieses hier:

https://github.com/signal11/hidapi

Wenn ich das mit "gcc -lhidapi-libusb -ohidapi-test hidapi-test.c"
unter Debian 11.1 übersetze, bekomme ich immer:

| /usr/bin/ld: /tmp/ccJfgyXE.o: in function `main':
| tt1.c:(.text+0x19): undefined reference to `hid_init'
| /usr/bin/ld: tt1.c:(.text+0x30): undefined reference to `hid_open'
| /usr/bin/ld: tt1.c:(.text+0x4f): undefined reference to
`hid_get_manufacturer_string'
| /usr/bin/ld: tt1.c:(.text+0x88): undefined reference to `hid_get_product_string'
| /usr/bin/ld: tt1.c:(.text+0xc1): undefined reference to
`hid_get_serial_number_string'
| /usr/bin/ld: tt1.c:(.text+0x101): undefined reference to `hid_get_indexed_string'
| collect2: error: ld returned 1 exit status

Mit libhidapi-hidraw sieht es genau so aus. Die Libraries sind
definitiv installiert und laut nm sind die ganzen Symbole auch
enthalten.
Auch die Abhängigkeiten seitens libhidapi sind erfüllt.

Was kann denn hier noch im Argen sein?


Gruß, Thomas

--
I have seen things you lusers would not believe. I've seen Sun
monitors on fire off the side of the multimedia lab. I've seen
NTU lights glitter in the dark near the Mail Gate. All these
things will be lost in time, like the root partition last week.

Ulli Horlacher

unread,
Feb 27, 2022, 7:17:19 AM2/27/22
to
Thomas Orgelmacher <tr...@odbs.org> wrote:
> Hallo Zusammen!
>
> Ich versuche gerade eine Relais-Karte mittels libhidapi
> anzusteuern und bekomme das Beipielprogramm nicht übersetzt.
> Genauer gesagt: ich kann es nicht linken.
>
> Es geht um dieses hier:
>
> https://github.com/signal11/hidapi
>
> Wenn ich das mit "gcc -lhidapi-libusb -ohidapi-test hidapi-test.c"
> unter Debian 11.1 übersetze, bekomme ich immer:
>
> | /usr/bin/ld: /tmp/ccJfgyXE.o: in function `main':
> | tt1.c:(.text+0x19): undefined reference to `hid_init'
> | /usr/bin/ld: tt1.c:(.text+0x30): undefined reference to `hid_open'
> | /usr/bin/ld: tt1.c:(.text+0x4f): undefined reference to
> `hid_get_manufacturer_string'
> | /usr/bin/ld: tt1.c:(.text+0x88): undefined reference to `hid_get_product_string'
> | /usr/bin/ld: tt1.c:(.text+0xc1): undefined reference to
> `hid_get_serial_number_string'
> | /usr/bin/ld: tt1.c:(.text+0x101): undefined reference to `hid_get_indexed_string'
> | collect2: error: ld returned 1 exit status
>
> Mit libhidapi-hidraw sieht es genau so aus. Die Libraries sind
> definitiv installiert und laut nm sind die ganzen Symbole auch
> enthalten.

libhidapi enthaelt die RUNTIME library. Dir fehlen die header files zum
Compilieren: libhidapi-dev


--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart E-Mail: horl...@tik.uni-stuttgart.de
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/

Thomas Orgelmacher

unread,
Feb 27, 2022, 8:21:27 AM2/27/22
to Ulli Horlacher
Am 27.02.22 um 13:17 schrieb Ulli Horlacher:
>
> libhidapi enthaelt die RUNTIME library. Dir fehlen die header files zum
> Compilieren: libhidapi-dev

Im Ernst jetzt?

Ich kann es ja kompilieren. Ich kann es nicht linken; ein fehlender Header führt
wohl kaum zu einem "undefined reference" von ld.
Eher zu einem "hidapi/hidapi.h: file not found".

Frank Beythien

unread,
Feb 27, 2022, 9:23:21 AM2/27/22
to
Am 27.02.22 um 14:20 schrieb Thomas Orgelmacher:
> Am 27.02.22 um 13:17 schrieb Ulli Horlacher:
>>
>> libhidapi enthaelt die RUNTIME library. Dir fehlen die header files zum
>> Compilieren: libhidapi-dev
>
> Im Ernst jetzt?
>
> Ich kann es ja kompilieren. Ich kann es nicht linken; ein fehlender
> Header führt wohl kaum zu einem "undefined reference" von ld.
> Eher zu einem "hidapi/hidapi.h: file not found".

Warum probierst du das nicht einfach?
Auszug aus 'apt show libhidapi-dev'

Description: Multi-Platform library for communication with HID devices
(development files)
HIDAPI is a multi-platform library enabling applications to easily
interface with Bluetooth and USB HID-class devices.
.
This package contains the files needed to compile and link programs
which use HIDAPI.

Frank

Stefan Reuther

unread,
Feb 28, 2022, 11:28:28 AM2/28/22
to
Am 27.02.2022 um 13:00 schrieb Thomas Orgelmacher:
> Wenn ich das mit "gcc -lhidapi-libusb -ohidapi-test hidapi-test.c"

Die "-l" Optionen gehören hinten hin. Die Kommandozeile wird von links
nach rechts abgearbeitet, Der C-Code muss erst ein paar undefinierte
Referenzen produzieren, die die Lib dann auflösen kann.


Stefan

Thomas Orgelmacher

unread,
Mar 1, 2022, 2:00:03 PM3/1/22
to Stefan Reuther
Ja, hab's inzwischen auch gefunden. Danke!
Ich bin das gedanklich anders angegangen: erstmal alles auflösen
was gebraucht wird.

Habe wohl lange nichts mehr ohne Makefile gebacken...
0 new messages