Hello EPICS tech-talk,
I am trying to compile an EPICS IOC with libusb included (I am on a linux platform running ubuntu 14.04 and EPICS base 3.14-3.14.12.3 ).
I created the ioc using
makeBaseApp.pl -t example test
makeBaseApp.pl -t example -i -a linux-x86_64 test
and was able to run make with no issues.
I added the header files for a class I created which interfaces with a usb device (these are included in this email) by adding this line to /testAPP/src/testMain.cpp:
#include "DI-2108-P.cpp"
when I try to make, I get this output:
make -C ./configure install
make[1]: Entering directory `/media/Extra_Space/work/testIOC/configure'
make -C O.linux-x86_64 -f ../Makefile TOP=../.. T_A=linux-x86_64 install
make[2]: Entering directory `/media/Extra_Space/work/testIOC/configure/O.linux-x86_64'
perl ../../../epics/epics3.14-3.14.12.3/bin/linux-x86_64/convertRelease.pl checkRelease
make[2]: Leaving directory `/media/Extra_Space/work/testIOC/configure/O.linux-x86_64'
make[1]: Leaving directory `/media/Extra_Space/work/testIOC/configure'
make -C ./testApp install
make[1]: Entering directory `/media/Extra_Space/work/testIOC/testApp'
make -C ./src install
make[2]: Entering directory `/media/Extra_Space/work/testIOC/testApp/src'
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. T_A=linux-x86_64 install
make[3]: Entering directory `/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64'
/usr/bin/g++ -c -D_POSIX_C_SOURCE=199506L -D_POSIX_THREADS -D_XOPEN_SOURCE=500 -D_X86_64_ -DUNIX -D_BSD_SOURCE -Dlinux -D_REENTRANT -O3 -g -Wall -m64 -MMD -I. -I../O.Common -I. -I.. -I../../../include/os/Linux -I../../../include
-I../../../../epics/epics3.14-3.14.12.3/include/os/Linux -I../../../../epics/epics3.14-3.14.12.3/include ../testMain.cpp
In file included from ../testMain.cpp:14:0:
../DI-2108-P.cpp: In member function ‘std::vector<double> DI_2108_P::getReadings()’:
../DI-2108-P.cpp:202:7: warning: variable ‘r’ set but not used [-Wunused-but-set-variable]
int r; //for return values
^
/usr/bin/g++ -o test -L/media/Extra_Space/work/epics/epics3.14-3.14.12.3/lib/linux-x86_64 -L/media/Extra_Space/work/testIOC/lib/linux-x86_64 -m64 test_registerRecordDeviceDriver.o testMain.o -ltestSupport -lrecIoc -lsoftDevIoc -lmiscIoc
-lrsrvIoc -ldbtoolsIoc -lasIoc -ldbIoc -lregistryIoc -ldbStaticIoc -lca -lCom
testMain.o: In function `DI_2108_P::Initialize()':
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:37: undefined reference to `libusb_init'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:42: undefined reference to `libusb_set_debug'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:44: undefined reference to `libusb_get_device_list'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:51: undefined reference to `libusb_open_device_with_vid_pid'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:56: undefined reference to `libusb_free_device_list'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:58: undefined reference to `libusb_kernel_driver_active'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:63: undefined reference to `libusb_claim_interface'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:60: undefined reference to `libusb_detach_kernel_driver'
testMain.o: In function `DI_2108_P::close()':
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:82: undefined reference to `libusb_release_interface'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:89: undefined reference to `libusb_close'
testMain.o: In function `DI_2108_P::sendMessage(std::string)':
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:114: undefined reference to `libusb_bulk_transfer'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:118: undefined reference to `libusb_bulk_transfer'
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:120: undefined reference to `libusb_strerror'
testMain.o: In function `DI_2108_P::getReadings()':
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:208: undefined reference to `libusb_bulk_transfer'
testMain.o: In function `DI_2108_P::reset()':
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:74: undefined reference to `libusb_reset_device'
testMain.o: In function `DI_2108_P::close()':
/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64/../DI-2108-P.cpp:90: undefined reference to `libusb_exit'
collect2: error: ld returned 1 exit status
make[3]: *** [test] Error 1
make[3]: Leaving directory `/media/Extra_Space/work/testIOC/testApp/src/O.linux-x86_64'
make[2]: *** [install.linux-x86_64] Error 2
make[2]: Leaving directory `/media/Extra_Space/work/testIOC/testApp/src'
make[1]: *** [src.install] Error 2
make[1]: Leaving directory `/media/Extra_Space/work/testIOC/testApp'
make: *** [testApp.install] Error 2
Do you have any idea what might be causing this issue? I've tried googling around and haven't found anything helpful.
Thank you for your assistance,
-Sam de Jong