Hey guys,
we are in the process of upgrading from 5.2.3 to 6.0.1. In trying to build a codebase that built under the previous RTI version, I'm getting a linker error that I can't solve. The main change is the RTI version upgrade, but we're also doing this on a newly built machine and OS load. I believe I have all the environment variables set correctly, but not 100% sure, so that could be a possible cause. Are there code changes we need to make? I looked through the Migration Guide and didn't see anything related to this. The link error is in the Distributed Logger debug library and references an RTI code file, see below:
g++ -m64 -static-libgcc -o model_controller.app main.o -L../../../../lib/platforms/linux_x86_64 -lmodeler -lcommand_control_data_type_support ...[snip lots of unrelated libraries]... -L /opt/rti_connext_dds-6.0.1/lib/x64Linux3gcc4.8.2/ -lnddscpp2zd -lnddscppzd -lnddsczd -lnddscorezd -L/opt/rti_connext_dds-6.0.1/lib/x64Linux3gcc4.8.2/ -lrtidlcppzd -lrtidlczd -L/opt/rti_connext_dds-6.0.1/lib/x64Linux3gcc4.8.2/ -lrtimonitoringzd -ldl -lnsl -lm -lpthread -lrt
/opt/rti_connext_dds-6.0.1/lib/x64Linux3gcc4.8.2//librtidlcppzd.a(DistLogger.o): In function `RTI_DLDistLogger::RTI_DLDistLogger()': /home/build3/rti/waveworks/ndds601/connextdds/distributed_log.1.0/srcCxx/distlogger/DistLogger.cxx:53: undefined reference to `DDSDomainParticipantFactory::get_instance()'
collect2: error: ld returned 1 exit status
Thank you for your assistance,
Craig Wilson
I think you need to change the order of the libraries on the link line. "-lrtidlcppzd lrtidlcz" need to be first. Usually you need to put the libraries in dependency order.
If liba uses functions in libb, then the link order should be "-lliba -libb".
Switching the order of the libraries worked! Thanks a lot Howard, that didn't occur to me at all.