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  <20152016  2017  2018  2019  2020  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  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Undefined symbol error when load VxWorks .much file
From: "J. Lewis Muir" <[email protected]>
To: EPICS Tech-Talk <[email protected]>
Date: Wed, 4 Nov 2015 17:11:00 -0600
On 11/4/15 3:09 PM, J. Lewis Muir wrote:
> Hello!
>
> I've got a VxWorks IOC that stops executing st.cmd as follows when it
> tries loading the .munch file:
>
> ---8<---
> cd topbin
> value = 0 = 0x0
> load("17lab.munch")
> Undefined symbol: snprintf (binding 1 type 0)
> ld error: Module contains undefined symbol(s) and may be unusable.
> value = 0 = 0x0
>
> Done executing startup script /ioc/boot/17lab/st.cmd
> 17lab>
> --->8---
>
> Does anyone know what's wrong or how to debug this?

The problem was that autosave 5-6-1 uses snprintf, and (I assume)
VxWorks 5 doesn't have that function.  Attached is a patch to change
snprintf to epicsSnprintf.  With the patch applied, my .munch file loads
successfully.

Thanks to Mark Rivers for helping me track this down!  Following his
suggestion, I was able to search the .a files of all the synApps modules
using nmppc for references to snprintf which led me to the culprit:
autosave.

Lewis
Don't use snprintf because VxWorks 5 does not have it.

--- asApp/src/dbrestore.c.orig	2015-03-04 13:46:17.000000000 -0600
+++ asApp/src/dbrestore.c	2015-11-04 16:24:35.440365068 -0600
@@ -87,6 +87,7 @@
 #include	<epicsExport.h>
 #include	<special.h>
 #include	<macLib.h>
+#include	<epicsStdio.h>
 #include	<epicsString.h>
 #include	<dbAccessDefs.h>
 
@@ -1632,7 +1633,7 @@
 	pitem = (struct buildInfoItem *)ellFirst(&buildInfoList);
 	for (; pitem; pitem = (struct buildInfoItem *)ellNext(&(pitem->node)) ) {
 		if (pitem->enabled) {
-			n = snprintf(requestFileName, MAXSTRING, "%s%s", requestFileBase, pitem->suffix);
+			n = epicsSnprintf(requestFileName, MAXSTRING, "%s%s", requestFileBase, pitem->suffix);
 			if ((n < MAXSTRING) && (openReqFile(requestFileName, NULL))) {
 				if (save_restoreDebug >= 5) {
 					printf("myDbLoadRecordsHook: found '%s'\n", requestFileName);
@@ -1650,7 +1651,7 @@
 						strcpy(macroString, emacroString);
 					}
 				}
-				n = snprintf(requestFileCmd, MAXSTRING, "file %s %s", requestFileName, macroString);
+				n = epicsSnprintf(requestFileCmd, MAXSTRING, "file %s %s", requestFileName, macroString);
 				if (n < MAXSTRING) appendToFile(pitem->filename, requestFileCmd);
 			}
 		}

References:
Undefined symbol error when load VxWorks .much file J. Lewis Muir

Navigate by Date:
Prev: RE: Undefined symbol error when load VxWorks .much file Mark Rivers
Next: Re: Undefined symbol error when load VxWorks .much file J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Undefined symbol error when load VxWorks .much file Pete Jemian
Next: Building Epics base 3.15.2 in Windows 7 Klyachko, Alexander Vitalievich
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·