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  2019  2020  2021  <20222023  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  2019  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: linking problem with str::tr1::shared_ptr
From: Francisco Ramos via Tech-talk <tech-talk at aps.anl.gov>
To: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Mon, 4 Apr 2022 16:20:17 -0400
Hello Community, 

    I am writing to see if you could help us with the following problem we have. After making a merge between an old version and a new one (our c++ code) that now uses EPICS 7 (7.0.6.2-DEV), we get a compilation error in the linking process, that is, the library compiles correctly but when we try to compile the examples we get the error "libgiapi-glue-cc. so: undefined reference to `epics::pvDatabase::PVDatabase::addRecord(std::shared_ptr<epics::pvDatabase::PVRecord> const&)'"".

     Analysing the built library (libgiapi-glue-cc.so.0.16) to see the symbols defined, we have used the nm tool. We can see that the addRecord function requires the std::shared::ptr parameter (it must be defined in the libpvDatabase.so.4.6.1 library). The output of the nm command is copied below.
 nm --format sysv libgiapi-glue-cc.so.0.16 | c++filt | grep addR
epics::pvDatabase::PVDatabase::addRecord(std::shared_ptr<epics::pvDatabase::PVRecord> const&)| | | U | NOTYPE| | |*UND*

     Now, if we analyze the EPICS library libpvDatabase.so.4.6.1, we get that the "addRecord" function requires the parameter std::tr1::shared_ptr instead of std::shared_ptr. The output of the nm command is copied below.
epics::pvDatabase::PVDatabase::addRecord(std::tr1::shared_ptr<epics::pvDatabase::PVRecord> const&)| |000000000004c120| T | FUNC|0000000000000370| | |.text

    If we analyze the source code, we can see that the PVImageRecordPtr type has been defined with std::tr1::shared_ptr. Below you can se the code extract or in the following link(https://github.com/framos-gemini/giapi-glue-cc/blob/peterMerge/src/data/PVImageAgent.h, line 136 and 250)
     class PVImageRecord;
      typedef std::tr1::shared_ptr<PVImageRecord> PVImageRecordPtr;
      PVImageRecordPtr pvImageRecord;

     Next, the PVImageRecord class inherits from the epics::pvDatabase::PVRecord class, which defines the create method. Below is a small fragment of the code: (https://github.com/framos-gemini/giapi-glue-cc/blob/peterMerge/src/data/PVImageAgent.cpp).

  class PVImageRecord: public epics::pvDatabase::PVRecord {
  public:
      POINTER_DEFINITIONS(PVImageRecord);
      static PVImageRecordPtr create(std::string const & recordName, LoggerPtr lg)

      In the same PVImageAgent.cpp file, line 606, is where the record is introduced. As you can see, the addRecord function is being called with the std::tr1::shared_ptr type (PVImageRecordPtr pvImageRecord) instead of std::shared_ptr. Therefore, it is strange what is happening. Any suggestions?

       Thank you in advance and also for the good responses that have allowed us to move forward. 

Regards,

Replies:
Re: linking problem with str::tr1::shared_ptr Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Re: Communication error Francisco Ramos via Tech-talk
Next: Re: linking problem with str::tr1::shared_ptr Michael Davidsaver 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  2019  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: Job opportunity at CEA Saclay LOTRUS Paul via Tech-talk
Next: Re: linking problem with str::tr1::shared_ptr Michael Davidsaver 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  2019  2020  2021  <20222023  2024 
ANJ, 14 Sep 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·