Hello, I’m trying opencv application development for AXCF 2152 based on the web article (https://www.plcnext-community.net/en/?option=com_content&view;=article&id;=266). However, chapter “Configure Eclipse” the setting was different from the screenshot on the website. In detail, Cross G++ Compiler’ tab wasn’t shown. Could you tell me how to set cross g++ complier setting with eclipse 2019.9. I attached the screenshot of eclipse 2019.9 below. Best regards, Atsushi,
Hello Atsushi, in the new PLCnext Eclipse Plugin the settings of your project have to be done by changing the CMakeLists.txt accordingly.
This has been changed so the plcncli can now be used with multiple IDEs
I extended the settings like this:
…
################# project include-paths ############################################### target_include_directories(Rubiks2019 PUBLIC $${CMAKE_CURRENT_SOURCE_DIR}/intermediate/code> $${CMAKE_CURRENT_SOURCE_DIR}/src> PRIVATE $${CMAKE_CURRENT_SOURCE_DIR}/deploy/${ARP_DEVICE}_${_ARP_SHORT_DEVICE_VERSION}/include> $${CMAKE_CURRENT_SOURCE_DIR}/deploy/${ARP_DEVICE}_${_ARP_SHORT_DEVICE_VERSION}/include/opcencv4> ) ...... ################# add link targets #################################################### find_package( ArpDevice REQUIRED ) find_package( ArpProgramming REQUIRED ) find_package( OpenCV REQUIRED ) include_directories( ${OpenCV_INCLUDE_DIRS} ) find_library( AVCODEC_LIBRARY avcodec ) find_library( AVDEVICE_LIBRARY avdevice ) find_library( AVFILTER_LIBRARY avfilter ) find_library( AVFORMAT_LIBRARY avformat ) find_library( AVRESAMPLE_LIBRARY avresample ) find_library( AVUTIL_LIBRARY avutil ) find_library( SWRESAMPLE_LIBRARY swresample ) find_library( SWSCALE_LIBRARY swscale ) target_link_libraries(Rubiks2019 PRIVATE ArpDevice ArpProgramming ${OpenCV_LIBS} ${AVCODEC_LIBRARY} ${AVDEVICE_LIBRARY} ${AVFILTER_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY} ${AVRESAMPLE_LIBRARY} ${SWRESAMPLE_LIBRARY} ${SWSCALE_LIBRARY}) >… here are some files I used to Compile OpenCV with ffmpeg.
https://phoenixcontact.sharefile.eu/d-sd0586edc65c42639[](ShareFile)kind regards,
Olver
Hello Oliver-san, Thank you for the reply. After the modification of CMakelists.txt(I attached below link), I got the following build error. I don’t have “FindOpenCV.cmake”. Could you tell me how to solve this issue? --Error log— /bin/sh -c “/opt/pxc/extract/plcncli” generate code -p"/home/ah/eclipse-workspace/MyProject" -s"src"
Generating all files with the ‘code’ generator for /home/ah/eclipse-workspace/MyProject.
CMake Error at CMakeLists.txt:53 (find_package):
By not providing “FindOpenCV.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “OpenCV”, but
CMake did not find one. Could not find a package configuration file provided by “OpenCV” with any
of the following names: OpenCVConfig.cmake
opencv-config.cmake Add the installation prefix of “OpenCV” to CMAKE_PREFIX_PATH or set
“OpenCV_DIR” to a directory containing one of the above files. If “OpenCV”
provides a separate development package or SDK, be sure it has been
installed. [cmake]: CMake Error: The source directory “/home/ah/eclipse-workspace/MyProject/intermediate/cmake/AXCF2152,20.0.0.24752/Release” does not appear to contain CMakeLists.txt.
[cmake]: Specify --help for usage, or press the help button on the CMake GUI.
Automatic include detection via cmake could not be executed. See log for details.
Successfully generated all files with the ‘code’ generator for /home/ah/eclipse-workspace/MyProject. /bin/sh -c “/opt/pxc/extract/plcncli” generate config -p"/home/ah/eclipse-workspace/MyProject" -s"src"
Generating all files with the ‘config’ generator for /home/ah/eclipse-workspace/MyProject.
CMake Error at CMakeLists.txt:53 (find_package):
By not providing “FindOpenCV.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “OpenCV”, but
CMake did not find one. Could not find a package configuration file provided by “OpenCV” with any
of the following names: OpenCVConfig.cmake
opencv-config.cmake Add the installation prefix of “OpenCV” to CMAKE_PREFIX_PATH or set
“OpenCV_DIR” to a directory containing one of the above files. If “OpenCV”
provides a separate development package or SDK, be sure it has been
installed. [cmake]: CMake Error: The source directory “/home/ah/eclipse-workspace/MyProject/intermediate/cmake/AXCF2152,20.0.0.24752/Release” does not appear to contain CMakeLists.txt.
[cmake]: Specify --help for usage, or press the help button on the CMake GUI.
Automatic include detection via cmake could not be executed. See log for details.
Successfully generated all files with the ‘config’ generator for /home/ah/eclipse-workspace/MyProject. /bin/sh -c “/opt/pxc/extract/plcncli” build -p"/home/ah/eclipse-workspace/MyProject" -b Release
Requested build for targets AXCF2152,20.0.0.24752
Starting build for target AXCF2152,20.0.0.24752
Checking if CMake needs to be reconfigured…
CMake Error at CMakeLists.txt:53 (find_package):
By not providing “FindOpenCV.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “OpenCV”, but
CMake did not find one. Could not find a package configuration file provided by “OpenCV” with any
of the following names: OpenCVConfig.cmake
opencv-config.cmake Add the installation prefix of “OpenCV” to CMAKE_PREFIX_PATH or set
“OpenCV_DIR” to a directory containing one of the above files. If “OpenCV”
provides a separate development package or SDK, be sure it has been
installed. Configuring CMake…
[cmake]: CMake Error: The source directory “/home/ah/eclipse-workspace/MyProject/intermediate/cmake/AXCF2152,20.0.0.24752/Release” does not appear to contain CMakeLists.txt.
[cmake]: Specify --help for usage, or press the help button on the CMake GUI.
cmake process exited with error Best regards, Atsushi
Hello Atsushi-san, but you compiled OpenCV and FFMpeg successfully?
I also added this line to the CMakeLists.txt
################ include arp cmake module path #######################################
list(INSERT CMAKE_MODULE_PATH 0 "${ARP_TOOLCHAIN_CMAKE_MODULE_PATH}") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deploy/${ARP_DEVICE}_${_ARP_SHORT_DEVICE_VERSION}/lib") > kind regards,Oliver
Hello Oliver-san, Thank you for your support. >but you compiled OpenCV and FFMpeg successfully? Yes, but I couldn’t configure “Cross Compiler Setting” and “reprocessor defines” because the configuration on the website is different on the web (https://github.com/savushkin-r-d/PLCnext_howto/tree/master/HowTo%20install%20Linux%20(Ubuntu)%20tools%20for%20C%2B%2B%20programming%20with%20Eclipse%20IDE). I think I should configure but where should I do the configuration? When I add “set (OPENCV_DIR “…”) statement into CMakeLists.txt, the previous error was disappeared but next I got next error. I’m novice at eclipse development. Sorry about this inconvenience. --Error Log-- /bin/sh -c “/opt/pxc/extract/plcncli” generate code -p”/home/ah/eclipse-workspace/MyProject" -s"src"
Generating all files with the ‘code’ generator for /home/ah/eclipse-workspace/MyProject.
CMake Error at CMakeLists.txt:55 (find_package):
By not providing “FindArpDevice.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “ArpDevice”, but
CMake did not find one. … Best regards, Atsushi
I forgot to tell one thing. I searched “FindArpDevice.cmake” in the HostPC but I couldn’t find. I’m not sure if I mistook something but should it be? Best regards, Atsushi
Hello,
sorry the files I uploaded do not have anything to do with the eclipse build.
you compiled the FFMpeg and OpenCV using the files I uploaded?When you place the tools into your Project folder.
You simply do this from the Terminal:
tools/build-ffmpeg.sh -t "${SDK_PATH}" -a "${TARGET_VERSION}" -n "${TARGET_NAME}"tools/build-opencv.sh -t “${SDK_PATH}” -a “${TARGET_VERSION}” -n “${TARGET_NAME}”```
`tools/build-component.sh -t “${SDK_PATH}” -a “${TARGET_VERSION}” -n “${TARGET_NAME}”``The Component is the PLCnext part of the application.
With the correct PLCnext Target added to the project in eclipse you simply build from eclipse using the plcncli. maybe test your installation with:plcncli get targets
plcncli get project-targets
plcncli get sdksYou need the FindArpDevice.cmake…
The SDK holds all the crosscompilers, toolchain and image of the Headers available on the Target PLC.
So without installing the SDK using the plcncli you can not compile for PLCnext controlls…
https://www.plcnext-community.net/en/hn-knowledge-base/hn-tutorials/hn-plcnext-technology/334-install-linux-tools-for-c-programming-with-eclipse-ide.html kind regards,
Oliver.
Hello Oliver-san, Thank you for your support. I’ve built(cross-compiled by the tutorial) opencv and ffmpeg and also installed the target. I didn’t use the uploaded files because the specific version’s library is required. I could find “FindArpDevice.cmake” at /opt/pxc/AXCF2152/2020.0/cmake so I added "set (ArpDevice_DIR “/opt/pxc/AXCF2152/2020.0/cmake”) statement into CMakeLists.txt, but nothing changed… I read that web site(334-install-linux-tools-for-c-programming-with-eclipse-ide.html). My plcncli/sdk version is 2020.0. and sample program made by eclipse works with PLCnext. What I can’t pass is to build with shared library(opencv/ffmpeg). About plcncli command results are here. --result-- plcncli get targets {
“targets”: [
{
“name”: “AXCF2152”,
“version”: “20.0.0.24752”,
“longVersion”: “2020.0 LTS (20.0.0.24752)”,
“shortVersion”: “20.0.0”,
“available”: null
}
]
} plcncli get project-targets {
“targets”: ,
“deprecated”: “This command is deprecated. Please use ‘get project-information’ instead.”
} plcncli get project-information
The project in /opt/pxc/2020.0 does not contain a valid target. Without a valid target port structures from within the SDK can not be generated and automatic include detection will not work as well.
Access to the path ‘/opt/pxc/2020.0/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/home/root’ is denied.
→ Access to the path ‘/opt/pxc/2020.0/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/home/root’ is denied.
→ Permission denied plcncli get sdks {
“sdks”: [
{
“path”: “/opt/pxc/AXCF2152/2020.0”
}
]
} Best regards, Atsushi
Hello Atsushi,
maybe the permission denied is the issue in this case.
make sure that your user has access to the SDK Folder“sudo chown -R youruser:youruser /opt/pxc”
But if you can build a simple test project something else must be going wrong.
If you want I can have a look at your project setup if you upload it here https://phoenixcontact.sharefile.eu/r-r9ba8117239f4afba kind regards,
Oliver
Hello Oliver-san, Thank you for your support. After changing the permission, I got next error. Could you check the configuration? And about “project setup”, what should I upload? Is CMakelists.txt of the project enough? result of “plcncli get project-information”
The project in /home/ah does not contain a valid target. Without a valid target port structures from within the SDK can not be generated and automatic include detection will not work as well.
{
“name”: null,
“namespace”: “ah”,
“type”: “project”,
“targets”: ,
“entities”: [
{
“name”: “MyProjectComponent”,
“namespace”: “MyProject”,
“type”: “component”,
“relatedEntity”: [
“MyProjectProgram”
]
},
{
“name”: “MyProjectProgram”,
“namespace”: “MyProject”,
“type”: “program”,
“relatedEntity”: [
“MyProjectComponent”
]
}
],
“includePaths”: [
{
“exists”: false,
“path”: “intermediate/code”
}
]
} Best regards, Atsushi
Hello Atsushi, so you have not set a target set in your eclipse project. You have to add a target to compile at all.
ow@ubuntu:~$ plcncli new project --name MyDemonstration -o here
Successfully created template ‘project’ in /home/ow/here.
ow@ubuntu:~$ cd here/
ow@ubuntu:~/here$ ls
CMakeLists.txt plcnext.proj src
ow@ubuntu:~/here$ plcncli get project-sdks
{
“sdks”:
}
ow@ubuntu:~/here$ plcncli set target -add -n axcf2152 -v 2020.0
Successfully added target AXCF2152 2020.0 LTS (20.0.0.24752) to project /home/ow/here.
ow@ubuntu:~/here$ plcncli get project-sdks
{
“sdks”: [
{
“path”: “/opt/pxc/release/axcf2152/2020/0”
}
]
} Or do it directly in eclipse
Hello Oliver-san, Thank you for the support. Now the application works with my opencv library on the PLCNext! I use the following statement in the CMakelists.txt before find_package(OpenCV REQUIRED). set(“OpenCV_DIR” “/opt/pxc/install/share/OpenCV”) However, another problem has been raised. I will ask later. Please close this issue. Best regards, Atsushi