eProsima / Fast-DDS

The most complete DDS - Proven: Plenty of success cases. Looking for commercial support? Contact info@eprosima.com
https://eprosima.com
Apache License 2.0
2.14k stars 763 forks source link

FastDDS build error; linker error on TinyXML2 following build instructions #1611

Closed ghostravenstorm closed 3 years ago

ghostravenstorm commented 3 years ago

I followed the setup and build instructions to the key, and cmake --build . --target install ran into linker errors on TinyXML2 after I have installed it via choclately.

Steps I took to build: Start a fresh Windows 10 VM Download and install CMake 3.19, VS 2015 update 3, Chocolatey, gitbash for Windows Download ASIO and TinyXML2 NuGet packages as outlined in the readme, and install them via Chocolatey. Clone foonathan_memory_vendor via gitbash and install it via CMake Clone Fast-CDR via gitbash and install it via CMake Clone Fast-DDS via gitbash and install it via CMake Observe error LNK2019 referencing TinyXML2.

Expectation: There should not be a linker error on Tiny XML2 since I took the steps to install the NuGet package.

  Creating library H:/Vcom3D/AMM/Repos/eProsima/Fast-DDS/build/src/cpp/Debug/fastrtpsd-2.0.lib and object H:/Vcom3D/AMM/Repos/eProsima/Fast-DDS/build/src/cpp/Debug/fastrtpsd-2.0.exp
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLNode::Value(void)const " (?Value@XMLNode@tinyxml2@@QBEPBDXZ) referenced in function "protected: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::getXMLEnum(class tinyxml2::XMLElement *,enum eprosima::fastrtps::IntraprocessDeliveryType *,unsigned char)" (?getXMLEnum@XMLParser@xmlparser@fastrtps@eprosima@@KA?AW4XMLP_ret@234@PAVXMLElement@tinyxml2@@PAW4IntraprocessDeliveryType@34@E@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLNode::Value(void)const " (?Value@XMLNode@tinyxml2@@QBEPBDXZ) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLNode::Value(void)const " (?Value@XMLNode@tinyxml2@@QBEPBDXZ) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: class tinyxml2::XMLElement const * __thiscall tinyxml2::XMLNode::FirstChildElement(char const *)const " (?FirstChildElement@XMLNode@tinyxml2@@QBEPBVXMLElement@2@PBD@Z) referenced in function "public: class tinyxml2::XMLElement * __thiscall tinyxml2::XMLNode::FirstChildElement(char const *)" (?FirstChildElement@XMLNode@tinyxml2@@QAEPAVXMLElement@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2001: unresolved external symbol "public: class tinyxml2::XMLElement const * __thiscall tinyxml2::XMLNode::FirstChildElement(char const *)const " (?FirstChildElement@XMLNode@tinyxml2@@QBEPBVXMLElement@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: class tinyxml2::XMLElement const * __thiscall tinyxml2::XMLNode::FirstChildElement(char const *)const " (?FirstChildElement@XMLNode@tinyxml2@@QBEPBVXMLElement@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: class tinyxml2::XMLElement const * __thiscall tinyxml2::XMLNode::NextSiblingElement(char const *)const " (?NextSiblingElement@XMLNode@tinyxml2@@QBEPBVXMLElement@2@PBD@Z) referenced in function "public: class tinyxml2::XMLElement * __thiscall tinyxml2::XMLNode::NextSiblingElement(char const *)" (?NextSiblingElement@XMLNode@tinyxml2@@QAEPAVXMLElement@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2001: unresolved external symbol "public: class tinyxml2::XMLElement const * __thiscall tinyxml2::XMLNode::NextSiblingElement(char const *)const " (?NextSiblingElement@XMLNode@tinyxml2@@QBEPBVXMLElement@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: class tinyxml2::XMLElement const * __thiscall tinyxml2::XMLNode::NextSiblingElement(char const *)const " (?NextSiblingElement@XMLNode@tinyxml2@@QBEPBVXMLElement@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLElement::Attribute(char const *,char const *)const " (?Attribute@XMLElement@tinyxml2@@QBEPBDPBD0@Z) referenced in function "protected: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::getXMLRemoteServer(class tinyxml2::XMLElement *,class eprosima::fastrtps::rtps::RemoteServerAttributes &,unsigned char)" (?getXMLRemoteServer@XMLParser@xmlparser@fastrtps@eprosima@@KA?AW4XMLP_ret@234@PAVXMLElement@tinyxml2@@AAVRemoteServerAttributes@rtps@34@E@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLElement::Attribute(char const *,char const *)const " (?Attribute@XMLElement@tinyxml2@@QBEPBDPBD0@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLElement::Attribute(char const *,char const *)const " (?Attribute@XMLElement@tinyxml2@@QBEPBDPBD0@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLElement::GetText(void)const " (?GetText@XMLElement@tinyxml2@@QBEPBDXZ) referenced in function "protected: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::getXMLEnum(class tinyxml2::XMLElement *,enum eprosima::fastrtps::IntraprocessDeliveryType *,unsigned char)" (?getXMLEnum@XMLParser@xmlparser@fastrtps@eprosima@@KA?AW4XMLP_ret@234@PAVXMLElement@tinyxml2@@PAW4IntraprocessDeliveryType@34@E@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLElement::GetText(void)const " (?GetText@XMLElement@tinyxml2@@QBEPBDXZ) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLElement::GetText(void)const " (?GetText@XMLElement@tinyxml2@@QBEPBDXZ) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryIntText(int *)const " (?QueryIntText@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PAH@Z) referenced in function "protected: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::getXMLInt(class tinyxml2::XMLElement *,int *,unsigned char)" (?getXMLInt@XMLParser@xmlparser@fastrtps@eprosima@@KA?AW4XMLP_ret@234@PAVXMLElement@tinyxml2@@PAHE@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryUnsignedText(unsigned int *)const " (?QueryUnsignedText@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PAI@Z) referenced in function "protected: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::getXMLUint(class tinyxml2::XMLElement *,unsigned int *,unsigned char)" (?getXMLUint@XMLParser@xmlparser@fastrtps@eprosima@@KA?AW4XMLP_ret@234@PAVXMLElement@tinyxml2@@PAIE@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLElementParser.obj : error LNK2019: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryBoolText(bool *)const " (?QueryBoolText@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PA_N@Z) referenced in function "protected: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::getXMLBool(class tinyxml2::XMLElement *,bool *,unsigned char)" (?getXMLBool@XMLParser@xmlparser@fastrtps@eprosima@@KA?AW4XMLP_ret@234@PAVXMLElement@tinyxml2@@PA_NE@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2019: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLAttribute::QueryIntValue(int *)const " (?QueryIntValue@XMLAttribute@tinyxml2@@QBE?AW4XMLError@2@PAH@Z) referenced in function "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryIntAttribute(char const *,int *)const " (?QueryIntAttribute@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PBDPAH@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2019: unresolved external symbol "public: class tinyxml2::XMLAttribute const * __thiscall tinyxml2::XMLElement::FindAttribute(char const *)const " (?FindAttribute@XMLElement@tinyxml2@@QBEPBVXMLAttribute@2@PBD@Z) referenced in function "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLElement::QueryIntAttribute(char const *,int *)const " (?QueryIntAttribute@XMLElement@tinyxml2@@QBE?AW4XMLError@2@PBDPAH@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj] XMLEndpointParser.obj : error LNK2019: unresolved external symbol "public: __thiscall tinyxml2::XMLDocument::XMLDocument(bool,enum tinyxml2::Whitespace)" (??0XMLDocument@tinyxml2@@QAE@_NW4Whitespace@1@@Z) referenced in function "public: enum eprosima::fastrtps::xmlparser::XMLP_ret __thiscall eprosima::fastrtps::xmlparser::XMLEndpointParser::loadXMLFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?loadXMLFile@XMLEndpointParser@xmlparser@fastrtps@eprosima@@QAE?AW4XMLP_ret@234@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: __thiscall tinyxml2::XMLDocument::XMLDocument(bool,enum tinyxml2::Whitespace)" (??0XMLDocument@tinyxml2@@QAE@_NW4Whitespace@1@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall tinyxml2::XMLDocument::~XMLDocument(void)" (??1XMLDocument@tinyxml2@@UAE@XZ) referenced in function "public: enum eprosima::fastrtps::xmlparser::XMLP_ret __thiscall eprosima::fastrtps::xmlparser::XMLEndpointParser::loadXMLFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?loadXMLFile@XMLEndpointParser@xmlparser@fastrtps@eprosima@@QAE?AW4XMLP_ret@234@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall tinyxml2::XMLDocument::~XMLDocument(void)" (??1XMLDocument@tinyxml2@@UAE@XZ) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLEndpointParser.obj : error LNK2019: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLDocument::LoadFile(char const *)" (?LoadFile@XMLDocument@tinyxml2@@QAE?AW4XMLError@2@PBD@Z) referenced in function "public: enum eprosima::fastrtps::xmlparser::XMLP_ret __thiscall eprosima::fastrtps::xmlparser::XMLEndpointParser::loadXMLFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?loadXMLFile@XMLEndpointParser@xmlparser@fastrtps@eprosima@@QAE?AW4XMLP_ret@234@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2001: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLDocument::LoadFile(char const *)" (?LoadFile@XMLDocument@tinyxml2@@QAE?AW4XMLError@2@PBD@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLAttribute::Name(void)const " (?Name@XMLAttribute@tinyxml2@@QBEPBDXZ) referenced in function "protected: static void __cdecl eprosima::fastrtps::xmlparser::XMLParser::addAllAttributes<class eprosima::fastrtps::ParticipantAttributes>(class tinyxml2::XMLElement *,class eprosima::fastrtps::xmlparser::DataNode<class eprosima::fastrtps::ParticipantAttributes> &)" (??$addAllAttributes@VParticipantAttributes@fastrtps@eprosima@@@XMLParser@xmlparser@fastrtps@eprosima@@KAXPAVXMLElement@tinyxml2@@AAV?$DataNode@VParticipantAttributes@fastrtps@eprosima@@@123@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall tinyxml2::XMLAttribute::Value(void)const " (?Value@XMLAttribute@tinyxml2@@QBEPBDXZ) referenced in function "protected: static void __cdecl eprosima::fastrtps::xmlparser::XMLParser::addAllAttributes<class eprosima::fastrtps::ParticipantAttributes>(class tinyxml2::XMLElement *,class eprosima::fastrtps::xmlparser::DataNode<class eprosima::fastrtps::ParticipantAttributes> &)" (??$addAllAttributes@VParticipantAttributes@fastrtps@eprosima@@@XMLParser@xmlparser@fastrtps@eprosima@@KAXPAVXMLElement@tinyxml2@@AAV?$DataNode@VParticipantAttributes@fastrtps@eprosima@@@123@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
XMLParser.obj : error LNK2019: unresolved external symbol "public: enum tinyxml2::XMLError __thiscall tinyxml2::XMLDocument::Parse(char const *,unsigned int)" (?Parse@XMLDocument@tinyxml2@@QAE?AW4XMLError@2@PBDI@Z) referenced in function "public: static enum eprosima::fastrtps::xmlparser::XMLP_ret __cdecl eprosima::fastrtps::xmlparser::XMLParser::loadXML(char const *,unsigned int,class std::unique_ptr<class eprosima::fastrtps::xmlparser::BaseNode,struct std::default_delete<class eprosima::fastrtps::xmlparser::BaseNode> > &)" (?loadXML@XMLParser@xmlparser@fastrtps@eprosima@@SA?AW4XMLP_ret@234@PBDIAAV?$unique_ptr@VBaseNode@xmlparser@fastrtps@eprosima@@U?$default_delete@VBaseNode@xmlparser@fastrtps@eprosima@@@std@@@std@@@Z) [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
C:\ProgramData\chocolatey\lib\tinyxml2\lib\tinyxml2d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86' [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\Debug\fastrtpsd-2.0.dll : fatal error LNK1120: 16 unresolved externals [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]
ghostravenstorm commented 3 years ago

I've confirmed the TinyXML2 lib is correctly referenced in the VS solution CMake generated. I tried building the solution in VS, and it spits out the same 16 linker errors on TinyXML2. Not sure why this is.

image

richiware commented 3 years ago

TinyXML2 NuGet package only contains the library for x64 platform. There is a line in the log you pasted that tells you are compiling in x86:

C:\ProgramData\chocolatey\lib\tinyxml2\lib\tinyxml2d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86' [H:\Vcom3D\AMM\Repos\eProsima\Fast-DDS\build\src\cpp\fastrtps.vcxproj]

You could compile your project for x64 platform

# In CMake configuration step
cmake -A x64 .

or configure Fast-DDS to compile internally TinyXML2

# In CMake configuration step
cmake -DTHIRDPARTY=ON -DTINYXML2_FROM_SOURCE=ON .
EduPonz commented 3 years ago

To complement @richiware 's response, starting Fast DDS v2.1.0, you could do the configuration step with only one flag:

# In CMake configuration step
cmake -DTHIRDPARTY_TinyXML2=FORCE .

More on Fast DDS CMake options here.

Please do tell us how it goes!

ghostravenstorm commented 3 years ago

Using cmake -DTHIRDPARTY=ON seems to have work. I built using Visual Studio 2017 and 2015 and both are successful. Installed foonathan_memory_vendor first, then ran cmake -DTHIRDPARTY=ON .. | cmake --build . --target install When the instillation was first failing, this was on Visual Studio 2015. I started thinking maybe VS 2015 isn't comptatible. I choose that version because the FastDDS gen tool only builds up to VS 2015.

Seems using the TinyXML2 submodule is the way to go.

ghostravenstorm commented 3 years ago

I ran into some problems trying to build a VS project created with Fast-DDS-Gen. I posted it over on that repo.

richiware commented 3 years ago

Due to your problem compiling FastDDS was solved, I will close this issue.