Skip to content

open-source library in PLCnext

Hi,

I was following this tutorial/blog post :"How to include an open-source library in your own C++ project". But I am running in to errors while downloading my Programs into PLC. I also checked the perquisites which are also fine. My setup is as follows

  • PLCnext Engineer →2019.6
  • PLCnext Command Line Interface (CLI) → 2019.0 LTS((19.0.2.779)
  • A suitable PLCnext Software Development Kit (SDK), installed using the CLI. → AXCF2152,2019.0.4 LTS (19.0.4.22338)
  • Eclipse IDE for C/C++ developers, with the PLCnext Technology add-in.→2018-12 with PLCnext add-in

And reading Output.log file does not help much. On the Error line it just says that failed to load library. The ERROR line is as follows.

11.11.19 17:10:27.530 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
Load: Loading of the library '/opt/plcnext/shadowing/libTestprjt.so' failed.

On the basis of this I plan to include Forte (IEC 61499) and Open62541 (open source OPC library) in AXC F 2152.

I am attaching the Output.log file here. Please let me know, if you have any suggestions or encountered similar problem. 

 

Comments

  • Hello,

    It is probably worth upgrading everything to 2020.0, to get the benefit of all the latest features and bug fixes.

    If you don't want to do this - what firmware version is currently on the PLC?

    Are you able to create and run a basic C++ program, based on the default template, without any external libraries? If so, then at what point in the project development does this error appear?

    ~ Martin.

  • Hello,

    "It is probably worth upgrading everything to 2020.0, to get the benefit of all the latest features and bug fixes."

    Yes, I just saw that 2020.0 is released.

    "If you don't want to do this - what firmware version is currently on the PLC?"

    FW  2019.0.4 LTS (19.0.4.22338 )

    "Are you able to create and run a basic C++ program, based on the default template, without any external libraries? If so, then at what point in the project development does this error appear?"

    Yes, I was able to create and run a basic C++ program, based on the default template. With the external libraries. I get errors when I am downloading my C++ program with external lib, even though I have moved my external library (libNE10.so) to the PLC ( /usr/local/lib) and created a symbolic link as well. Basically the error message translates that PLC failed to load my C++ PLC project library (Not external lib) which was created by PLCnext CLI using eclipse add-in, and somehow when downloaded it using PLCnext Engineer it is located on the PLC in a folder called Shadowing.

     

    ~ Muddasir.

  • Hello Muddasir,

    you mentioned that you moved the external Library to your PLC and created symlinks.
    Did you reboot the PLC or execute sudo ldconfig to make the Library known on the system?

    The error that is thrown looks like the library libTestprjt.so links to (properbly lib NE10.so) is not found.

    kind regards,
    Oliver

  • "you mentioned that you moved the external Library to your PLC and created symlinks.
    Did you reboot the PLC or execute sudo ldconfig to make the Library known on the system?"

    Yes, I rebooted the system after ldconfig but error still stays the same. I created the Symlinks using Root access but still it does not work.


     

  • Hello Muddasir,

    if you want you can provide your Application an i will have a look.

    https://phoenixcontact.sharefile.eu/r-r37ba399d58c46a58



    You can check your libraries with

    "ldd /opt/plcnext/shadowing/YourLib.so"

    You should get a list of libraries that YourLib.so links against and an indication if that librarie has been found.

    You can test if libNE10.so is correctly registerd with

     ldconfig -v | grep "*NE10*"

    If it is still not working , double check the permissions that are set on the libNE10.so 
    make it executeable and give read permissions with

    chmod 755 /usr/lib/libNE10.so

  • Hello Oliver,

    Thank you Oliver, this helped in troubleshooting. I was making a mistake that I was only moving .so file and not .so.10 as well. Since this is done, I will move on to doing same process for Open62541. Its OPC UA server basically is blocking application (that is transport layer listening to message on network). Any tips?

     

    Hello Muddasir,

    if you want you can provide your Application an i will have a look.

    https://phoenixcontact.sharefile.eu/r-r37ba399d58c46a58



    You can check your libraries with

    "ldd /opt/plcnext/shadowing/YourLib.so"

    You should get a list of libraries that YourLib.so links against and an indication if that librarie has been found.

    You can test if libNE10.so is correctly registerd with

     ldconfig -v | grep "*NE10*"

    If it is still not working , double check the permissions that are set on the libNE10.so 
    make it executeable and give read permissions with

    chmod 755 /usr/lib/libNE10.so

  • Hello Muddasir,

    If you have a Server Implementation I recommend you have a look at the "MQTT_Client" library and Threading examples in the CppExamples repositories at github.com/PLCnext.

    You should properbly Implement this in a component so you have a save environment for the server that is not impacted by RT events. There you can safely manage your threads ect.
    (usually you want to be able to connect to the Server even if the RT parts is not running.)

    Depending on further needs you can set it up as a PLM or ACF component.


    kind regards,
    Oliver

Sign In or Register to comment.