epics-base / pvDataCPP

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

Problem building pvDataCPP with c++11 on macos #68

Closed ddamiani closed 5 years ago

ddamiani commented 5 years ago

I noticed a problem build pvData on macos when building with -std=c++11. It seems to be an issue with PVValueArray templates. It builds fine for me with clang and c++11 under linux.

Output from the build failure of testApp/misc/testSerialization.cpp is below. It compiles but the linking step fails:

c++           -DPVD_INTERNAL    -DUNIX  -Ddarwin     -O3 -g   -Wall    -std=c++11 -stdlib=libc++   -arch x86_64    -fno-common  -I. -I../O.Common -I. -I. -I.. -I../../testApp/misc -I../../testApp/pv -I../../testApp/property -I../../testApp/copy -I/Users/ddamiani/Workarea/epics-base/include/compiler/clang -I/Users/ddamiani/Workarea/epics-base/include/os/Darwin -I/Users/ddamiani/Workarea/epics-base/include -I/Users/ddamiani/Workarea/epics-base/include/compiler/clang -I/Users/ddamiani/Workarea/epics-base/include/os/Darwin -I/Users/ddamiani/Workarea/epics-base/include        -c ../../testApp/misc/testSerialization.cpp
c++ -o testSerialization  -L/Users/ddamiani/Workarea/epics-base/lib/darwin-x86        -arch x86_64            testSerialization.o    -lpvData -lCom   
Undefined symbols for architecture x86_64:
  "epics::pvData::PVValueArray<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::replace(epics::pvData::shared_vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<signed char>::replace(epics::pvData::shared_vector<signed char const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<char>::replace(epics::pvData::shared_vector<char const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<double>::replace(epics::pvData::shared_vector<double const, void> const&)", referenced from:
      _main in testSerialization.o
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<float>::replace(epics::pvData::shared_vector<float const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<unsigned char>::replace(epics::pvData::shared_vector<unsigned char const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<int>::replace(epics::pvData::shared_vector<int const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<unsigned int>::replace(epics::pvData::shared_vector<unsigned int const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<short>::replace(epics::pvData::shared_vector<short const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<unsigned short>::replace(epics::pvData::shared_vector<unsigned short const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<long long>::replace(epics::pvData::shared_vector<long long const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
  "epics::pvData::PVValueArray<unsigned long long>::replace(epics::pvData::shared_vector<unsigned long long const, void> const&)", referenced from:
      (anonymous namespace)::testArray() in testSerialization.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

MD: edit formatting

mdavidsaver commented 5 years ago

Can you try adding some more explicit template instantiations?

https://github.com/epics-base/pvDataCPP/blob/c2bc77a6498dfe6f1cad1b0a28680e81764779cc/src/factory/PVDataCreateFactory.cpp#L747-L751

eg. add:

template class PVValueArray<boolean>;
template class PVValueArray<int8>;
template class PVValueArray<uint8>;

And see if any of the errors go away.

ddamiani commented 5 years ago

That seems to have done the trick! I can submit a pull request with the changes if you like?

mdavidsaver commented 5 years ago

Please do!

On Sun, Jun 30, 2019, 2:35 PM Daniel Damiani notifications@github.com wrote:

That seems to have done the trick! I can submit a pull request with the changes if you like?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/epics-base/pvDataCPP/issues/68?email_source=notifications&email_token=ABBZLH3DPMF7TDDU7CJ5B4TP5ERKDA5CNFSM4H4MBX7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY4UIIQ#issuecomment-507069474, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBZLH5JRFBKVOJ3A2NI2W3P5ERKDANCNFSM4H4MBX7A .

mdavidsaver commented 5 years ago

Thanks.