EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Question about static linking in the EPICS build system
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: "Wlodek, Jakub" <jwlodek at bnl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Mon, 17 Aug 2020 21:11:08 +0000
libusb-1.0 is a newer API. Some software uses the older libusb API and some uses the newer libusb-1.0 API.

Mark


Sent from my iPhone

On Aug 17, 2020, at 1:03 PM, Wlodek, Jakub <jwlodek at bnl.gov> wrote:


Hi all,

I was able to solve the issue. I searched through the CMake logs and it seems that there are two different versions of libusb,
libusb by itself, and libusb-1.0. I am not sure what is different about these two, but it seems libuvc links against libusb-1.0
by default, and I was trying to link libusb, which was causing the issue.

Using Mark's suggestion, adding the following to the IOC Makefile resolved the problem:

 $(PROD_NAME)_SYS_LIBS += usb-1.0

Thanks again for the assistance,
Jakub
________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Wlodek, Jakub via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, August 17, 2020 1:51 PM
To: Mark Rivers <rivers at cars.uchicago.edu>; Johnson, Andrew N. <anj at anl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Re: Question about static linking in the EPICS build system

Hi Mark,

This was one of the initial things I tried before reaching out to tech talk. I added:

 $(PROD_NAME)_SYS_LIBS += usb

to the IOC makefile, and I got the same error message, and then later I tried the same but also
adding LIB_SYS_LIBS += usb in the Makefile for the driver library. Here is the full output of make - note
that the usb library is being linked seemingly at the end of the output:

---------------------------------------------------------------
jwlodek@ubuntu:/epics/src/support/areaDetector/ADUVC$ make
make -C ./configure install
make[1]: Entering directory '/epics/src/support/areaDetector/ADUVC/configure'
make -C O.linux-x86_64 -f ../Makefile TOP=../.. \
    T_A=linux-x86_64 install
make[2]: Entering directory '/epics/src/support/areaDetector/ADUVC/configure/O.linux-x86_64'
perl -CSD /epics/src/base/bin/linux-x86_64/convertRelease.pl checkRelease
make[2]: Leaving directory '/epics/src/support/areaDetector/ADUVC/configure/O.linux-x86_64'
make[1]: Leaving directory '/epics/src/support/areaDetector/ADUVC/configure'
make -C ./uvcSupport install
make[1]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcSupport'
make -C O.linux-x86_64 -f ../Makefile TOP=../.. \
    T_A=linux-x86_64 install
make[2]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcSupport/O.linux-x86_64'
Installing generic include file ../../include/libuvc/libuvc.h
Installing generic include file ../../include/libuvc/libuvc_config.h
Installing generic include file ../../include/libuvc/libuvc_internal.h
Installing generic include file ../../include/utlist.h
Installing libuvc.a
Installing libuvc.so
Installing libuvc.so.0
Installing libuvc.so.0.0.6
make[2]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcSupport/O.linux-x86_64'
make[1]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcSupport'
make -C ./uvcApp install
make[1]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcApp'
make -C ./src install
make[2]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcApp/src'
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
    T_A=linux-x86_64 install
