make Error #5

Open
exonac opened this Issue Feb 8, 2012 · 6 comments

Projects

None yet

2 participants

@exonac
exonac commented Feb 8, 2012

Hello,
I'm using Linux Mint 12

When I use "make" I get the following error:

gcc -Wall -c main.c
In file included from main.c:30:0:
wheelfunctions.h:24:31: fatal error: libusb-1.0/libusb.h: No such file or directory
compilation terminated.
make: *** [main.o] Error 1

So I thought I needed to install the libusb-1.0.0 dev (since libsusb-1.0.0 is already installed), but then I get the following error:

gcc -Wall -c main.c
main.c: In function ‘main’:
main.c:216:31: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
gcc -Wall -c wheelfunctions.c
gcc -Wall -c wheels.c
gcc -Wall -lusb-1.0 -g3 -o ltwheelconf main.o wheelfunctions.o wheels.o
main.o: In function main': main.c:(.text+0x2c2): undefined reference tolibusb_init'
main.c:(.text+0x2dc): undefined reference to libusb_set_debug' main.c:(.text+0x5d0): undefined reference tolibusb_exit'
wheelfunctions.o: In function list_devices': wheelfunctions.c:(.text+0x1f3): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.c:(.text+0x217): undefined reference to libusb_get_device' wheelfunctions.c:(.text+0x245): undefined reference tolibusb_get_device_descriptor'
wheelfunctions.c:(.text+0x284): undefined reference to libusb_get_string_descriptor_ascii' wheelfunctions.c:(.text+0x293): undefined reference tolibusb_get_device_address'
wheelfunctions.c:(.text+0x2a5): undefined reference to libusb_get_bus_number' wheelfunctions.c:(.text+0x310): undefined reference tolibusb_close'
wheelfunctions.o: In function send_command': wheelfunctions.c:(.text+0x3bb): undefined reference tolibusb_detach_kernel_driver'
wheelfunctions.c:(.text+0x3f2): undefined reference to libusb_claim_interface' wheelfunctions.c:(.text+0x4b5): undefined reference tolibusb_interrupt_transfer'
wheelfunctions.c:(.text+0x504): undefined reference to libusb_release_interface' wheelfunctions.c:(.text+0x544): undefined reference tolibusb_attach_kernel_driver'
wheelfunctions.o: In function set_native_mode': wheelfunctions.c:(.text+0x5f7): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.c:(.text+0x64a): undefined reference to libusb_open_device_with_vid_pid' wheelfunctions.c:(.text+0x75f): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.o: In function set_range': wheelfunctions.c:(.text+0x894): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.o: In function set_autocenter': wheelfunctions.c:(.text+0x9d8): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.o:wheelfunctions.c:(.text+0xd40): more undefined references to libusb_open_device_with_vid_pid' follow wheelfunctions.o: In functionreset_wheel':
wheelfunctions.c:(.text+0xd7e): undefined reference to `libusb_reset_device'
collect2: ld returned 1 exit status
make: *** [ltwheelconf] Error 1

Can you give me any advice?

Thanks

@thk
thk commented Feb 14, 2012

I got the same problem. Here's my suggestion: I guess Mint is using the ubuntu repos and there's a fsckup with libusb-1.0. My workaround (using Ubuntu 10,10; 64bit) was to build libusb on my own. To use the locally installed version, there's a change required in the makefile to use pkg-config. You can find it on my forked version of this tool (the commits are waiting to be pulled into this branch).

@exonac
exonac commented Mar 2, 2012

I applied your changes to the makefile and added the .gitignore file, but now I get the following error:

patric@patric-mint ~/Downloads/TripleSpeeder-LTWheelConf-665e227 $ make
gcc -Wall -g3 -o ltwheelconf main.o wheelfunctions.o wheels.o
main.o: In function main': main.c:(.text+0x2c2): undefined reference tolibusb_init'
main.c:(.text+0x2dc): undefined reference to libusb_set_debug' main.c:(.text+0x5d0): undefined reference tolibusb_exit'
wheelfunctions.o: In function list_devices': wheelfunctions.c:(.text+0x1f3): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.c:(.text+0x217): undefined reference to libusb_get_device' wheelfunctions.c:(.text+0x245): undefined reference tolibusb_get_device_descriptor'
wheelfunctions.c:(.text+0x284): undefined reference to libusb_get_string_descriptor_ascii' wheelfunctions.c:(.text+0x293): undefined reference tolibusb_get_device_address'
wheelfunctions.c:(.text+0x2a5): undefined reference to libusb_get_bus_number' wheelfunctions.c:(.text+0x310): undefined reference tolibusb_close'
wheelfunctions.o: In function send_command': wheelfunctions.c:(.text+0x3bb): undefined reference tolibusb_detach_kernel_driver'
wheelfunctions.c:(.text+0x3f2): undefined reference to libusb_claim_interface' wheelfunctions.c:(.text+0x4b5): undefined reference tolibusb_interrupt_transfer'
wheelfunctions.c:(.text+0x504): undefined reference to libusb_release_interface' wheelfunctions.c:(.text+0x544): undefined reference tolibusb_attach_kernel_driver'
wheelfunctions.o: In function set_native_mode': wheelfunctions.c:(.text+0x5f7): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.c:(.text+0x64a): undefined reference to libusb_open_device_with_vid_pid' wheelfunctions.c:(.text+0x75f): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.o: In function set_range': wheelfunctions.c:(.text+0x894): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.o: In function set_autocenter': wheelfunctions.c:(.text+0x9d8): undefined reference tolibusb_open_device_with_vid_pid'
wheelfunctions.o:wheelfunctions.c:(.text+0xd40): more undefined references to libusb_open_device_with_vid_pid' follow wheelfunctions.o: In functionreset_wheel':
wheelfunctions.c:(.text+0xd7e): undefined reference to `libusb_reset_device'
collect2: ld returned 1 exit status
make: *** [ltwheelconf] Error 1

