Hello World example fails to link

5 posts / 0 new
Last post
apm
Offline
Last seen: 1 week 5 days ago
Joined: 11/15/2021
Posts: 2
Hello World example fails to link

I'm trying to get the "2_hello_world" example program built on a Centos 7 (7.9.2009 (Core)) using the 6.1.0 release.  I was following the "Modern C++" path in the Tutorial (https://community.rti.com/static/documentation/connext-dds/6.1.0/doc/manuals/connext_dds_professional/getting_started_guide/cpp11/intro_pubsub_cpp.html)

I've got rti_connext_dds-6.1.0-pro-host-x64Linux installed and the rti_connext_dds-6.1.0-pro-target-x64Linux4gcc7.3.0 target library installed and a valid license file in my ~/rti_connext_dds-6.1.0 directory.

I'm using devtoolset-7, so my gcc version is 7.3.1.

I have my .bashrc file source-ing the rti_connext_dds-6.1.0/resource/scripts/rtisetenv_x64Linux4gcc7.3.0.bashscript to set the required PATH and ENV vars.

I run rtiddsgen -language c++11 -platform x64Linux4gcc7.3.0 -create makefiles -create typefiles -d c++11 hello_world.idl from the "2_hello_world" directory. 

Then I run the generated makefile from the c++11 directory make -f makefile_hello_world_x64Linux4gcc7.3.0


Then I get a long list of undefined references during the link process.

