Hello, in my PLCnext PLM project (C++, Visual Studio) I have dependency for an external static library (Lua). But when I build project for two targets (AXCF2152 and AXC3152) I get duplicated dependency configuration strings (content of the *.libmeta file): Thus module can’t be loaded correctly, AXC2152 error log: May 17 14:13:01 axcf2152 Arp.System.Application[3020]: Arp.Plc.Domain.Internal.PlcManager ERROR - Exception occurs while loading plc component 'Arp.Plc.Plm': Exception of type 'Arp::System::Commons::InvalidConfigException' was thrown The configuration '/opt/plcnext/projects/current/Plc/Plm/pcwe.plm.config' is not valid. at Arp::System::Commons::Xml::XmlConfigDocument::ReadDocument(Arp::System::Commons::Xml::XmlReader&) at Arp::System::Commons::Xml::XmlConfigDocument::TryLoad(Arp::BasicString > const&) at Arp::System::Commons::Xml::MultiXmlConfigDocument::TryLoad(Arp::System::Commons::Configuration::ConfigurationSettings const&, Arp::BasicString >&) at Arp::System::Commons::Xml::MultiXmlConfigDocument::Load(Arp::System::Commons::Configuration::ConfigurationSettings const&) at Arp::System::Acf::Internal::Sm::Config::AcfConfigurationLoader::Load(Arp::BasicString > const&, Arp::System::Commons::Configuration::ConfigurationSettings const&, Arp::System::Acf::Internal::Sm::Config::AcfConfiguration&) at Arp::Plc::Plm::Internal::PlmConfiguration::Load(Arp::System::Commons::Configuration::ConfigurationSettings const&) at Arp::Plc::Plm::Internal::PlmDomain::Load(Arp::System::Commons::Configuration::ConfigurationSettings const&, bool) at Arp::Plc::Plm::PlmComponent::LoadPlc(bool) at Arp::Plc::Domain::Internal::PlcComponentInfo::LoadPlc(bool) at Arp::Plc::Domain::Internal::PlcManager::LoadAndSetupPlcComponents(bool) at Arp::Plc::Domain::Internal::PlcManager::LoadAndSetupPlcInternal() at Arp::System::Commons::Threading::TaskQueue::ProcessTasksInternal(unsigned int) at Arp::System::Commons::Threading::TaskQueue::ProcessTasks() at Arp::System::Commons::Threading::TaskThread::RunInternal(void*) at Arp::System::Commons::Threading::Thread::RunThread(Arp::System::Commons::Threading::ThreadBinaryCompatibilityExtensions*) at Arp::System::Commons::Threading::Thread::RunInternal(void*) at Arp::System::Ve::Internal::Linux::ThreadService::RunInternal(void*) \--- Inner exception: Exception of type 'Arp::System::Commons::XmlException' was thrown Dependency '/opt/plcnext/projects/PCWE/Libs/Ptusa/libliblua_static.a' is already declared! (/opt/plcnext/projects/current/Plc/Plm/pcwe.plm.config:7) at Arp::System::Acf::Internal::Sm::Config::Dependencies::ReadXml(Arp::System::Commons::Xml::XmlReader&, Arp::System::Commons::Xml::XmlSerializationContext&) at Arp::System::Acf::Internal::Sm::Config::Library::ReadXml(Arp::System::Commons::Xml::XmlReader&, Arp::System::Commons::Xml::XmlSerializationContext&) at Arp::System::Acf::Internal::Sm::Config::Libraries::ReadXml(Arp::System::Commons::Xml::XmlReader&, Arp::System::Commons::Xml::XmlSerializationContext&) at Arp::System::Acf::Internal::Sm::Config::AcfConfiguration::ReadXml(Arp::System::Commons::Xml::XmlReader&, Arp::System::Commons::Xml::XmlSerializationContext&) at Arp::System::Commons::Xml::XmlConfigDocument::ReadDocument(Arp::System::Commons::Xml::XmlReader&) at Arp::System::Commons::Xml::XmlConfigDocument::TryLoad(Arp::BasicString > const&) at Arp::System::Commons::Xml::MultiXmlConfigDocument::TryLoad(Arp::System::Commons::Configuration::ConfigurationSettings const&, Arp::BasicString >&) at Arp::System::Commons::Xml::MultiXmlConfigDocument::Load(Arp::System::Commons::Configuration::ConfigurationSettings const&) at Arp::System::Acf::Internal::Sm::Config::AcfConfigurationLoader::Load(Arp::BasicString > const&, Arp::System::Commons::Configuration::ConfigurationSettings const&, Arp::System::Acf::Internal::Sm::Config::AcfConfiguration&) at Arp::Plc::Plm::Internal::PlmConfiguration::Load(Arp::System::Commons::Configuration::ConfigurationSettings const&) at Arp::Plc::Plm::Internal::PlmDomain::Load(Arp::System::Commons::Configuration::ConfigurationSettings const&, bool) at Arp::Plc::Plm::PlmComponent::LoadPlc(bool) at Arp::Plc::Domain::Internal::PlcComponentInfo::LoadPlc(bool) at Arp::Plc::Domain::Internal::PlcManager::LoadAndSetupPlcComponents(bool) at Arp::Plc::Domain::Internal::PlcManager::LoadAndSetupPlcInternal() at Arp::System::Commons::Threading::TaskQueue::ProcessTasksInternal(unsigned int) at Arp::System::Commons::Threading::TaskQueue::ProcessTasks() at Arp::System::Commons::Threading::TaskThread::RunInternal(void*) at Arp::System::Commons::Threading::Thread::RunThread(Arp::System::Commons::Threading::ThreadBinaryCompatibilityExtensions*) at Arp::System::Commons::Threading::Thread::RunInternal(void*) at Arp::System::Ve::Internal::Linux::ThreadService::RunInternal(void*) May 17 14:13:01 axcf2152 Arp.System.Application[3020]: Arp.Plc.Domain.Internal.PlcManager ERROR - Plc component 'Arp.Plc.Plm' returns false while LoadPlc(isChanging=false) was called. May 17 14:13:01 axcf2152 Arp.System.Application[3020]: Arp.Plc.Domain.Internal.PlcManager ERROR - Reverted all yet loaded components. Thanks a lot.
Hi Dzmitry, I wouldn’t expect to see any static libraries in the Dependency list for your library, because (I guess) your library has linked that library statically, right? So there is no need for the .a file to be included in the .pcwlx file, or sent to the PLC. Or am I misunderstanding something? How are you linking to this static library in your build? ~ Martin.
Hello Martin, I’m linking library in CMake: target_link_libraries(Ptusa PRIVATE ArpDevice ArpProgramming liblua_static)
And where are those static libraries (the .a file for the 2152, and the .a file for the 3152) located on the file system, in relation to the source files for the PLM project? I suspect that somewhere in the toolchain, something is assuming that all linked libraries must be dynamically linked, which is obviously not the case here.
Lua is used as git-submodule and in CMake added using add_subdirectory command. You can have a look here - https://github.com/idzm/ptusa_main-1/blob/dev_2021/PAC_control_projects/main_control_prg/visual_studio/ptusa/ptusa/CMakeLists.txt.
Sorry for the delay. It will be next week before I can speak with the developer of the Visual Studio add-in, which I suspect may be causing this issue. In the mean time - can you please attach the complete list of output messages that are generated during the build process? That should show all the plcncli commands that are executed during the build. If one of those commands mentions libliblua_static.a in the parameter list, then that will help us narrow down the source of the problem.
The developers have now investigated this and identified two issues with the current version of the PLCnext CLI which are affecting your project. In short, the PLCnext CLI generates a „Dependencies“ section in the .libmeta file, which is supposed to reference shared object libraries needed for the application. But in your case it has mistakenly included a static library as a dependency. In addition, this reference has mistakenly been included twice, which causes problems for the PLCnext Runtime. A fix is currently being developed, and will be available in version 2021.6 of the PLCnext CLI.