make[3]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcApp/src/O.linux-x86_64'
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE         -std=c++11   -D_X86_64_  -DUNIX  -Dlinux     -O3   -Wall      -mtune=generic      -m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include      -I/epics/src/support/asyn/include     -I/epics/src/support/areaDetector/ADSupport/include/os/Linux -I/epics/src/support/areaDetector/ADSupport/include   -I/epics/src/support/areaDetector/ADCore/include -I/epics/src/base/include/compiler/gcc -I/epics/src/base/include/os/Linux -I/epics/src/base/include        -c ../ADUVC.cpp
/usr/bin/ar -rc    libADUVC.a     ADUVC.o
/usr/bin/ranlib libADUVC.a
/usr/bin/g++ -o libADUVC.so -shared -fPIC -Wl,-hlibADUVC.so -L/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64 -L/epics/src/base/lib/linux-x86_64 -L/epics/src/support/areaDetector/ADCore/lib/linux-x86_64 -L/epics/src/support/areaDetector/ADSupport/lib/linux-x86_64 -L/epics/src/support/asyn/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64 -Wl,-rpath,/epics/src/base/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADCore/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADSupport/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/asyn/lib/linux-x86_64           -rdynamic -m64          ADUVC.o   -luvc -lADBase -lasyn -lntndArrayConverter -lnt -lpvDatabase -lpvAccess -lpvData -lnetCDF -lMagick++ -lcoders -lMagick -ljbig -ljp2 -lbzlib -lpng -lwebp -llcms -lttf -lwmf -lfilters -ltiff -lxml2 -lNeXus -lhdf5 -lhdf5_hl -lbitshuffle -lblosc -lszip -lzlib -ldbRecStd -ldbCore -lca -lCom -Wl,-Bdynamic -lusb -ljpeg -lX11 -lXext -lpthread   -lreadline -lm -lrt -ldl -lgcc
Installing shared library ../../../lib/linux-x86_64/libADUVC.so
Installing library ../../../lib/linux-x86_64/libADUVC.a
make[3]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcApp/src/O.linux-x86_64'
make[2]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcApp/src'
make -C ./Db install
make[2]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcApp/Db'
perl -CSD /epics/src/base/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
    T_A=linux-x86_64 install
make[3]: Entering directory '/epics/src/support/areaDetector/ADUVC/uvcApp/Db/O.linux-x86_64'
Installing template file ../../../db/ADUVC.template
mkdir ../../../db
make[3]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcApp/Db/O.linux-x86_64'
make[2]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcApp/Db'
make[1]: Leaving directory '/epics/src/support/areaDetector/ADUVC/uvcApp'
make -C ./iocs install
make[1]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs'
make -C ./uvcIOC install
make[2]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC'
make -C ./configure install
make[3]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/configure'
perl -CSD /epics/src/base/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../.. \
    T_A=linux-x86_64 install
make[4]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/configure/O.linux-x86_64'
perl -CSD /epics/src/base/bin/linux-x86_64/convertRelease.pl checkRelease
make[4]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/configure/O.linux-x86_64'
make[3]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/configure'
make -C ./uvcApp install
make[3]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/uvcApp'
make -C ./src install
make[4]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/uvcApp/src'
perl -CSD /epics/src/base/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..
mkdir -p O.Common
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
    T_A=linux-x86_64 install
