plcnext / cppexamples Goto Github PK
View Code? Open in Web Editor NEWCollection of various C++ sample code for PLCnext Technology controllers.
License: MIT License
Collection of various C++ sample code for PLCnext Technology controllers.
License: MIT License
Take care, the ARP_DEVICE_VERSION contains two whitespaces at the end. You can easily miss that.
Please update the DEVICE_VERSION in order to prevent bugs that are so hard to find
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=/opt/pxc/2019.3/toolchain.cmake -DBUILD_TESTING=OFF -DUSE_ARP_DEVICE=ON -DCMAKE_STAGING_PREFIX=/home/tcs-user/Documents/projects/MqttClient/bin/axcf2152 -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/home/tcs-user/Documents/projects/MqttClient/external/deploy/axcf2152 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DARP_TOOLCHAIN_ROOT=/opt/pxc/2019.3 -DARP_DEVICE=AXCF2152 "-DARP_DEVICE_VERSION=2019.3 (19.3.0.18509 )" -S . -B ./build/axcf2152-2019.3
CMake Error at /opt/pxc/2019.3/cmake/FindArpDevice.cmake:93 (message):
The device version '2019.3 (19.3.0.18509 )' is not supported by this SDK.
Supported versions are 2019.3 (19.3.0.18509 ).
Call Stack (most recent call first):
CMakeLists.txt:12 (_find_package)
libs/MqttClientService/CMakeLists.txt:48 (find_package)
In relation to the example "How to include an open-source library in your own C++ project", there is another example of including the NE10 library (and the JsonCpp library) here:
https://www.plcnext-community.net/makersblog/how-to-use-visual-studio-code-to-write-c-for-plcnext/
It is worth mentioning this alternative solution in the README for this example.
The ThreadExample has an issue to start after a download.
It is necesarry to reboot the PLC. to fix it.
PLC (21.0.0.35466)
SDK (21.0.0.35466)
plcncli 21.0.0.489 (21.0.0.489)
Engineer 21.0.1
To Reproduce
Steps to reproduce the behavior:
18.02.21 15:45:46.176 Arp.Plc.Domain.Internal.PlcManager ERROR - Exception occurs while loading component 'Arp.Plc.Plm': basic_string::_M_construct null not valid
18.02.21 15:45:46.177 Arp.Plc.Domain.Internal.PlcManager ERROR - Plc component 'Arp.Plc.Plm' returns false while LoadPlc(isChanging=false) was called.
18.02.21 15:45:46.353 Arp.Plc.Domain.Internal.PlcManager ERROR - Reverted all yet loaded components.
18.02.21 15:54:20.389 Arp.Plc.Domain.Internal.PlcManager ERROR - Exception occurs while loading plc component 'Arp.Plc.Plm': Exception of type 'Arp::System::Ve::Exceptions::VeException' was thrown
StartThread: Could not set scheduling parameters, linux error code: Invalid argument
at: /usr/lib/libArp.System.Ve.so(+0x26daa) [0xb662cdaa]
at: Arp::System::Ve::Internal::Linux::ThreadService::StartThread()
at: Arp::System::Commons::Threading::Thread::CreateThreadInternal(Arp::System::Commons::Threading::ThreadSettings const&)
at: ThreadExample::ThreadExampleComponent::ThreadExampleComponent(Arp::System::Acf::IApplication&, Arp::BasicString<char, std::allocator<char> > const&)
at: ThreadExample::ThreadExampleComponent::Create(Arp::System::Acf::IApplication&, Arp::BasicString<char, std::allocator<char> > const&)
at: Arp::System::Acf::ComponentFactory::CreateComponent(Arp::System::Acf::IApplication&, Arp::BasicString<char, std::allocator<char> > const&, Arp::BasicString<char, std::allocator<char> > const&)
at: Arp::Plc::Plm::Internal::AdapterFactory::CreateComponent(Arp::System::Acf::Internal::Sm::Config::Component const&) const
at: Arp::Plc::Plm::Internal::AdapterFactory::CreateComponentAdapter(Arp::System::Acf::Internal::Sm::Config::Component const&) const
at: Arp::Plc::Plm::Internal::PlmComponentManager::CreateComponent(Arp::System::Acf::Internal::Sm::Config::Component const&)
at: Arp::Plc::Plm::Internal::PlmComponentManager::ProcessComponentConfig(Arp::System::Acf::Internal::Sm::Config::Component const&, bool)
at: Arp::Plc::Plm::Internal::PlmComponentManager::LoadComponents(bool)
at: Arp::Plc::Plm::PlmComponent::LoadPlc(bool)
at: Arp::Plc::Domain::Internal::PlcComponentInfo::LoadPlc(bool)
at: Arp::Plc::Domain::Internal::PlcManager::LoadPlcComponents(bool)
at: Arp::Plc::Domain::Internal::PlcManager::LoadPlcInternal()
at: Arp::Plc::Domain::PlcManagerComponent::LoadConfig()
at: Arp::System::Acf::Internal::Pm::ProcessManager::LoadComponentConfig(Arp::System::Acf::IComponent&) const
at: Arp::System::Acf::Internal::Pm::ProcessManager::LoadComponentConfig(Arp::BasicString<char, std::allocator<char> > const&) const
at: Arp::System::Acf::Services::Internal::ProcessManagerServiceImpl::LoadComponentConfig(Arp::System::Rsc::Services::RscString<512> const&)
at: Arp::System::Acf::Internal::Sm::ComponentsController::SetupComponentConfig(Arp::System::Acf::Internal::Sm::Data::ComponentExecutionData&)
at: Arp::System::Acf::Internal::Sm::ComponentsController::SetupComponentsConfig()
at: Arp::System::Acf::Internal::Sm::SystemManager::SetupSystem()
at: Arp::System::Acf::Internal::ApplicationBase::SetupBasicComponents(Arp::System::Acf::Internal::ApplicationSetupKind, Arp::System::Acf::Internal::ProcessKind)
at: Arp::System::Acf::Internal::ApplicationBase::Setup(Arp::System::Commons::Diagnostics::Logging::LogLevel, char const*)
at: Arp::System::Acf::Internal::ApplicationBase::Main(int, char**, Arp::System::Commons::Diagnostics::Logging::LogLevel)
at: Arp.System.Application(+0x2000c) [0x48200c]
at: /lib/libc.so.6(__libc_start_main+0x97) [0xb666a9a4]
18.02.21 15:54:20.829 Arp.Plc.Domain.Internal.PlcManager ERROR - Reverted all yet loaded components.
Expected behavior
Run without issue after first download.
Often you will need to get data from your Real Time application to a Thread for further processing.
How can you do this without blocking the Real Time application (for a long time) and without loss of data?
There are many examples on how to do this with variying complexity as you need it.
(blocking, nonblocking, single / multi data provider, single/multi data consumer etc.)
Show a simple example handling one data provider and one consumer using a buffer.
To better monitor what the Thread can access you should create an additional class for the thread.
In order for any project to be built using the generic instructions in the main README, all projects in this repository must conform to a specific structure.
In the README (perhaps in the "Contributing" section), the required project structure should be detailed.
void Write(const byte* pBuffer, size_t bufferSize, size_t offset, size_t count);
size_t Read(byte* pBuffer, size_t bufferSize, size_t offset, size_t count);
Arp::System::Commons::ArgumentNullException | if pBuffer is nullptr.
Arp::System::Commons::ObjectDisposedException | if the stream was already disposed.
Arp::System::Commons::ArgumentOutOfRangeException | if offset plus count is greater than bufferSize.
Arp::System::Commons::NotSupportedException | if this stream is not writeable.
The components inheritance template changed.
-> Please update to latest best-practice.
This is no breaking change but a convenience feature.
Section 6 of the Notification Example suggests that historical notifications can be read directly from a sqlite database.
The suggested approach is actually to use the NotificationLogger RSC service, which includes a ReadStoredNotifications method.
The example should be updated to show this method.
Feature request for the Notification example:
The NotificationManager’s GetAllKnownNotificationnameIds() and GetNotificationRegistration(nameId) can be used to query information about all registered notification types.
This information could be added to the example.
Part 6 of the Notification example describes how to view logged notifications, but it is not 100% clear that these notifications are sourced from the database that is filled by the notification logger. Therefore, custom notifications can only be made to appear in PLCnext Engineer and WBM if they are logged by the notification logger, using a custom notification logger configuration file.
Following on from #38 , it turns out that all the data type definitions are now created automatically by the toolchain, so there is no need to create any PLCnext Engineer data types manually.
Firmware version 2021.6 extends the support for the WSTRING (wide string) data type.
An example of this type should be added to (at least) the Data Type Exchange Example.
SDK >= 2021.6
The SDK compiler was set to C++ 17
With the SDK version 2021.6 the language standard C++ 17 has been set in the compiler options (-std=c++17). The firmware itself is also compiled with this option set. Besides some general C++ issues related to this C++17 standard, the following issue is related to PLCnext: C++ 17 introduces the data type std::byte which is unfortunately not compatible with Arp::byte. Therefore, if the namespaces std and Arp are both active the compilation, this results in an error. In this case existing C++ sources have to be adjusted so that they explicitly use Arp::byte (e.g. by adding using byte = Arp::byte;).
Known for firmware on ALL PLCnext devices
[cmake]: [ 71%] Building CXX object CMakeFiles/FileStreamExample.dir/src/FileStreamExampleComponent.cpp.o
[cmake]: /home/myworkpcuser/Downloads/CppExamples/Examples/FileStreamExample/src/FileStreamExampleComponent.cpp: In member function 'void FileStreamExample::FileStreamExampleComponent::WriteToFile(Arp::String)':
[cmake]: /home/myworkpcuser/Downloads/CppExamples/Examples/FileStreamExample/src/FileStreamExampleComponent.cpp:85:19: error: reference to 'byte' is ambiguous
[cmake]: 85 | stream.Write((byte*) str.CStr(), str.Length(), 0, str.Length());
can be fixed With:
stream.Write((Arp::byte*) str.CStr(), str.Length(), 0, str.Length());
stream.Read((Arp::byte*) str.CStr(), stream.GetLength(), 0, stream.GetLength());
String ports are handled differently than primitive types when (for example) reading them from an RscVariant.
Since Strings would be a fairly popular data type, the Data Access and Subscription examples could demonstrate how to read and/or write String ports using these services.
In this file:
https://github.com/PLCnext/CppExamples/blob/master/Examples/CppDataTypeTest/README.md
... the table of contents includes links to source code, which currently go nowhere.
For a defined shutdown it is necessary to add further shutdown procedure.
(In case of blocking methods or to cancle loops.)
Example:
W.Stop = true;
T.Interrupt();
if (T.IsJoinable()){
T.Join();
}
Now that String ports are supported in PLCnext Engineer, it would be good to demonstrate how to declare these types of ports in C++.
The example should include both standard length strings (80 characters) and custom-length strings.
The DataAccess example should be extended to include more complex types, e.g. a struct containing an array and a struct containing a struct (internal ref #236386).
TOC does not render correctly.
In the Data Type example, in the section "PLCnext Engineer project", there is now no need to create the custom type data type in PLCnext Engineer (step 3). Type definitions from the C++ project are automatically included in the PLCnext Engineer project when the library is imported, so the type s_alltypes
already exists and does not need to be re-defined.
Add a section on how to use NotificationDebugger to Notification example.
The Dynamic Ports example lists the limitation that struct metadata is not generated automatically by the plcncli code generator.
It turns out that the //#typeinformation
comment can be used to do just that.
The example should be updated to mention this.
It would be interesting to include an example of how to trigger a User Event Task, as discussed here:
https://www.plcnext-community.net/forum/#/discussion/497/user-event-task
Add an example showing how to call methods in C++ Components or Programs from an OPC UA client.
The required OPC UA variables may be declared using the technique described here:
Environment (please complete the following information):
Describe the bug
I tried to compile an example from here (CppDataTypeTest) using the build-local.sh. I have manage to narrow it down to something going wrong with the build-forOneTarget.sh
script (i.e. plcncli build
command). See the LOG OUTPUT section for the error.
To Reproduce
Steps to reproduce the behavior:
tools/build-local.sh
file:BUILD_HARDWARE="AXCF2152"
&& PROJECTNAME="CppDataTypeTest"
DIR=$PWD
instead of DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
$DIR/
for all relative paths: code line: 24, 25 and 26plcncli set target -n $BUILD_HARDWARE --add --verbose --path $DIR/build/$PROJECTNAME
before line 30 (Create Config and Code)chmod +x tools/build-local.sh
&& ./tools/build-local.sh
Expected behavior
Obtaining the libCppDataTypeTest.so
using the plcncli from a C++ project.
LOG OUTPUT
Here is the relevant output:
Build
+ plcncli build --path /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest --buildtype RELEASE --configure --target AXCF2152,21.0.0.35466 --output /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest/bin/AXCF2152_21.0.0.35466/ --verbose
+ tee /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/AXCF2152_21.0.0.35466/BUILD_CppDataTypeTest.log
Requested build for targets AXCF2152,21.0.0.35466
Starting build for target AXCF2152,21.0.0.35466
Starting process which cmake in .
Change: Cleared cmake directory.
Checking if CMake needs to be reconfigured...
Configuring CMake...
Starting process which cmake in .
Starting process /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake -DCMAKE_TOOLCHAIN_FILE="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/toolchain.cmake" -DARP_TOOLCHAIN_ROOT="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS" -DCMAKE_BUILD_TYPE=RELEASE -DARP_DEVICE="AXCF2152" -DARP_DEVICE_VERSION="2021.0.0 LTS (21.0.0.35466)" -DCMAKE_STAGING_PREFIX="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/bin/AXCF2152_21.0.0.35466/" -DCMAKE_PREFIX_PATH="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/external" -G "Unix Makefiles" "/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest" in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE.
[cmake]: -- Setting ARP_TOOLCHAIN_NATIVE_SYSROOT='/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux'
[cmake]: -- Setting ARP_TOOLCHAIN_TARGET_SYSROOT='/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi'
[cmake]: -- Setting ARP_TOOLCHAIN_ENVIRONMENT_PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin;/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin'
[cmake]: -- Setting ENV{PATH}='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin;/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin'
[cmake]: -- The C compiler identification is GNU 9.3.0
[cmake]: -- The CXX compiler identification is GNU 9.3.0
[cmake]: -- Check for working C compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-gcc
[cmake]: -- Check for working C compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-gcc -- works
[cmake]: -- Detecting C compiler ABI info
[cmake]: -- Detecting C compiler ABI info - done
[cmake]: -- Detecting C compile features
[cmake]: -- Detecting C compile features - done
[cmake]: -- Check for working CXX compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-g++
[cmake]: -- Check for working CXX compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-g++ -- works
[cmake]: -- Detecting CXX compiler ABI info
[cmake]: -- Detecting CXX compiler ABI info - done
[cmake]: -- Detecting CXX compile features
[cmake]: -- Detecting CXX compile features - done
[cmake]: -- Found ArpProgramming: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext
[cmake]: -- Configuring done
[cmake]: -- Generating done
[cmake]: -- Build files have been written to: /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE
Starting process which cmake in .
Starting process /bin/sh -c "'/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE/EnvironmentSetup.sh' && '/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake' --build . --target install" in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE.
[cmake]: Scanning dependencies of target CppDataTypeTest
[cmake]: [ 20%] Building CXX object CMakeFiles/CppDataTypeTest.dir/src/CppDataTypeTestComponent.meta.cpp.o
[cmake]: /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestComponent.meta.cpp:1:10: fatal error: CppDataTypeTestComponent.hpp: No such file or directory
[cmake]: 1 | #include "CppDataTypeTestComponent.hpp"
[cmake]: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[cmake]: compilation terminated.
[cmake]: make[2]: *** [CMakeFiles/CppDataTypeTest.dir/build.make:63: CMakeFiles/CppDataTypeTest.dir/src/CppDataTypeTestComponent.meta.cpp.o] Error 1
[cmake]: make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/CppDataTypeTest.dir/all] Error 2
[cmake]: make: *** [Makefile:130: all] Error 2
cmake process exited with error
Rollback transaction.
The CppDataTypeTestComponent.hpp
file is there before the build-forOneTarget.sh
is executed. Are all the sh scripts still valid for the new CLI version? What commands am I missing?
Complete LOG output:
./tools/build-local.sh
DIR=/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples
Change: Create file plcnext.proj for template project in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
Change: Create file CMakeLists.txt for template project in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
Change: Create file ADD_DEPENDENT_LIBRARIES_HERE.txt for template project in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/external.
Change: Create file CppDataTypeTestComponent.cpp for template component in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src.
Change: Create file CppDataTypeTestComponent.hpp for template component in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src.
Change: Create file CppDataTypeTestProgram.cpp for template program in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src.
Change: Create file CppDataTypeTestProgram.hpp for template program in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src.
Successfully created template 'project' in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
Change: Update project targets.
Successfully added target AXCF2152 2021.0.0 LTS (21.0.0.35466) to project /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
DIR=/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools
###############
###############
plcncli 21.0.0 LTS (21.0.0.489)
Copyright (c) 2018 PHOENIX CONTACT GmbH & Co. KG
-p, --path The path to the project settings file or
the project root directory. Default is the
current directory.
-s, --sources The path of the source directories
separated by ','. Default is the 'src'
directory if such a directory exists. If
not, the directory defined with the
'--path' option is used. Relative paths
are relative to the directory defined with
the '--path' option. If any path contains
a ' ' quotation marks should be used
around all paths, e.g. "path1,path With
Space,path2".
-i, --includes Overrides the includes used to find header
files. Usually CMake is used to determine
the include paths. If that is not possible
or wanted the value of this argument is
used instead of the CMake determined
include paths. Relative paths are relative
to the directory defined with the '--path'
option. If any path contains a ' '
quotation marks should be used around all
paths, e.g. "path1,path With Space,path2".
Additionally to these paths the include
paths determined by the SDK will always be
considered and do not need to be specified
additionally.
-n, --no-include-path-detection Disables the automatic include path
detection using CMake. This option is not
necessary if the '-includes' option is
used, as that option will automatically
disable the CMake detection. The system
paths defined by the SDK are still used.
-o, --output The path where the files will be generated
in. Default is the 'intermediate'
directory. Relative paths are relative to
the directory defined with the '--path'
option.
--verbose Enables verbose output.
--quiet Suppresses all output.
--help Display this help screen.
Examples:
generate all config files in default location.:
plcncli generate config --path Path/To/Project
###############
###############
generate Config
Generating all files with the 'config' generator for /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
Starting process which cmake in .
Starting process /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake -DCMAKE_TOOLCHAIN_FILE="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/toolchain.cmake" -DARP_TOOLCHAIN_ROOT="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS" -DCMAKE_BUILD_TYPE=Release -DARP_DEVICE="AXCF2152" -DARP_DEVICE_VERSION="2021.0.0 LTS (21.0.0.35466)" -DCMAKE_STAGING_PREFIX="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/bin" -DCMAKE_PREFIX_PATH="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/external" -G "Unix Makefiles" "/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest" in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/Release.
Starting process which cmake in .
Starting process /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake -E server --experimental --pipe=/tmp/cmake-server-8639F113-CD02-524B-A1DF-3BA75439A05B in .
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/CppDataTypeTest.libmeta.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/CppDataTypeTest.typemeta.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/CppDataTypeTestComponent/CppDataTypeTestComponent.compmeta.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/CppDataTypeTestComponent/CppDataTypeTestProgram/CppDataTypeTestProgram.progmeta.
Successfully generated all files with the 'config' generator for /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
###############
###############
plcncli 21.0.0 LTS (21.0.0.489)
Copyright (c) 2018 PHOENIX CONTACT GmbH & Co. KG
-p, --path The path to the project settings file or
the project root directory. Default is the
current directory.
-s, --sources The path of the source directories
separated by ','. Default is the 'src'
directory if such a directory exists. If
not, the directory defined with the
'--path' option is used. Relative paths
are relative to the directory defined with
the '--path' option. If any path contains
a ' ' quotation marks should be used
around all paths, e.g. "path1,path With
Space,path2".
-i, --includes Overrides the includes used to find header
files. Usually CMake is used to determine
the include paths. If that is not possible
or wanted the value of this argument is
used instead of the CMake determined
include paths. Relative paths are relative
to the directory defined with the '--path'
option. If any path contains a ' '
quotation marks should be used around all
paths, e.g. "path1,path With Space,path2".
Additionally to these paths the include
paths determined by the SDK will always be
considered and do not need to be specified
additionally.
-n, --no-include-path-detection Disables the automatic include path
detection using CMake. This option is not
necessary if the '-includes' option is
used, as that option will automatically
disable the CMake detection. The system
paths defined by the SDK are still used.
-o, --output The path where the files will be generated
in. Default is the 'intermediate'
directory. Relative paths are relative to
the directory defined with the '--path'
option.
--verbose Enables verbose output.
--quiet Suppresses all output.
--help Display this help screen.
Examples:
generate all code files in default location.:
plcncli generate code --path Path/To/Project
###############
###############
generate Code
Generating all files with the 'code' generator for /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
Starting process which cmake in .
Starting process /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake -DCMAKE_TOOLCHAIN_FILE="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/toolchain.cmake" -DARP_TOOLCHAIN_ROOT="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS" -DCMAKE_BUILD_TYPE=Release -DARP_DEVICE="AXCF2152" -DARP_DEVICE_VERSION="2021.0.0 LTS (21.0.0.35466)" -DCMAKE_STAGING_PREFIX="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/bin" -DCMAKE_PREFIX_PATH="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/external" -G "Unix Makefiles" "/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest" in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/Release.
Starting process which cmake in .
Starting process /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake -E server --experimental --pipe=/tmp/cmake-server-F65506FD-6B0A-E64B-BF73-297D92D62DCC in .
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestLibrary.cpp.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestLibrary.hpp.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestLibrary.meta.cpp.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestComponentProgramProvider.cpp.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestComponentProgramProvider.hpp.
Change: Generated the file /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestComponent.meta.cpp.
Successfully generated all files with the 'code' generator for /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest.
build/CppDataTypeTest/src/CppDataTypeTestLibrary.hpp
build/CppDataTypeTest/src/CppDataTypeTestLibrary.cpp
build/CppDataTypeTest/src/CppDataTypeTestLibrary.meta.cpp
Start Build All
###############
###############
plcncli 21.0.0 LTS (21.0.0.489)
Copyright (c) 2018 PHOENIX CONTACT GmbH & Co. KG
-p, --path Directory where the plcnext.proj file is located.
-t, --target Targets for which the build shall be executed.
Targets should have the form <target>[,<version>]
[...]. The complete version can be but does not
have to be used. The combination of target and
version must be unambiguous. If the version
contains a space, quotation marks around that
target are necessary. WARNING: Do not use this
option directly before the cmake options, because
the cmake options will be interpreted as targets.
-b, --buildtype Build type for the build, e.g. Release
--configure Force CMake to make a new configuration
--noconfigure Force CMake to do only a build
-o, --output Sets the directory in which the library is
installed. The directory can be either absolute or
relative to the project directory. This will use
the '-DCMAKE_STAGING_PREFIX' option. If the
'-DCMAKE_STAGING_PREFIX' option is already
specified this option will be ignored.
--verbose Enables verbose output.
--quiet Suppresses all output.
--help Display this help screen.
cmake options (pos. 0) Additional CMake options for the build. They will
only be applied when the build is configured. To
reconfigure the build use the '--configure' option.
It is necessary to set these options with a leading
' -- '. Quotation marks will not be preserved. To
add quotation marks to the options, use the escape
string '%22' instead. NO other escape sequences
such as '%20' will be unescaped.
Examples:
build for all targets supported by project:
plcncli build --path Path/To/Project
build project for target AXCF2152:
plcncli build --path Path/To/Project -t AXCF2152
build project with additional options:
plcncli build --path Path/To/Project -t AXCF2152 --configure -- -G %22Unix
Makefiles%22 -DCMAKE_MAKE_PROGRAM=%22mymakepath%22
install into a special folder:
plcncli build --output build/install
###############
###############
TRY Build All: AXCF2152 Toolchains: 1
T: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS"
V:21.0.0.35466
HW:AXCF2152
Build AXCF2152
###############
###############
+ echo Build
Build
+ plcncli build --path /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest --buildtype RELEASE --configure --target AXCF2152,21.0.0.35466 --output /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest/bin/AXCF2152_21.0.0.35466/ --verbose
+ tee /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/AXCF2152_21.0.0.35466/BUILD_CppDataTypeTest.log
Requested build for targets AXCF2152,21.0.0.35466
Starting build for target AXCF2152,21.0.0.35466
Starting process which cmake in .
Change: Cleared cmake directory.
Checking if CMake needs to be reconfigured...
Configuring CMake...
Starting process which cmake in .
Starting process /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake -DCMAKE_TOOLCHAIN_FILE="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/toolchain.cmake" -DARP_TOOLCHAIN_ROOT="/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS" -DCMAKE_BUILD_TYPE=RELEASE -DARP_DEVICE="AXCF2152" -DARP_DEVICE_VERSION="2021.0.0 LTS (21.0.0.35466)" -DCMAKE_STAGING_PREFIX="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/bin/AXCF2152_21.0.0.35466/" -DCMAKE_PREFIX_PATH="/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/external" -G "Unix Makefiles" "/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest" in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE.
[cmake]: -- Setting ARP_TOOLCHAIN_NATIVE_SYSROOT='/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux'
[cmake]: -- Setting ARP_TOOLCHAIN_TARGET_SYSROOT='/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi'
[cmake]: -- Setting ARP_TOOLCHAIN_ENVIRONMENT_PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin;/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin'
[cmake]: -- Setting ENV{PATH}='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin;/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin'
[cmake]: -- The C compiler identification is GNU 9.3.0
[cmake]: -- The CXX compiler identification is GNU 9.3.0
[cmake]: -- Check for working C compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-gcc
[cmake]: -- Check for working C compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-gcc -- works
[cmake]: -- Detecting C compiler ABI info
[cmake]: -- Detecting C compiler ABI info - done
[cmake]: -- Detecting C compile features
[cmake]: -- Detecting C compile features - done
[cmake]: -- Check for working CXX compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-g++
[cmake]: -- Check for working CXX compiler: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pxc-linux-gnueabi/arm-pxc-linux-gnueabi-g++ -- works
[cmake]: -- Detecting CXX compiler ABI info
[cmake]: -- Detecting CXX compiler ABI info - done
[cmake]: -- Detecting CXX compile features
[cmake]: -- Detecting CXX compile features - done
[cmake]: -- Found ArpProgramming: /home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/AXCF2152/2021_0_LTS/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/plcnext
[cmake]: -- Configuring done
[cmake]: -- Generating done
[cmake]: -- Build files have been written to: /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE
Starting process which cmake in .
Starting process /bin/sh -c "'/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE/EnvironmentSetup.sh' && '/home/adi/gitProjects/plcNext-psxcad-integration/tools-executables/plcncli/cmake/bin/cmake' --build . --target install" in /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/intermediate/cmake/AXCF2152,21.0.0.35466/RELEASE.
[cmake]: Scanning dependencies of target CppDataTypeTest
[cmake]: [ 20%] Building CXX object CMakeFiles/CppDataTypeTest.dir/src/CppDataTypeTestComponent.meta.cpp.o
[cmake]: /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/build/CppDataTypeTest/src/CppDataTypeTestComponent.meta.cpp:1:10: fatal error: CppDataTypeTestComponent.hpp: No such file or directory
[cmake]: 1 | #include "CppDataTypeTestComponent.hpp"
[cmake]: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[cmake]: compilation terminated.
[cmake]: make[2]: *** [CMakeFiles/CppDataTypeTest.dir/build.make:63: CMakeFiles/CppDataTypeTest.dir/src/CppDataTypeTestComponent.meta.cpp.o] Error 1
[cmake]: make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/CppDataTypeTest.dir/all] Error 2
[cmake]: make: *** [Makefile:130: all] Error 2
cmake process exited with error
Rollback transaction.
+ mkdir -p /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/AXCF2152_21.0.0.35466
+ cp /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest/bin/AXCF2152_21.0.0.35466/RELEASE/lib/libCppDataTypeTest.so /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/AXCF2152_21.0.0.35466/libCppDataTypeTest.so
cp: cannot stat '/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest/bin/AXCF2152_21.0.0.35466/RELEASE/lib/libCppDataTypeTest.so': No such file or directory
+ echo '###############'
###############
+ echo '###############'
###############
+ plcncli set target --help
plcncli 21.0.0 LTS (21.0.0.489)
Copyright (c) 2018 PHOENIX CONTACT GmbH & Co. KG
-n, --name Required. The target to be added or removed.
-v, --version The version of the target to be added or removed.
-a, --add Indicates that the target should be added to existing
targets.
-r, --remove Indicates that the target should be removed from existing
targets.
-p, --path Directory where the plcnext.proj file is located.
--verbose Enables verbose output.
--quiet Suppresses all output.
--help Display this help screen.
Examples:
Add target to project:
plcncli set target --add -p Path/To/Project -n axcf2152 -v 2019.0
Remove target from project:
plcncli set target --remove --path Path/To/Project --name axcf2152
+ echo '###############'
###############
+ echo '###############'
###############
+ echo ' Add sucessfully build target to project.'
Add sucessfully build target to project.
++ find /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/AXCF2152_21.0.0.35466 -name libCppDataTypeTest.so
+ [[ -n '' ]]
+ rm -r /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/AXCF2152_21.0.0.35466
+ echo 'Failed to build AXCF2152_21.0.0.35466'
Failed to build AXCF2152_21.0.0.35466
+ set +x
ls: cannot access '/home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/*/': No such file or directory
###############
###############
###############
###############
TRY Build All: AXCF2152 Toolchains: 1
V:21.0.0.35466 HW:AXCF2152
Target List: AXCF2152,21.0.0.35466,deploy/AXCF2152_21.0.0.35466/libCppDataTypeTest.so
###############
###############
plcncli 21.0.0 LTS (21.0.0.489)
Copyright (c) 2018 PHOENIX CONTACT GmbH & Co. KG
-p, --path Directory where the plcnext.proj file is located.
-m, --metapath Directory where the library meta files are
located.
-c, --compilationpath Path to the compilation output file(s), if
different from <projectname>/bin.
-o, --output Output directory for the library. The directory
can be either absolute or relative to the project
directory.
-i, --id The GUID for the library.
-t, --target List of targets to add to library:
<target>[,<version>[,<path to compilation file>]].
-s, --sources The path of the source directories separated by
','. Default is the 'src' directory if such a
directory exists. If not, the directory defined
with the '--path' option is used. Relative paths
are relative to the directory defined with the
'--path' option. If any path contains a ' '
quotation marks should be used around all paths,
e.g. "path1,path With Space,path2".
-e, --externallibraries List of external libraries separated by ',' to add
to library. For multibinary libraries: specify
list of libraries separated by ',' which then will
be added for every target or specify per target a
list of libraries.
--verbose Enables verbose output.
--quiet Suppresses all output.
--help Display this help screen.
Examples:
Generate library for all targets supported by project:
plcncli generate library --path Path/To/Project
Generate library for targets AXCF2152 and RFC4072S:
plcncli generate library --path Path/To/Project --target AXCF2152 RFC4072S
Generate library for target with compilation file in special location:
plcncli generate library --path Path/To/Project --target
AXCF2152,2019.0,path/to/Project.so
Generate library with external libraries:
plcncli generate library --path Path/To/Project --externallibraries
AXCF2152,2019.0,path/to/libforaxc.so,path/to/otherlib.so
RFC4072S,path/to/libfornfc.so
###############
###############
+ plcncli generate library --path /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest --output /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy --target AXCF2152,21.0.0.35466,deploy/AXCF2152_21.0.0.35466/libCppDataTypeTest.so --metapath /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../build/CppDataTypeTest/intermediate --verbose
+ tee /home/adi/gitProjects/plcNext-psxcad-integration/CppExamples/tools/../deploy/CppDataTypeTest_GenerateLib.log
Starting library generation...
Change: Create temporary folder /tmp/910F7D1E-75BE-8D4F-8510-975FC26F8DD6
No library file was found in the path 'deploy/AXCF2152_21.0.0.35466/libCppDataTypeTest.so'.
This command is deprecated. Please use 'deploy' instead.
Rollback transaction.
When compiling the Example 3 on its own with plcncli 2021.0.1, the linker throws an exception:
/bin/sh -c "/usr/bin/plcncli" build -p"/home/debianuser/eclipse-workspace-cpp/DataAccess" -b Release
Requested build for targets RFC4072S,21.3.0.25
Starting build for target RFC4072S,21.3.0.25
Checking if CMake needs to be reconfigured...
[cmake]: Scanning dependencies of target DataAccess
[cmake]: [ 25%] Building CXX object CMakeFiles/DataAccess.dir/intermediate/code/DataAccessLibrary.cpp.o
[cmake]: [ 50%] Building CXX object CMakeFiles/DataAccess.dir/intermediate/code/DataAccessLibrary.meta.cpp.o
[cmake]: [ 75%] Building CXX object CMakeFiles/DataAccess.dir/src/DataAccessComponent.cpp.o
[cmake]: [100%] Linking CXX shared library libDataAccess.so
[cmake]: /opt/pxc/2021.3/RFC_4072S/sysroots/x86_64-pokysdk-linux/usr/libexec/x86_64-pxc-linux/gcc/x86_64-pxc-linux/9.3.0/real-ld: CMakeFiles/DataAccess.dir/src/DataAccessComponent.cpp.o:(.data.rel.ro._ZTVN10DataAccess19DataAccessComponentE[_ZTVN10DataAccess19DataAccessComponentE]+0xb0): undefined reference to DataAccess::DataAccessComponent::RegisterComponentPorts()' [cmake]: /opt/pxc/2021.3/RFC_4072S/sysroots/x86_64-pokysdk-linux/usr/libexec/x86_64-pxc-linux/gcc/x86_64-pxc-linux/9.3.0/real-ld: CMakeFiles/DataAccess.dir/src/DataAccessComponent.cpp.o:(.data.rel.ro._ZTVN10DataAccess19DataAccessComponentE[_ZTVN10DataAccess19DataAccessComponentE]+0xe8): undefined reference to
non-virtual thunk to DataAccess::DataAccessComponent::RegisterComponentPorts()'
[cmake]: collect2: error: ld returned 1 exit status
[cmake]: make[2]: *** [CMakeFiles/DataAccess.dir/build.make:140: libDataAccess.so] Error 1
[cmake]: make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/DataAccess.dir/all] Error 2
[cmake]: make: *** [Makefile:130: all] Error 2
cmake process exited with error
This issue can be fixed by adding the reference into DataAccessComponent.cpp
void DataAccessComponents::RegisterComponentPorts() { }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.