I solved the problem. It had nothing to do with the EPICS build system. I commented out all references to the dcamapi library and its path in my Makefiles, but I still
got this error:
LINK : fatal error LNK1104: cannot open file '../../../lib/win64/dcamapi.lib'
I figured out that the problem was that one of the vendor’s include files, console4.h, contained these lines:
#if defined(_WIN64)
#pragma comment(lib,"../../../lib/win64/dcamapi.lib")
#elif defined(WIN32)
#pragma comment(lib,"../../../lib/win32/dcamapi.lib")
That is why it was looking for the file in that path. I commented out those lines, and then it builds fine.
Mark
From: Mark Rivers
Sent: Thursday, November 28, 2024 12:54 PM
To: freddie.akeroyd at stfc.ac.uk; tech-talk at aps.anl.gov
Subject: Windows path syntax problem
Folks,
I am having problems with the “lib_DIR” syntax on Windows. It works fine on Linux.
My application Makefile contains these lines:
PROD_LIBS += hamamatsu
ifeq ($(OS_CLASS), Linux)
PROD_LIBS += dcamapi
dcamapi_DIR = /usr/local/lib
endif
ifeq ($(OS_CLASS), WIN32)
PROD_LIBS += dcamapi
dcamapi_DIR = C:/Hamamatsu/dcamsdk4/lib/win64
endif
When I build the application on Linux I get this output. . I have edited the output add newlines, removed irrelevant directories, and highlighted the path to libdcamapi.so.
/usr/bin/g++ -o hamamatsuApp
-L/corvette/home/epics/devel/areaDetector-3-13/ADHamamatsuDCAM/lib/linux-x86_64
-L/corvette/home/epics/devel/areaDetector-3-13/ADHamamatsuDCAM/iocs/hamamatsuIOC/lib/linux-x86_64
-L/corvette/home/epics/devel/areaDetector-3-13/ADCore/lib/linux-x86_64
…
-L/corvette/usr/local/epics-devel/base-7.0.8/lib/linux-x86_64
-L/usr/local/lib
-Wl,-rpath,/corvette/home/epics/devel/areaDetector-3-13/ADHamamatsuDCAM/lib/linux-x86_64
-Wl,-rpath,/corvette/home/epics/devel/areaDetector-3-13/ADHamamatsuDCAM/iocs/hamamatsuIOC/lib/linux-x86_64
-Wl,-rpath,/corvette/home/epics/devel/areaDetector-3-13/ADCore/lib/linux-x86_64
…
-Wl,-rpath,/corvette/usr/local/epics-devel/base-7.0.8/lib/linux-x86_64
-Wl,-rpath,/usr/local/lib
-rdynamic -m64
hamamatsuApp_registerRecordDeviceDriver.o hamamatsuAppMain.o
-lhamamatsu
-ldcamapi
-lNDPlugin
…
-ldbCore -lca -lCom -lboost_system -lX11 -lXext
Installing created executable ../../../bin/linux-x86_64/hamamatsuApp
It correctly adds /usr/local/lib to the linking path, and finds libdcamapi.so.
On Windows that library is in this location:
C:\Hamamatsu\dcamsdk4\lib\win64\dcamapi.lib
If I run the “dir” command on that path I see the file:
hamamatsuApp\src>dir C:\Hamamatsu\dcamsdk4\lib\win64\dcamapi.lib
Volume in drive C has no label.
Volume Serial Number is 6E2E-56EE
Directory of C:\Hamamatsu\dcamsdk4\lib\win64
08/27/2024 06:51 AM 24,984 dcamapi.lib
1 File(s) 24,984 bytes
0 Dir(s) 424,390,684,672 bytes free
When I run make I get this error. I have edited the output add newlines and removed irrelevant directories:
link -nologo -incremental:no -opt:ref -release -MACHINE:X64 -out:hamamatsuApp.exe
hamamatsuApp_registerRecordDeviceDriver.obj hamamatsuAppMain.obj
../../../../../lib/windows-x64-static/hamamatsu.lib
C:/Hamamatsu/dcamsdk4/lib/win64/dcamapi.lib
J:/epics/devel/areaDetector-3-13/ADCore/lib/windows-x64-static/NDPlugin.lib
J:/epics/devel/areaDetector-3-13/ADCore/lib/windows-x64-static/ADBase.lib
…
H:/epics-devel/base-7.0.8/lib/windows-x64-static/ca.lib
H:/epics-devel/base-7.0.8/lib/windows-x64-static/Com.lib
netapi32.lib gdi32.lib oleaut32.lib psapi.lib ws2_32.lib advapi32.lib user32.lib kernel32.lib winmm.lib dbghelp.lib
LINK : fatal error LNK1104: cannot open file '../../../lib/win64/dcamapi.lib'
make[1]: *** [H:/epics-devel/base-7.0.8/configure/RULES_BUILD:231: hamamatsuApp.exe] Error 1104
The boldface line is the correct path to the vendor library, using the forward slash separators. But the linker is not finding the file. It is using the correct end of
the path, lib/win64/dcamapi.lib, but not the start of the path.
I don’t understand this. It seems like the link command is being passed the correct path, but the linker is not finding the file?
Thanks,
Mark