make[5]: Entering directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/uvcApp/src/O.linux-x86_64'
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux     -O3   -Wall      -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include   -I/epics/src/support/areaDetector/ADUVC/include      -I/epics/src/support/asyn/include     -I/epics/src/support/areaDetector/ADSupport/include/os/Linux -I/epics/src/support/areaDetector/ADSupport/include   -I/epics/src/support/areaDetector/ADCore/include  -I/epics/src/support/autosave/include/os/Linux -I/epics/src/support/autosave/include   -I/epics/src/support/busy/include   -I/epics/src/support/calc/include   -I/epics/src/support/seq/include   -I/epics/src/support/sscan/include  -I/epics/src/support/iocStats/include/os/Linux -I/epics/src/support/iocStats/include -I/epics/src/base/include/compiler/gcc -I/epics/src/base/include/os/Linux -I/epics/src/base/include        -MM -MF uvcAppMain.d  ../uvcAppMain.cpp
Creating dbd file uvcApp.dbd
perl -CSD /epics/src/base/bin/linux-x86_64/dbdExpand.pl   -I. -I.. -I../O.Common -I../../../dbd -I/epics/src/support/areaDetector/ADUVC/dbd -I/epics/src/support/asyn/dbd -I/epics/src/support/areaDetector/ADCore/dbd -I/epics/src/support/autosave/dbd -I/epics/src/support/busy/dbd -I/epics/src/support/calc/dbd -I/epics/src/support/seq/dbd -I/epics/src/support/sscan/dbd -I/epics/src/support/iocStats/dbd -I/epics/src/base/dbd -o uvcApp.dbd uvcSupport.dbd base.dbd NDPluginSupport.dbd ADSupport.dbd NDFileNull.dbd qsrv.dbd NDPluginPva.dbd PVAServerRegister.dbd NDFileNetCDF.dbd NDFileMagick.dbd NDFileTIFF.dbd NDFileNexus.dbd NDFileHDF5.dbd NDFileJPEG.dbd asyn.dbd asSupport.dbd busySupport.dbd calcSupport.dbd devIocStats.dbd sscanSupport.dbd
perl -CSD /epics/src/base/bin/linux-x86_64/registerRecordDeviceDriver.pl   -I. -I.. -I../O.Common -I../../../dbd -I/epics/src/support/areaDetector/ADUVC/dbd -I/epics/src/support/asyn/dbd -I/epics/src/support/areaDetector/ADCore/dbd -I/epics/src/support/autosave/dbd -I/epics/src/support/busy/dbd -I/epics/src/support/calc/dbd -I/epics/src/support/seq/dbd -I/epics/src/support/sscan/dbd -I/epics/src/support/iocStats/dbd -I/epics/src/base/dbd    -o uvcApp_registerRecordDeviceDriver.cpp ../O.Common/uvcApp.dbd uvcApp_registerRecordDeviceDriver /epics/src/support/areaDetector/ADUVC/iocs/uvcIOC
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux     -O3   -Wall      -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include   -I/epics/src/support/areaDetector/ADUVC/include      -I/epics/src/support/asyn/include     -I/epics/src/support/areaDetector/ADSupport/include/os/Linux -I/epics/src/support/areaDetector/ADSupport/include   -I/epics/src/support/areaDetector/ADCore/include  -I/epics/src/support/autosave/include/os/Linux -I/epics/src/support/autosave/include   -I/epics/src/support/busy/include   -I/epics/src/support/calc/include   -I/epics/src/support/seq/include   -I/epics/src/support/sscan/include  -I/epics/src/support/iocStats/include/os/Linux -I/epics/src/support/iocStats/include -I/epics/src/base/include/compiler/gcc -I/epics/src/base/include/os/Linux -I/epics/src/base/include        -MM -MF uvcApp_registerRecordDeviceDriver.d  uvcApp_registerRecordDeviceDriver.cpp
Installing created dbd file ../../../dbd/uvcApp.dbd
mkdir ../../../dbd
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux     -O3   -Wall      -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include   -I/epics/src/support/areaDetector/ADUVC/include      -I/epics/src/support/asyn/include     -I/epics/src/support/areaDetector/ADSupport/include/os/Linux -I/epics/src/support/areaDetector/ADSupport/include   -I/epics/src/support/areaDetector/ADCore/include  -I/epics/src/support/autosave/include/os/Linux -I/epics/src/support/autosave/include   -I/epics/src/support/busy/include   -I/epics/src/support/calc/include   -I/epics/src/support/seq/include   -I/epics/src/support/sscan/include  -I/epics/src/support/iocStats/include/os/Linux -I/epics/src/support/iocStats/include -I/epics/src/base/include/compiler/gcc -I/epics/src/base/include/os/Linux -I/epics/src/base/include        -c uvcApp_registerRecordDeviceDriver.cpp
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux     -O3   -Wall      -mtune=generic      -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include   -I/epics/src/support/areaDetector/ADUVC/include      -I/epics/src/support/asyn/include     -I/epics/src/support/areaDetector/ADSupport/include/os/Linux -I/epics/src/support/areaDetector/ADSupport/include   -I/epics/src/support/areaDetector/ADCore/include  -I/epics/src/support/autosave/include/os/Linux -I/epics/src/support/autosave/include   -I/epics/src/support/busy/include   -I/epics/src/support/calc/include   -I/epics/src/support/seq/include   -I/epics/src/support/sscan/include  -I/epics/src/support/iocStats/include/os/Linux -I/epics/src/support/iocStats/include -I/epics/src/base/include/compiler/gcc -I/epics/src/base/include/os/Linux -I/epics/src/base/include        -c ../uvcAppMain.cpp
/usr/bin/g++ -o uvcApp -Wl,-Bstatic -L/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/lib/linux-x86_64 -L/epics/src/base/lib/linux-x86_64 -L/epics/src/support/areaDetector/ADCore/lib/linux-x86_64 -L/epics/src/support/areaDetector/ADSupport/lib/linux-x86_64 -L/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64 -L/epics/src/support/asyn/lib/linux-x86_64 -L/epics/src/support/autosave/lib/linux-x86_64 -L/epics/src/support/busy/lib/linux-x86_64 -L/epics/src/support/calc/lib/linux-x86_64 -L/epics/src/support/iocStats/lib/linux-x86_64 -L/epics/src/support/seq/lib/linux-x86_64 -L/epics/src/support/sscan/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/lib/linux-x86_64 -Wl,-rpath,/epics/src/base/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADCore/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADSupport/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/asyn/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/autosave/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/busy/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/calc/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/iocStats/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/seq/lib/linux-x86_64 -Wl,-rpath,/epics/src/support/sscan/lib/linux-x86_64           -rdynamic -m64         uvcApp_registerRecordDeviceDriver.o uvcAppMain.o    -lADUVC -luvc -lNDPlugin -lADBase -lqsrv -lntndArrayConverter -lnt -lpvDatabase -lpvAccessIOC -lpvAccessCA -lpvAccess -lpvData -lnetCDF -lMagick++ -lcoders -lMagick -ljbig -ljp2 -lbzlib -lpng -lwebp -llcms -lttf -lwmf -lfilters -ltiff -lxml2 -lNeXus -lhdf5 -lhdf5_hl -lbitshuffle -lblosc -lszip -lzlib -lasyn -lautosave -lbusy -lcalc -ldevIocStats -lsscan -lseq -lpv -ldbRecStd -ldbCore -lca -lCom -Wl,-Bdynamic -lusb -ljpeg -lX11 -lXext -lpthread   -lreadline -lm -lrt -ldl -lgcc
/usr/bin/ld: /epics/src/support/areaDetector/ADSupport/lib/linux-x86_64/libjp2.a(jas_stream.o): in function `jas_stream_tmpfile':
jas_stream.c:(.text+0x7e9): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o): in function `_uvc_stream_callback':
stream.c:(.text+0x674): undefined reference to `libusb_free_transfer'
/usr/bin/ld: stream.c:(.text+0x6ba): undefined reference to `libusb_submit_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o): in function `uvc_query_stream_ctrl':
stream.c:(.text+0x902): undefined reference to `libusb_control_transfer'
/usr/bin/ld: stream.c:(.text+0x9e2): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o): in function `uvc_query_still_ctrl':
stream.c:(.text+0xb05): undefined reference to `libusb_control_transfer'
/usr/bin/ld: stream.c:(.text+0xb81): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o): in function `uvc_trigger_still':
stream.c:(.text+0xc36): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o):stream.c:(.text+0xd24): more undefined references to `libusb_control_transfer' follow
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o): in function `uvc_stream_start':
stream.c:(.text+0x1e00): undefined reference to `libusb_get_ss_endpoint_companion_descriptor'
/usr/bin/ld: stream.c:(.text+0x1e13): undefined reference to `libusb_free_ss_endpoint_companion_descriptor'
/usr/bin/ld: stream.c:(.text+0x1e76): undefined reference to `libusb_set_interface_alt_setting'
/usr/bin/ld: stream.c:(.text+0x1edb): undefined reference to `libusb_alloc_transfer'
/usr/bin/ld: stream.c:(.text+0x1fcb): undefined reference to `libusb_submit_transfer'
/usr/bin/ld: stream.c:(.text+0x2016): undefined reference to `libusb_free_transfer'
/usr/bin/ld: stream.c:(.text+0x2307): undefined reference to `libusb_alloc_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(stream.c.o): in function `uvc_stream_stop':
stream.c:(.text+0x28e1): undefined reference to `libusb_cancel_transfer'
/usr/bin/ld: stream.c:(.text+0x28fe): undefined reference to `libusb_free_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): in function `uvc_get_scanning_mode':
ctrl-gen.c:(.text+0x5f): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): in function `uvc_set_scanning_mode':
ctrl-gen.c:(.text+0xfe): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): in function `uvc_get_ae_mode':
ctrl-gen.c:(.text+0x18f): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): in function `uvc_set_ae_mode':
ctrl-gen.c:(.text+0x22e): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): in function `uvc_get_ae_priority':
ctrl-gen.c:(.text+0x2bf): undefined reference to `libusb_control_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o):ctrl-gen.c:(.text+0x35e): more undefined references to `libusb_control_transfer' follow
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_free_device_info':
device.c:(.text+0x517): undefined reference to `libusb_free_config_descriptor'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_get_device_descriptor':
device.c:(.text+0x650): undefined reference to `libusb_get_device_descriptor'
/usr/bin/ld: device.c:(.text+0x6a4): undefined reference to `libusb_open'
/usr/bin/ld: device.c:(.text+0x6d0): undefined reference to `libusb_get_string_descriptor_ascii'
/usr/bin/ld: device.c:(.text+0x6f7): undefined reference to `libusb_get_string_descriptor_ascii'
/usr/bin/ld: device.c:(.text+0x71e): undefined reference to `libusb_get_string_descriptor_ascii'
/usr/bin/ld: device.c:(.text+0x738): undefined reference to `libusb_close'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_get_device_list':
device.c:(.text+0x7c3): undefined reference to `libusb_get_device_list'
/usr/bin/ld: device.c:(.text+0x82f): undefined reference to `libusb_get_config_descriptor'
/usr/bin/ld: device.c:(.text+0x83e): undefined reference to `libusb_get_device_descriptor'
/usr/bin/ld: device.c:(.text+0x8cb): undefined reference to `libusb_free_config_descriptor'
/usr/bin/ld: device.c:(.text+0x8f0): undefined reference to `libusb_ref_device'
/usr/bin/ld: device.c:(.text+0x946): undefined reference to `libusb_free_config_descriptor'
/usr/bin/ld: device.c:(.text+0x9dd): undefined reference to `libusb_free_device_list'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_find_device':
device.c:(.text+0xb8d): undefined reference to `libusb_unref_device'
/usr/bin/ld: device.c:(.text+0xc10): undefined reference to `libusb_ref_device'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_find_devices':
device.c:(.text+0xdef): undefined reference to `libusb_ref_device'
/usr/bin/ld: device.c:(.text+0xe56): undefined reference to `libusb_unref_device'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_free_device_list':
device.c:(.text+0xf15): undefined reference to `libusb_unref_device'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_get_device':
device.c:(.text+0xf84): undefined reference to `libusb_ref_device'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_unref_device':
device.c:(.text+0x104d): undefined reference to `libusb_unref_device'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_claim_if':
device.c:(.text+0x109b): undefined reference to `libusb_detach_kernel_driver'
/usr/bin/ld: device.c:(.text+0x10ba): undefined reference to `libusb_claim_interface'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_release_if':
device.c:(.text+0x10fd): undefined reference to `libusb_set_interface_alt_setting'
/usr/bin/ld: device.c:(.text+0x1109): undefined reference to `libusb_release_interface'
/usr/bin/ld: device.c:(.text+0x111e): undefined reference to `libusb_attach_kernel_driver'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_get_device_info':
device.c:(.text+0x21b4): undefined reference to `libusb_get_config_descriptor'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_open':
device.c:(.text+0x2252): undefined reference to `libusb_open'
/usr/bin/ld: device.c:(.text+0x2291): undefined reference to `libusb_ref_device'
/usr/bin/ld: device.c:(.text+0x22d8): undefined reference to `libusb_get_config_descriptor'
/usr/bin/ld: device.c:(.text+0x231f): undefined reference to `libusb_get_device_descriptor'
/usr/bin/ld: device.c:(.text+0x2398): undefined reference to `libusb_detach_kernel_driver'
/usr/bin/ld: device.c:(.text+0x23ba): undefined reference to `libusb_claim_interface'
/usr/bin/ld: device.c:(.text+0x23f8): undefined reference to `libusb_set_interface_alt_setting'
/usr/bin/ld: device.c:(.text+0x2404): undefined reference to `libusb_release_interface'
/usr/bin/ld: device.c:(.text+0x2416): undefined reference to `libusb_close'
/usr/bin/ld: device.c:(.text+0x241f): undefined reference to `libusb_unref_device'
/usr/bin/ld: device.c:(.text+0x2446): undefined reference to `libusb_free_transfer'
/usr/bin/ld: device.c:(.text+0x24bb): undefined reference to `libusb_alloc_transfer'
/usr/bin/ld: device.c:(.text+0x250c): undefined reference to `libusb_submit_transfer'
/usr/bin/ld: device.c:(.text+0x254e): undefined reference to `libusb_attach_kernel_driver'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_free_devh':
device.c:(.text+0x2740): undefined reference to `libusb_free_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_close':
device.c:(.text+0x27a7): undefined reference to `libusb_close'
/usr/bin/ld: device.c:(.text+0x27e1): undefined reference to `libusb_unref_device'
/usr/bin/ld: device.c:(.text+0x2810): undefined reference to `libusb_free_transfer'
/usr/bin/ld: device.c:(.text+0x2855): undefined reference to `libusb_close'
/usr/bin/ld: device.c:(.text+0x2876): undefined reference to `libusb_set_interface_alt_setting'
/usr/bin/ld: device.c:(.text+0x2882): undefined reference to `libusb_release_interface'
/usr/bin/ld: device.c:(.text+0x28cd): undefined reference to `libusb_attach_kernel_driver'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `_uvc_status_callback':
device.c:(.text+0x1cf): undefined reference to `libusb_submit_transfer'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_get_bus_number':
device.c:(.text+0x249): undefined reference to `libusb_get_bus_number'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_get_device_address':
device.c:(.text+0x259): undefined reference to `libusb_get_device_address'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): in function `uvc_ref_device':
device.c:(.text+0x102d): undefined reference to `libusb_ref_device'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(init.c.o): in function `_uvc_handle_events':
init.c:(.text+0x27): undefined reference to `libusb_handle_events_completed'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(init.c.o): in function `uvc_init':
init.c:(.text+0x94): undefined reference to `libusb_init'
/usr/bin/ld: /epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(init.c.o): in function `uvc_exit':
init.c:(.text+0x10d): undefined reference to `libusb_exit'
collect2: error: ld returned 1 exit status
make[5]: *** [/epics/src/base/configure/RULES_BUILD:213: uvcApp] Error 1
make[5]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/uvcApp/src/O.linux-x86_64'
make[4]: *** [/epics/src/base/configure/RULES_ARCHS:58: install.linux-x86_64] Error 2
make[4]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/uvcApp/src'
make[3]: *** [/epics/src/base/configure/RULES_DIRS:84: src.install] Error 2
make[3]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC/uvcApp'
make[2]: *** [/epics/src/base/configure/RULES_DIRS:84: uvcApp.install] Error 2
make[2]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs/uvcIOC'
make[1]: *** [/epics/src/base/configure/RULES_DIRS:84: uvcIOC.install] Error 2
make[1]: Leaving directory '/epics/src/support/areaDetector/ADUVC/iocs'
make: *** [/epics/src/base/configure/RULES_DIRS:84: iocs.install] Error 2


Some of the other methods I have tried include the following:

  *   Copy libusb.a into ADSupport/lib/linux-x86_64 and add $(PROD_NAME)_LIBS += usb to the IOC makefile
  *   Do the same as above but add to both library and IOC Makefiles
  *   Copy the libusb.so files to ADSupport and try to link to them dynamically.
  *   Reorder the links (usb first, uvc first)

Finally, I decided to try and (statically) build a simple executable with libuvc outside of the EPICS build system, and I seemingly get the same errors,
meaning that the issue is likely tied to how the library is being built. The following makefile gives the same undefined reference issue:

all:
     g++ -L. uvc_locater.cpp -o uvc_locater -lusb -luvc
clean:
     rm uvc_locater

I am not yet sure if this is still something I am not following, or if there is an issue with the CMake/PkgConfig configuration for libuvc.

Best Regards,
Jakub
________________________________
From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Friday, August 14, 2020 6:09 PM
To: Wlodek, Jakub <jwlodek at bnl.gov>; Johnson, Andrew N. <anj at anl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Re: Question about static linking in the EPICS build system

Hi Jakub,


I think I see your problem.


In your IOC application Makefile you are not linking with the usb library.  That works OK when you are linking with libuvc.so because that shareable library itself is linked with libusb.so.


But when you build statically and link with libuvc.a it will not automatically link with libusb.so.  So in your IOC application Makefile you need to include


 $(PROD_NAME)_SYS_LIBS += usb


Mark



________________________________
From: Wlodek, Jakub <jwlodek at bnl.gov>
Sent: Friday, August 14, 2020 4:59 PM
To: Johnson, Andrew N.; Mark Rivers
Cc: EPICS tech-talk
Subject: Re: Question about static linking in the EPICS build system

Hi Mark, Andrew,

The libuvc.a and .so files are generated by the install-libuvc.sh script in the uvcSupport directory. The libraries are copied into os/HOST_ARCH and then installed to the lib directory at the top level of the driver by the Makefile in that directory. As far as I know that directory should be included by the build system by default. Whether or not I specify SYS_LIBS or just LIBS I see the library appearing in the link phase, I just get that missing reference error if I'm using the non SYS_LIBS link. I did some messing around with the build of the vendor library as well but haven't looked too much into it.

The uvc library cmake uses pkgconfig to link against libusb and libjpeg, so I was wondering if there was some incompatibilities in that it could be linking something dynamically when constructing libuvc.a?

Thanks for the quick reply,

Jakub
________________________________
From: Johnson, Andrew N. <anj at anl.gov>
Sent: Friday, August 14, 2020 5:32:14 PM
To: Rivers, Mark L. <rivers at cars.uchicago.edu>
Cc: Wlodek, Jakub <jwlodek at bnl.gov>; EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Re: Question about static linking in the EPICS build system

Hi Jakub,

To expand on Mark’s reply a little, if you do have a libuvc.a file elsewhere, you should be able to use this in your Makefile to link with it:

$(PROD_NAME)_LIBS += uvc
uvc_DIR = /path/to/the/library/directory

Note that when building static binaries the order of the entries in your _LIBS variable is important as the linker usually makes just one pass through the list in the order that the libraries appear in that variable.

- Andrew


On Aug 14, 2020, at 4:17 PM, Mark Rivers via Tech-talk <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>> wrote:

Hi Jakub,


At first, I used $(PROD_NAME)_SYS_LIBS to link to the support library I used for communicating with the device,
but I would like to change this to $(PROD_NAME)_LIBS since it would be my understanding that this would mean that the driver application
could be built entirely statically, making it more portable since then the support library wouldn't have to be installed and in the system path
during runtime.


I see from the ADUVC repository on Github that the name of that support library is uvc, but I don't see a libuvc.so or libuvc.a file as part of the repository.  Those must be elsewhere on your system?  Is that support library provided in both shareable library (.so) and static (.a) versions?  If it is only provided in .so form then you cannot include it in your application binary.  If it is provided as a .a file then you can include it in your binary when you build statically.


Mark




________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov<mailto:tech-talk-bounces at aps.anl.gov>> on behalf of Wlodek, Jakub via Tech-talk <tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>>
Sent: Friday, August 14, 2020 3:13 PM
To: tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>
Subject: Question about static linking in the EPICS build system

Hi all,

I have been working for some time on allowing fully static linking of an areaDetector driver I wrote some time ago:

https://github.com/areaDetector/ADUVC/tree/R1-4

At first, I used $(PROD_NAME)_SYS_LIBS to link to the support library I used for communicating with the device, but
I would like to change this to $(PROD_NAME)_LIBS since it would be my understanding that this would mean that the driver application
could be built entirely statically, making it more portable since then the support library wouldn't have to be installed and in the system path
during runtime.

When using SYS_LIBS, the driver library and IOC application build without issue, however, when I change to just LIBS, the library still
compiles OK, but I get many undefined reference errors when compiling the App:

/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): In function `uvc_get_scanning_mode':
ctrl-gen.c:(.text+0x5b): undefined reference to `libusb_control_transfer'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): In function `uvc_set_scanning_mode':
ctrl-gen.c:(.text+0xea): undefined reference to `libusb_control_transfer'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): In function `uvc_get_ae_mode':
ctrl-gen.c:(.text+0x17b): undefined reference to `libusb_control_transfer'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): In function `uvc_set_ae_mode':
ctrl-gen.c:(.text+0x20a): undefined reference to `libusb_control_transfer'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o): In function `uvc_get_ae_priority':
ctrl-gen.c:(.text+0x29b): undefined reference to `libusb_control_transfer'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(ctrl-gen.c.o):ctrl-gen.c:(.text+0x32a): more undefined references to `libusb_control_transfer' follow
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): In function `uvc_free_device_info':
device.c:(.text+0x4c6): undefined reference to `libusb_free_config_descriptor'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): In function `uvc_get_device_descriptor':
device.c:(.text+0x58d): undefined reference to `libusb_get_device_descriptor'
device.c:(.text+0x5f1): undefined reference to `libusb_open'
device.c:(.text+0x618): undefined reference to `libusb_get_string_descriptor_ascii'
device.c:(.text+0x640): undefined reference to `libusb_get_string_descriptor_ascii'
device.c:(.text+0x668): undefined reference to `libusb_get_string_descriptor_ascii'
device.c:(.text+0x683): undefined reference to `libusb_close'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): In function `uvc_get_device_list':
device.c:(.text+0x711): undefined reference to `libusb_get_device_list'
device.c:(.text+0x769): undefined reference to `libusb_get_config_descriptor'
device.c:(.text+0x77d): undefined reference to `libusb_get_device_descriptor'
device.c:(.text+0x81c): undefined reference to `libusb_free_config_descriptor'
device.c:(.text+0x83c): undefined reference to `libusb_free_device_list'
device.c:(.text+0x969): undefined reference to `libusb_free_config_descriptor'
device.c:(.text+0x996): undefined reference to `libusb_ref_device'
/epics/src/support/areaDetector/ADUVC/lib/linux-x86_64/libuvc.a(device.c.o): In function `uvc_find_device':
device.c:(.text+0xac2): undefined reference to `libusb_get_device_descriptor'
device.c:(.text+0xb09): undefined reference to `libusb_unref_device'
device.c:(.text+0xb51): undefined reference to `libusb_open
...


The support library in use depends on libusb and libjpeg, both of which are found during the cmake build for said library. It is built both statically and dynamically.
I ran nm on the static library, and I did see the libusb functrions listed:

                U _GLOBAL_OFFSET_TABLE_
0000000000000000 d isight_tag.6062
                U libusb_alloc_transfer
                U libusb_cancel_transfer
                U libusb_control_transfer
                U libusb_free_ss_endpoint_companion_descriptor
                U libusb_free_transfer
                U libusb_get_ss_endpoint_companion_descriptor
                U libusb_set_interface_alt_setting
                U libusb_submit_transfer
                ...


It is clear to me that this is some error I have in the linking process/configuration, but I can't seem to figure out what
specifically it could be. I have tried adding libusb to the LIBS for the ioc application (copying the statically compiled library to
ADUVC/lib/linux-x86_64), but this gave me the same error, and the same when I added libusb to SYS_LIBS.

I have had similar issues when trying to get a static build of OpenCV to link against an areaDetector application -
it works fine when building the intermediate libraries (plugins, driver lib), but when building the final IOC application I got undefined reference errors.

If anyone has an idea on what I should change, it would be much appreciated.

Thanks!
Jakub Wlodek



--
Complexity comes for free, simplicity you have to work for.


References:
Question about static linking in the EPICS build system Wlodek, Jakub via Tech-talk
Re: Question about static linking in the EPICS build system Mark Rivers via Tech-talk
Re: Question about static linking in the EPICS build system Johnson, Andrew N. via Tech-talk
Re: Question about static linking in the EPICS build system Wlodek, Jakub via Tech-talk
Re: Question about static linking in the EPICS build system Mark Rivers via Tech-talk
Re: Question about static linking in the EPICS build system Wlodek, Jakub via Tech-talk
Re: Question about static linking in the EPICS build system Wlodek, Jakub via Tech-talk

Navigate by Date:
Prev: Re: Question about static linking in the EPICS build system Wlodek, Jakub via Tech-talk
Next: what does dirty mean ? Jeong Han Lee via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Question about static linking in the EPICS build system Wlodek, Jakub via Tech-talk
Next: accepting channel name drops in Qt from MEDM Thomas, Patrick via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 18 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·