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  <20192020  2021  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: registerRecordDeviceDriver.obj unresolved external symbols
From: "Johnson, Andrew N. via Tech-talk" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Wed, 22 May 2019 20:40:52 +0000
Hi Patrick,

On 5/22/19 1:44 PM, Thomas, Patrick via Tech-talk wrote:
I was wondering if someone might be able to help me track down the source of these linking errors when compiling an IOC with custom device support. I am using EPICS base 3.14.12.8 and Microsoft Visual Studio Community 2017 on Windows 10 Enterprise 64 bit.

link -nologo   -incremental:no -opt:ref -release  -MACHINE:X64              -out:ads.exe        ads_registerRecordDeviceDriver.obj adsMain.obj     ..\\..\\..\\lib\\windows-x64-static\\adsSupport.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\recIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\softDevIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\miscIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\rsrvIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\dbtoolsIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\asIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\dbIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\registryIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\dbStaticIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\ca.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64-static\\Com.lib   ws2_32.lib advapi32.lib user32.lib kernel32.lib winmm.lib
ads_registerRecordDeviceDriver.obj : error LNK2019: unresolved external symbol pvar_dset_ai_DevSet referenced in function "void __cdecl `dynamic initializer for 'devsl''(void)" (??__Edevsl@@YAXXZ)
ads_registerRecordDeviceDriver.obj : error LNK2019: unresolved external symbol pvar_dset_ao_DevSet referenced in function "void __cdecl `dynamic initializer for 'devsl''(void)" (??__Edevsl@@YAXXZ)
...
ads_registerRecordDeviceDriver.obj : error LNK2019: unresolved external symbol pvar_func_devADSRegistrar referenced in function ads_registerRecordDeviceDriver
ads_registerRecordDeviceDriver.obj : error LNK2019: unresolved external symbol pvar_func_initTraceRegister referenced in function ads_registerRecordDeviceDriver
ads.exe : fatal error LNK1120: 12 unresolved externals
You are building for a static target (all the .lib paths above include windows-x64-static), but your adsSupport library is being linked into a library called TcAdsDll — is that available as a static library as well as a DLL? Were there any other warnings earlier when it built adsSupport? I suspect that for a static build you might need to add TcAdsDll to the set of libraries linked into the ads executable as well, but there is no evidence of that need yet (it might appear as soon you resolve the above linker errors though).

More directly does your devADS.cpp source file contain an epicsExportAddress() statement for each of the device support layers and an epicsExportRegistrar() statement for each registrar routine? Can you dump the symbols being exported from the devADS.obj file and see anything like the missing pvar_dset_* and pvar_func_* symbols listed above?

- Andrew

Makefile:

TOP=../..
include $(TOP)/configure/CONFIG

#=============================
# Build the IOC support library

LIBRARY_IOC += adsSupport

# Install devXxxSoft.dbd into <top>/dbd
DBD += adsSupport.dbd

# Compile and add the code to the support library
adsSupport_SRCS += devADS.cpp

# Link locally-provided code into the support library,
# rather than directly into the IOC application.

USR_CPPFLAGS += /std:c++latest

TcAdsDll_DIR += C:\TwinCAT\AdsApi\TcAdsDll\x64\lib
adsSupport_LIBS += TcAdsDll

adsSupport_LIBS += $(EPICS_BASE_IOC_LIBS)

#=============================
# Build the IOC application

PROD_IOC = ads
# ads.dbd will be created and installed
DBD += ads.dbd

# ads.dbd will be made up from these files:
ads_DBD += base.dbd

# Include dbd files from all support applications:
ads_DBD += adsSupport.dbd

# Add all the support libraries needed by this IOC
ads_LIBS += adsSupport

# ads_registerRecordDeviceDriver.cpp derives from ads.dbd
ads_SRCS += ads_registerRecordDeviceDriver.cpp

# Build the main IOC entry point on workstation OSs.
ads_SRCS_DEFAULT += adsMain.cpp

# Finally link to the EPICS Base libraries
ads_LIBS += $(EPICS_BASE_IOC_LIBS)

include $(TOP)/configure/RULES


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

Replies:
Re: registerRecordDeviceDriver.obj unresolved external symbols Mark Rivers via Tech-talk
References:
registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk

Navigate by Date:
Prev: registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk
Next: Re: registerRecordDeviceDriver.obj unresolved external symbols Mark Rivers 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk
Next: Re: registerRecordDeviceDriver.obj unresolved external symbols Mark Rivers 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  <20192020  2021  2022  2023  2024 
ANJ, 22 May 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·