hidtest-libusb and hidtest-hidraw do not compile #108

Closed
opened 2019-10-22 05:29:20 -05:00 by piciu67 · 9 comments
piciu67 commented 2019-10-22 05:29:20 -05:00 (Migrated from github.com)

Original signal11 hidtest.cpp was renamed to hidtest.c and example makefiles "Makefile-manual" in hidapi/libusb and hidapi/linux stopped working.

Original signal11 hidtest.cpp was renamed to hidtest.c and example makefiles "Makefile-manual" in hidapi/libusb and hidapi/linux stopped working.
Youw commented 2019-10-22 06:10:02 -05:00 (Migrated from github.com)

Thanks for reporting this!

Would you be kind to prepare a PR and provide a fix?

It looks like it is a matter of removing CPPOBJS variable in Makefile.linux.

Thanks for reporting this! Would you be kind to prepare a PR and provide a fix? It looks like it is a matter of removing `CPPOBJS` variable in `Makefile.linux`.
piciu67 commented 2019-10-22 06:17:19 -05:00 (Migrated from github.com)

Simplest way fix this problem is just to rename hidtest.c back to hidtest.cpp.

Simplest way fix this problem is just to rename hidtest.c back to hidtest.cpp.
Youw commented 2019-10-22 06:20:41 -05:00 (Migrated from github.com)

Maybe it will fix this particular issue, but it creates a bigger one: requirement to have a C++ compiler, which is a big deal sometime, and not really required to actually compile and run the example (see #22).

Maybe it will fix this particular issue, but it creates a bigger one: _requirement to have a C++ compiler_, which is a big deal sometime, and not really required to actually compile and run the example (see #22).
z3ntu commented 2019-10-22 06:34:10 -05:00 (Migrated from github.com)

A start for the patch would be

diff --git a/linux/Makefile-manual b/linux/Makefile-manual
index 04ce1de..c8aab27 100644
--- a/linux/Makefile-manual
+++ b/linux/Makefile-manual
@@ -19,16 +19,15 @@ CXXFLAGS ?= -Wall -g -fpic
 LDFLAGS  ?= -Wall -g
 
 
-COBJS     = hid.o
-CPPOBJS   = ../hidtest/hidtest.o
-OBJS      = $(COBJS) $(CPPOBJS)
+COBJS     = hid.o ../hidtest/hidtest.o
+OBJS      = $(COBJS)
 LIBS_UDEV = `pkg-config libudev --libs` -lrt
 LIBS      = $(LIBS_UDEV)
 INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`
 
 
 # Console Test Program
-hidtest-hidraw: $(COBJS) $(CPPOBJS)
+hidtest-hidraw: $(COBJS)
 	$(CXX) $(LDFLAGS) $^ $(LIBS_UDEV) -o $@
 
 # Shared Libs
@@ -39,9 +38,6 @@ libhidapi-hidraw.so: $(COBJS)
 $(COBJS): %.o: %.c
 	$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@
 
-$(CPPOBJS): %.o: %.cpp
-	$(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@
-
 
 clean:
 	rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so ../hidtest/hidtest.o

but the following files would have to be (probably) fixed as well:
libusb/Makefile.freebsd
libusb/Makefile.linux
mac/Makefile-manual
testgui/Makefile.freebsd
testgui/Makefile.linux
testgui/Makefile.mac
testgui/Makefile.mingw
windows/Makefile.mingw

A start for the patch would be ```diff diff --git a/linux/Makefile-manual b/linux/Makefile-manual index 04ce1de..c8aab27 100644 --- a/linux/Makefile-manual +++ b/linux/Makefile-manual @@ -19,16 +19,15 @@ CXXFLAGS ?= -Wall -g -fpic LDFLAGS ?= -Wall -g -COBJS = hid.o -CPPOBJS = ../hidtest/hidtest.o -OBJS = $(COBJS) $(CPPOBJS) +COBJS = hid.o ../hidtest/hidtest.o +OBJS = $(COBJS) LIBS_UDEV = `pkg-config libudev --libs` -lrt LIBS = $(LIBS_UDEV) INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags` # Console Test Program -hidtest-hidraw: $(COBJS) $(CPPOBJS) +hidtest-hidraw: $(COBJS) $(CXX) $(LDFLAGS) $^ $(LIBS_UDEV) -o $@ # Shared Libs @@ -39,9 +38,6 @@ libhidapi-hidraw.so: $(COBJS) $(COBJS): %.o: %.c $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ -$(CPPOBJS): %.o: %.cpp - $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@ - clean: rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so ../hidtest/hidtest.o ``` but the following files would have to be (probably) fixed as well: libusb/Makefile.freebsd libusb/Makefile.linux mac/Makefile-manual testgui/Makefile.freebsd testgui/Makefile.linux testgui/Makefile.mac testgui/Makefile.mingw windows/Makefile.mingw
Youw commented 2019-10-22 06:55:35 -05:00 (Migrated from github.com)

Even better: you contribute to open-source AND improve your own skills!
Have fun :)

~Even better: you contribute to open-source AND improve your own skills!~ ~Have fun :)~
piciu67 commented 2019-10-22 07:00:58 -05:00 (Migrated from github.com)

Even better: you contribute to open-source AND improve your own skills!
Have fun :)

I deleted my promise to prepare PR as irrelevant, you guys are so much faster than me :)

> Even better: you contribute to open-source AND improve your own skills! > Have fun :) I deleted my promise to prepare PR as irrelevant, you guys are so much faster than me :)
Youw commented 2019-10-22 07:11:26 -05:00 (Migrated from github.com)

No body in rush (we aren't), no body makes any demands or obligations.
Suit yourself.

No body in rush (we aren't), no body makes any demands or obligations. Suit yourself.
mcuee commented 2019-12-13 21:56:01 -06:00 (Migrated from github.com)

The issue seems to be gone with #115.

The issue seems to be gone with #115.
z3ntu commented 2019-12-14 05:17:10 -06:00 (Migrated from github.com)

Should be resolved completely with #131

Should be resolved completely with #131
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi#108
No description provided.