epics-modules / measComp

EPICS support for some USB and Ethernet I/O modules from Measurement Computing
6 stars 16 forks source link

compile error with base-7.0.4 #14

Closed LeeYangLBLBCS closed 2 years ago

LeeYangLBLBCS commented 2 years ago

the latest version R3-1 fails to compile base-7.0.4. the error seems to say the require library is missing. But the library file are NOT missing. ./lib/linux-x86_64/libmeasCompLinuxDrivers.a ./lib/linux-x86_64/libmeasCompLinuxDrivers.so

============================================================ /usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X8664 -DUNIX -Dlinux -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/opt/epics/base-7.0.4/../modules/support/include -I/opt/epics/base-7.0.4/../modules/support/asyn-R4-43/include -I/opt/epics/base-7.0.4/../modules/support/calc-R3-7-4/include -I/opt/epics/base-7.0.4/../modules/support/scaler-4-0/include -I/opt/epics/base-7.0.4/../modules/support/mca-R7-8/include/os/Linux -I/opt/epics/base-7.0.4/../modules/support/mca-R7-8/include -I/opt/epics/base-7.0.4/../modules/support/busy-R1-7-2/include -I/opt/epics/base-7.0.4/../modules/support/sscan-R2-11-5/include -I/opt/epics/base-7.0.4/../modules/support/autosave-R5-10/include/os/Linux -I/opt/epics/base-7.0.4/../modules/support/autosave-R5-10/include -I/opt/epics/base-7.0.4/../modules/support/seq-2-2-7/include -I/opt/epics/base-7.0.4/../modules/support/measComp-R3-1/include -I/opt/epics/base-7.0.4/include/compiler/gcc -I/opt/epics/base-7.0.4/include/os/Linux -I/opt/epics/base-7.0.4/include -MM -MF mccEthernet.d ../mccEthernet.c /usr/bin/gcc -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X8664 -DUNIX -Dlinux -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/opt/epics/base-7.0.4/../modules/support/include -I/opt/epics/base-7.0.4/../modules/support/asyn-R4-43/include -I/opt/epics/base-7.0.4/../modules/support/calc-R3-7-4/include -I/opt/epics/base-7.0.4/../modules/support/scaler-4-0/include -I/opt/epics/base-7.0.4/../modules/support/mca-R7-8/include/os/Linux -I/opt/epics/base-7.0.4/../modules/support/mca-R7-8/include -I/opt/epics/base-7.0.4/../modules/support/busy-R1-7-2/include -I/opt/epics/base-7.0.4/../modules/support/sscan-R2-11-5/include -I/opt/epics/base-7.0.4/../modules/support/autosave-R5-10/include/os/Linux -I/opt/epics/base-7.0.4/../modules/support/autosave-R5-10/include -I/opt/epics/base-7.0.4/../modules/support/seq-2-2-7/include -I/opt/epics/base-7.0.4/../modules/support/measComp-R3-1/include -I/opt/epics/base-7.0.4/include/compiler/gcc -I/opt/epics/base-7.0.4/include/os/Linux -I/opt/epics/base-7.0.4/include -c ../test-usb1608G.c make[3]: No rule to make target '../../../lib/linux-x86_64-debug/libmeasCompLinuxDrivers.a', needed by 'test-usb1608G'. Stop. make[3]: Leaving directory '/opt/epics/modules/support/measComp-R3-1/measCompApp/Linux_Drivers/O.linux-x86_64-debug' make[2]: [/opt/epics/base-7.0.4/configure/RULES_ARCHS:58: install.linux-x86_64-debug] Error 2 make[2]: Leaving directory '/opt/epics/modules/support/measComp-R3-1/measCompApp/Linux_Drivers' make[1]: [/opt/epics/base-7.0.4/configure/RULES_DIRS:85: Linux_Drivers.install] Error 2 make[1]: Leaving directory '/opt/epics/modules/support/measComp-R3-1/measCompApp' make: [/opt/epics/base-7.0.4/configure/RULES_DIRS:85: measCompApp.install] Error 2

MarkRivers commented 2 years ago
make[3]: Leaving directory '/opt/epics/modules/support/measComp-R3-1/measCompApp/Linux_Drivers/O.linux-x86_64-debug'

That message indicates that you are building with EPICS_HOST_ARCH=linux-x86_64-debug, not linux-x86_64, which is the directory where you say the library exists.

But the library file are NOT missing. ./lib/linux-x86_64/libmeasCompLinuxDrivers.a ./lib/linux-x86_64/libmeasCompLinuxDrivers.so

Note that cbw_linuxSrc/Makefile contains these lines:

ifeq ($(HAVE_HIDAPI), YES)
  LIBRARY_IOC_Linux += cbw_linux
endif

Is it possible that you have defined HAVE_HIDAPI=YES only for linux-x86_64, and not for linux-x86_64-debug?

LeeYangLBLBCS commented 2 years ago

thanks for spotting out the debug build. The build succeeded after I created CONFIG_SITE.Common.linux-x86_64-debug with "HAVE_HIDAPI=YES". I was compiling in both linux-x86_64-debug and no debug versions at the same time. I thought if a debug config file does not exist, such as CONFIG_SITE.Common.linux-x86_64-debug, the build will inherit the none debug version,CONFIG_SITE.Common.linux-x86_64? (Since in most cases the debug file should be the same as none-debug one, such as in this case). Also, what happends if the package for "hidapi" is not installed, but HAVE_HIDAPI=YES is entered by mistake? the build will succeeded, but IOC will not start? thanks.

anjohnson commented 2 years ago

The EPICS build system doesn't implement that kind of inheritance for configuration files, each target is treated separately so you have to create a separate CONFIG_SITE.Common.<arch> file for each target, although a CONFIG_SITE.Common.linux-x86_64-debug file could include the non-debug version if it wants. It would have to get the path to it right though, probably something like this:

# CONFIG_SITE.Common.linux-x86_64-debug

include $(TOP)/configure/CONFIG_SITE.Common.linux-x86_64

These files get included by every Makefile inside the application when building for that target, so just using a line like include CONFIG_SITE.Common.linux-x86_64 would not work.

MarkRivers commented 2 years ago

Also, what happends if the package for "hidapi" is not installed, but HAVE_HIDAPI=YES is entered by mistake? the build will succeeded, but IOC will not start?

No, the build will fail because it will not be able to find hidapi/hidapi.h required in pmd.h, or lidapi-libusb.so required when linking programs for many USB devices.

Note that I am working on a new version of the Linux support for Measurement Computing devices that uses their UL for Linux library (libuldaq). This eliminates the need for the Linux_Drivers directory with Warren Jasper's drivers, and eliminates the need for hidapi. I have it working with the E-1608 and E-TC models, and I am working getting USB-CTR08 model to work now. This development is in the UL_for_Linux branch.

LeeYangLBLBCS commented 2 years ago

It appears RELEASE files for debug build inherits the contents of none-debug version. For example, I don't have any RELEASE.local.linux-x86_64-debug file for all drivers. But the debug outputs are generated for all drivers specified in RELEASE.local.linux-x86_64.