epics-base / pvDataCPP

pvDataCPP is an EPICS V4 C++ module
https://epics-base.github.io/pvDataCPP/
Other
6 stars 16 forks source link

This file needs to have the epicsExportSharedSymbols define cached in… #37

Closed pheest closed 8 years ago

pheest commented 8 years ago

… order to build correctly in a debug build.

Otherwise epicsThreadRunable is a multiply defined symbol.

epics-jenkins commented 8 years ago

Can one of the admins verify this patch?

epics-jenkins commented 8 years ago

Can one of the admins verify this patch?

ralphlange commented 8 years ago

ok to test

anjohnson commented 8 years ago

Which source file results in epicsThreadRunnable multiply defined? IMHO the correct fix should be to add #include <epicsThread.h> to that file above the #define epicsSharedSymbols, not to modify the pv/thread.h header file.

I have been slowly removing the caching of epicsSharedSymbols from the V4 headers because the cacheing approach makes it very hard to determine which source file contains the bad switch/include order. In this case I removed it in commit 605d4e99b92376cc3bb4a5502adcc9b40a4bb6be.

anjohnson commented 8 years ago

@ralphlange please check this job on Cloudbees when you get a chance, this PR check failed to find Peter's branch. I don't know how that's all supposed to work...

pheest commented 8 years ago

Hi Andrew,

The debug build log is attached. This was the only build error I could detect from the code which I pulled and forked on Friday.

A release build doesn’t generate this error (I still don’t understand why a debug build is more sensitive).

Cheers,

Peter.

From: Andrew Johnson [mailto:notifications@github.com] Sent: 10 May 2016 17:29 To: epics-base/pvDataCPP Cc: Heesterman, Peter J; Author Subject: Re: [epics-base/pvDataCPP] This file needs to have the epicsExportSharedSymbols define cached in… (#37)

Which source file results in epicsThreadRunnable multiply defined? IMHO the correct fix should be to add #include to that file above the #define epicsSharedSymbols, not to modify the pv/thread.h header file.

I have been slowly removing the caching of epicsSharedSymbols from the V4 headers because the cacheing approach makes it very hard to determine which source file contains the bad switch/include order. In this case I removed it in commit 605d4e9https://github.com/epics-base/pvDataCPP/commit/605d4e99b92376cc3bb4a5502adcc9b40a4bb6be.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHubhttps://github.com/epics-base/pvDataCPP/pull/37#issuecomment-218213632

anjohnson commented 8 years ago
link -nologo /subsystem:windows /dll -debug -incremental:no -fixed:no      -out:pvData.dll -implib:pvData.lib         byteBuffer.obj bitSet.obj epicsException.obj requester.obj serializeHelper.obj event.obj executor.obj timeFunction.obj timer.obj status.obj messageQueue.obj localStaticLock.obj typeCast.obj parseToPOD.obj TypeFunc.obj FieldCreateFactory.obj PVField.obj PVScalar.obj PVArray.obj PVScalarArray.obj PVStructure.obj PVStructureArray.obj PVUnion.obj PVUnionArray.obj PVDataCreateFactory.obj Convert.obj pvSubArrayCopy.obj Compare.obj StandardField.obj StandardPVField.obj printer.obj alarm.obj pvAlarm.obj pvControl.obj pvDisplay.obj pvEnumerated.obj timeStamp.obj pvTimeStamp.obj createRequest.obj pvCopy.obj bitSetUtil.obj monitor.obj monitorPlugin.obj     \EPICS/base/lib/win32-x86-debug/Com.lib  
Com.lib(Com.dll) : error LNK2005: "public: __thiscall epicsThreadRunable::epicsThreadRunable(void)" (??0epicsThreadRunable@@QAE@XZ) already defined in executor.obj
   Creating library pvData.lib and object pvData.exp
pvData.dll : fatal error LNK1169: one or more multiply defined symbols found

So the above error message tells me immediately that the problem should be fixed in executor.cpp. The epicsThreadRunnable class is defined in epicsThread.h so that's what needs including above the #define epicsExportSharedSymbols line. Looking at the other includes found in executor.h we'll also want to add epicsEvent.h and epicsMutex.h, so here's the change that I would prefer to apply:

diff --git a/src/misc/executor.cpp b/src/misc/executor.cpp
index d41f16e..4f46df4 100644
--- a/src/misc/executor.cpp
+++ b/src/misc/executor.cpp
@@ -13,6 +13,10 @@
 #include <string>
 #include <cstdio>

+#include <epicsEvent.h>
+#include <epicsMutex.h>
+#include <epicsThread.h>
+
 #define epicsExportSharedSymbols
 #include <pv/executor.h>

@pheest Could you check that this change fixes your builds instead of the modification to pv/thread.h. Thanks.

ralphlange commented 8 years ago

retest this please

dhickin commented 8 years ago

Replaced by #40 (merged), which fixes issue using Andrew's preferred method, so closing without merging.