Checking directory objs
Making directory objs
Checking directory objs/x64Linux4gcc7.3.0
Making directory objs/x64Linux4gcc7.3.0
g++ -m64 -Wall  -std=c++14 -o objs/x64Linux4gcc7.3.0/hello_worldPlugin.o -DRTI_UNIX -DRTI_LINUX -DRTI_64BIT  -DRTI_STATIC -I. -I/home/apm/rti_connext_dds-6.1.0/include -I/home/apm/rti_connext_dds-6.1.0/include/ndds -I/home/apm/rti_connext_dds-6.1.0/include/ndds/hpp  -c hello_worldPlugin.cxx
g++ -m64 -Wall  -std=c++14 -o objs/x64Linux4gcc7.3.0/hello_world.o -DRTI_UNIX -DRTI_LINUX -DRTI_64BIT  -DRTI_STATIC -I. -I/home/apm/rti_connext_dds-6.1.0/include -I/home/apm/rti_connext_dds-6.1.0/include/ndds -I/home/apm/rti_connext_dds-6.1.0/include/ndds/hpp  -c hello_world.cxx
g++ -m64 -Wall  -std=c++14 -o objs/x64Linux4gcc7.3.0/hello_world_subscriber.o -DRTI_UNIX -DRTI_LINUX -DRTI_64BIT  -DRTI_STATIC -I. -I/home/apm/rti_connext_dds-6.1.0/include -I/home/apm/rti_connext_dds-6.1.0/include/ndds -I/home/apm/rti_connext_dds-6.1.0/include/ndds/hpp  -c hello_world_subscriber.cxx
g++ -m64 -Wall  -std=c++14 -o objs/x64Linux4gcc7.3.0/hello_world_publisher.o -DRTI_UNIX -DRTI_LINUX -DRTI_64BIT  -DRTI_STATIC -I. -I/home/apm/rti_connext_dds-6.1.0/include -I/home/apm/rti_connext_dds-6.1.0/include/ndds -I/home/apm/rti_connext_dds-6.1.0/include/ndds/hpp  -c hello_world_publisher.cxx
g++ -m64  -o objs/x64Linux4gcc7.3.0/hello_world_subscriber objs/x64Linux4gcc7.3.0/hello_world_subscriber.o objs/x64Linux4gcc7.3.0/hello_worldPlugin.o objs/x64Linux4gcc7.3.0/hello_world.o -L/home/apm/rti_connext_dds-6.1.0/lib/x64Linux4gcc7.3.0 -lnddscpp2z -lnddscz -lnddscorez -ldl -lm -lpthread -lrt -no-pie -rdynamic
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::core::Entity::assert_not_closed() const':
hello_world_subscriber.cxx:(.text._ZNK3rti4core6Entity17assert_not_closedEv[_ZNK3rti4core6Entity17assert_not_closedEv]+0x67): undefined reference to `dds::core::AlreadyClosedError::AlreadyClosedError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::sub::LoanedSample<HelloWorld>::data() const':
hello_world_subscriber.cxx:(.text._ZNK3rti3sub12LoanedSampleI10HelloWorldE4dataEv[_ZNK3rti3sub12LoanedSampleI10HelloWorldE4dataEv]+0x63): undefined reference to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `dds::core::Reference<rti::core::cond::StatusCondition>::extensions()':
hello_world_subscriber.cxx:(.text._ZN3dds4core9ReferenceIN3rti4core4cond15StatusConditionEE10extensionsEv[_ZN3dds4core9ReferenceIN3rti4core4cond15StatusConditionEE10extensionsEv]+0x58): undefined reference to `dds::core::NullReferenceError::NullReferenceError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::topic::TopicImpl<HelloWorld>::TopicImpl(dds::domain::TDomainParticipant<rti::domain::DomainParticipantImpl> const&, std::string const&)':
hello_world_subscriber.cxx:(.text._ZN3rti5topic9TopicImplI10HelloWorldEC1ERKN3dds6domain18TDomainParticipantINS_6domain21DomainParticipantImplEEERKSs[_ZN3rti5topic9TopicImplI10HelloWorldEC1ERKN3dds6domain18TDomainParticipantINS_6domain21DomainParticipantImplEEERKSs]+0x9c): undefined reference to `rti::topic::UntypedTopicDescription::UntypedTopicDescription(std::pair<std::pair<DDS_EntityImpl*, bool>, DDS_TopicDescriptionImpl*> const&, dds::domain::TDomainParticipant<rti::domain::DomainParticipantImpl> const&, std::string const&, std::string const&, rtiboost::shared_ptr<rti::core::detail::ListenerHolder>)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `std::pair<std::pair<DDS_EntityImpl*, bool>, DDS_TopicDescriptionImpl*> rti::topic::detail::create_native_topic<HelloWorld>(dds::domain::TDomainParticipant<rti::domain::DomainParticipantImpl> const&, std::string const&, std::string const&, dds::core::TEntityQos<rti::topic::qos::TopicQosImpl> const*, dds::topic::TopicListener<HelloWorld>*, dds::core::status::StatusMask const&)':
hello_world_subscriber.cxx:(.text._ZN3rti5topic6detail19create_native_topicI10HelloWorldEESt4pairIS4_IP14DDS_EntityImplbEP24DDS_TopicDescriptionImplERKN3dds6domain18TDomainParticipantINS_6domain21DomainParticipantImplEEERKSsSK_PKNSB_4core10TEntityQosINS0_3qos12TopicQosImplEEEPNSB_5topic13TopicListenerIT_EERKNSL_6status10StatusMaskE[_ZN3rti5topic6detail19create_native_topicI10HelloWorldEESt4pairIS4_IP14DDS_EntityImplbEP24DDS_TopicDescriptionImplERKN3dds6domain18TDomainParticipantINS_6domain21DomainParticipantImplEEERKSsSK_PKNSB_4core10TEntityQosINS0_3qos12TopicQosImplEEEPNSB_5topic13TopicListenerIT_EERKNSL_6status10StatusMaskE]+0x82): undefined reference to `rti::topic::detail::create_native_topic_untyped(dds::domain::TDomainParticipant<rti::domain::DomainParticipantImpl> const&, std::string const&, std::string const&, dds::core::TEntityQos<rti::topic::qos::TopicQosImpl> const*, DDS_TopicListener*, dds::core::status::StatusMask const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::core::detail::RetainableType<rti::core::Entity, 2ul>::get_reference() const':
hello_world_subscriber.cxx:(.text._ZNK3rti4core6detail14RetainableTypeINS0_6EntityELm2EE13get_referenceEv[_ZNK3rti4core6detail14RetainableTypeINS0_6EntityELm2EE13get_referenceEv]+0x73): undefined reference to `dds::core::AlreadyClosedError::AlreadyClosedError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::topic::detail::TopicListenerForwarder<dds::topic::Topic<HelloWorld, rti::topic::TopicImpl>, dds::topic::TopicListener<HelloWorld> >::inconsistent_topic_forward(void*, DDS_TopicWrapperI*, DDS_InconsistentTopicStatus const*)':
hello_world_subscriber.cxx:(.text._ZN3rti5topic6detail22TopicListenerForwarderIN3dds5topic5TopicI10HelloWorldNS0_9TopicImplEEENS4_13TopicListenerIS6_EEE26inconsistent_topic_forwardEPvP17DDS_TopicWrapperIPK27DDS_InconsistentTopicStatus[_ZN3rti5topic6detail22TopicListenerForwarderIN3dds5topic5TopicI10HelloWorldNS0_9TopicImplEEENS4_13TopicListenerIS6_EEE26inconsistent_topic_forwardEPvP17DDS_TopicWrapperIPK27DDS_InconsistentTopicStatus]+0x64): undefined reference to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::sub::detail::DataReaderListenerForwarder<dds::sub::DataReader<HelloWorld, rti::sub::DataReaderImpl>, dds::sub::DataReaderListener<HelloWorld> >::requested_deadline_missed_forward(void*, DDS_DataReaderImpl*, DDS_RequestedDeadlineMissedStatus const*)':
hello_world_subscriber.cxx:(.text._ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE33requested_deadline_missed_forwardEPvP18DDS_DataReaderImplPK33DDS_RequestedDeadlineMissedStatus[_ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE33requested_deadline_missed_forwardEPvP18DDS_DataReaderImplPK33DDS_RequestedDeadlineMissedStatus]+0x70): undefined reference to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::sub::detail::DataReaderListenerForwarder<dds::sub::DataReader<HelloWorld, rti::sub::DataReaderImpl>, dds::sub::DataReaderListener<HelloWorld> >::requested_incompatible_qos_forward(void*, DDS_DataReaderImpl*, DDS_RequestedIncompatibleQosStatus const*)':
hello_world_subscriber.cxx:(.text._ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE34requested_incompatible_qos_forwardEPvP18DDS_DataReaderImplPK34DDS_RequestedIncompatibleQosStatus[_ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE34requested_incompatible_qos_forwardEPvP18DDS_DataReaderImplPK34DDS_RequestedIncompatibleQosStatus]+0x7c): undefined reference to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::sub::detail::DataReaderListenerForwarder<dds::sub::DataReader<HelloWorld, rti::sub::DataReaderImpl>, dds::sub::DataReaderListener<HelloWorld> >::sample_rejected_forward(void*, DDS_DataReaderImpl*, DDS_SampleRejectedStatus const*)':
hello_world_subscriber.cxx:(.text._ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE23sample_rejected_forwardEPvP18DDS_DataReaderImplPK24DDS_SampleRejectedStatus[_ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE23sample_rejected_forwardEPvP18DDS_DataReaderImplPK24DDS_SampleRejectedStatus]+0x70): undefined reference to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::sub::detail::DataReaderListenerForwarder<dds::sub::DataReader<HelloWorld, rti::sub::DataReaderImpl>, dds::sub::DataReaderListener<HelloWorld> >::liveliness_changed_forward(void*, DDS_DataReaderImpl*, DDS_LivelinessChangedStatus const*)':
hello_world_subscriber.cxx:(.text._ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE26liveliness_changed_forwardEPvP18DDS_DataReaderImplPK27DDS_LivelinessChangedStatus[_ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE26liveliness_changed_forwardEPvP18DDS_DataReaderImplPK27DDS_LivelinessChangedStatus]+0x70): undefined reference to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o:hello_world_subscriber.cxx:(.text._ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE22data_available_forwardEPvP18DDS_DataReaderImpl[_ZN3rti3sub6detail27DataReaderListenerForwarderIN3dds3sub10DataReaderI10HelloWorldNS0_14DataReaderImplEEENS4_18DataReaderListenerIS6_EEE22data_available_forwardEPvP18DDS_DataReaderImpl]+0x5d): more undefined references to `dds::core::PreconditionNotMetError::PreconditionNotMetError(std::string const&)' follow
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::core::detail::get_ptr_from_native_entity<rti::topic::TopicImpl<HelloWorld>, DDS_TopicWrapperI>::do_it(DDS_TopicWrapperI*)':
hello_world_subscriber.cxx:(.text._ZN3rti4core6detail26get_ptr_from_native_entityINS_5topic9TopicImplI10HelloWorldEE17DDS_TopicWrapperIE5do_itEPS7_[_ZN3rti4core6detail26get_ptr_from_native_entityINS_5topic9TopicImplI10HelloWorldEE17DDS_TopicWrapperIE5do_itEPS7_]+0xdb): undefined reference to `dds::core::InvalidDowncastError::InvalidDowncastError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::core::detail::get_ptr_from_native_entity<rti::sub::DataReaderImpl<HelloWorld>, DDS_DataReaderImpl>::do_it(DDS_DataReaderImpl*)':
hello_world_subscriber.cxx:(.text._ZN3rti4core6detail26get_ptr_from_native_entityINS_3sub14DataReaderImplI10HelloWorldEE18DDS_DataReaderImplE5do_itEPS7_[_ZN3rti4core6detail26get_ptr_from_native_entityINS_3sub14DataReaderImplI10HelloWorldEE18DDS_DataReaderImplE5do_itEPS7_]+0xdb): undefined reference to `dds::core::InvalidDowncastError::InvalidDowncastError(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `rti::sub::DataReaderImpl<HelloWorld>::close_impl(bool)':
hello_world_subscriber.cxx:(.text._ZN3rti3sub14DataReaderImplI10HelloWorldE10close_implEb[_ZN3rti3sub14DataReaderImplI10HelloWorldE10close_implEb]+0x77): undefined reference to `rti::topic::is_builtin_topic(std::string const&)'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `dds::topic::TopicDescription<HelloWorld, rti::topic::TopicDescriptionImpl>::name() const':
hello_world_subscriber.cxx:(.text._ZNK3dds5topic16TopicDescriptionI10HelloWorldN3rti5topic20TopicDescriptionImplEE4nameEv[_ZNK3dds5topic16TopicDescriptionI10HelloWorldN3rti5topic20TopicDescriptionImplEE4nameEv]+0x35): undefined reference to `rti::topic::UntypedTopicDescription::name() const'
objs/x64Linux4gcc7.3.0/hello_world_subscriber.o: In function `dds::topic::TopicDescription<HelloWorld, rti::topic::TopicDescriptionImpl>::type_name() const':
hello_world_subscriber.cxx:(.text._ZNK3dds5topic16TopicDescriptionI10HelloWorldN3rti5topic20TopicDescriptionImplEE9type_nameEv[_ZNK3dds5topic16TopicDescriptionI10HelloWorldN3rti5topic20TopicDescriptionImplEE9type_nameEv]+0x35): undefined reference to `rti::topic::UntypedTopicDescription::type_name() const'
objs/x64Linux4gcc7.3.0/hello_world.o: In function `dds::topic::topic_type_support<HelloWorld>::register_type(dds::domain::TDomainParticipant<rti::domain::DomainParticipantImpl>&, std::string const&)':
hello_world.cxx:(.text+0x1ec): undefined reference to `rti::domain::register_type_plugin(dds::domain::TDomainParticipant<rti::domain::DomainParticipantImpl>&, std::string const&, PRESTypePlugin* (*)(), void (*)(PRESTypePlugin*))'
collect2: error: ld returned 1 exit status
make: *** [makefile_hello_world_x64Linux4gcc7.3.0:95: objs/x64Linux4gcc7.3.0/hello_world_subscriber] Error 1

 


My LD_LIBRARY_PATH env includes the ~/rti_connext_dds-6.1.0/lib/x64Linux4gcc7.3.0 directory, which contains a whole list of .so & .a files so it seems like this should *just work*, but it doesn't.  Any ideas and what's going wrong?

Note I created/configured the CentOS instance myself and I'm not a native Linux person, so possible the configuration issue is something I did prior to installing Connext 6.1.0, but I was also able to build CMake from source without issues so I think in general I have a functioning Linux system...

 

 

 

Offline
Last seen: 4 days 14 hours ago
Joined: 09/23/2018
Posts: 44

Everything looks good there but can you try this simplified process instead:

rtiddsgen -language c++11 -example x64Linux4gcc7.3.0 hello_world.idl

make -f makefile_hello_world_x64Linux4gcc7.3.0

 

This assumes the hello_world.idl contains the equivalent of (shouldn't matter):

const long HELLODDS_MAX_PAYLOAD_SIZE = 8192;
const long HELLODDS_MAX_STRING_SIZE = 64;

struct HelloWorld {
string<HELLODDS_MAX_STRING_SIZE> prefix;
long sampleId;
sequence<octet, HELLODDS_MAX_PAYLOAD_SIZE> payload;
};

 Can you also do an   'env | grep NDDSHOME' and 'env | grep LD_LIBRARY_PATH'  to ensure the  rtisetenv_x64Linux4gcc7.3.0.bash sourced correctly. 

 

[UPDATE] 

It looks like on CentOS 7,  the tested platform is  x64Linux3gcc4.8.2 so that is probably the issue.  In my case, I was testing on a Ubuntu 20.04 LTS machine which was tested against x64Linux4gcc7.3.0.

If the goal is to experiment with the tutorials, you might consider using Ubuntu 20.04 or CentoOS 8 -- both platforms have been tested on the x64Linux4gcc7.3.0.

 

 

PK_RTI's picture
Offline
Last seen: 1 week 3 days ago
Joined: 07/01/2021
Posts: 11

For CentOS 7, we also have validated target libraries (x64Linux3gcc4.8.2) if you'd like to keep using your desired Linux distro and utilize Connext 6.1.0. Just let us know which you'd prefer.

apm
Offline
Last seen: 1 week 5 days ago
Joined: 11/15/2021
Posts: 2

Thanks, can confirm Hello World compiles and links if I'm using CentOS 8.  If only CentOS 8 wasn't being EOL'd at the end of this year or we could use GCC 4.x as our target on Centos 7.  No other good options?  

PK_RTI's picture
Offline
Last seen: 1 week 3 days ago
Joined: 07/01/2021
Posts: 11

We have Connext Pro libraries validated for CentOS 6 (x64Linux2.6gcc4.4.5), CentOS 7 (x64Linux3gcc4.8.2) and CentOS 8 (x64Linux4gcc7.3.0). We validate with the gcc shipping on the distro, as that's what customers typically utilize.

If you require a validated library for a different combination of gcc and Linux kernel/library versions, your local FAE can work with you directly and determine what it would take to accomplish that. If you could let us know where you are located, I'm happy to get you in touch with your local FAE. We can typically get Linux distributions/libraries/gcc versions sorted out fairly quickly.

Thanks, PK