any help?

@thk
thk commented Mar 2, 2012

Did you build libusb-1.0 from source? (http://www.libusb.org/wiki/libusb-1.0) After a successful "make install" you should fire up a "ldconfig" to update the ld cache.

@exonac
exonac commented Mar 3, 2012

My mistake. I built libusb-1.0.8 from source now (./configure, make, make install) and did "ldconfig" afterwards, but it's still the same error.

@thk
thk commented Mar 15, 2012

Hmm... sorry, no idea left. This is what worked for me. You might want to check what 'pkg-config --cflags libusb-1.0' and 'pkg-config --libs libusb-1.0' return, when executed directly. I guess it still points to the location of the distros version. You could temporarily change the related entries in the Makefile to match the locations of your build libusb-1.0. "pkg-config --cflags libusb-1.0" points to the location of the desired header-files and the "--libs"-call to the location of the shared objects to link to. In my case (WARNING: might be different on your system) these particular-values are "-I/usr/local/include/libusb-1.0" and "-lusb-1.0". You can specify concrete locations of your libs with -L, but that didn't work for me. see gcc's manpage for details... and good luck! :)

@thk
thk commented Mar 15, 2012

btw.: Are you really sure to use the updated Makefile? The generated commnands look differently in my case:
...$ make
gcc -Wall pkg-config --cflags libusb-1.0 -c main.c
main.c: In function ‘main’:
main.c:216: warning: assignment discards qualifiers from pointer target type
gcc -Wall pkg-config --cflags libusb-1.0 -c wheelfunctions.c
gcc -Wall pkg-config --cflags libusb-1.0 -c wheels.c
gcc -Wall pkg-config --cflags libusb-1.0 -g3 -o ltwheelconf main.o wheelfunctions.o wheels.o `pkg-config --libs libusb-1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment