Ne10 library integration error

Hi, I need to use libtiff library for my project on PLCnext. Before diving into it, I wanted to try the sample of 3rd party library integration of Ne10 library. I was able to build the libNe10.so file. However , in the second section of writing and C++ program and calling the Ne10 files is where I am stuck. I am getting the below cmake error. of missing NE10_ LIBRARY. I tried a few things to include the files in the FindNE10.cmake file, - I used the absolute path of the librarries for Ne10/inc files - didn’t work

- Put the files under /usr/include and then tried to make , but failed Please help me understand the problem, Below are the logs, - Configuring incomplete, errors occurred!
See also “/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423/CMakeFiles/CMakeOutput.log”.
See also “/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423/CMakeFiles/CMakeError.log”.
[0/1] Re-running CMake…
CMake Error at /home/umesh/.local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find NE10 (missing: NE10_LIBRARY)
Call Stack (most recent call first):
/home/umesh/.local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindNE10.cmake:17 (find_package_handle_standard_args)
CMakeLists.txt:49 (find_package) Regards,
Umesh

Hello Umesh, This error:

Could NOT find NE10 (missing: NE10_LIBRARY)

… indicates that it cannot find the .so file that you successfully cross-compiled. But it looks like you are focusing only on the header files? Your program will need the NE10 header files to compile - and this looks like it might be OK - but the linker will also need to find the NE10 library (.so) file to check that it includes the functions defined in the header files. In the example in the Makers Blog, the .so file is located in the relative path build/axcf2152/external/Ne10/modules, and this is specified in the FindNE10.cmake file. You may need to change this path to the one containing your NE10 library. Hope this helps. Martin.

Thanks for your swift reply Martin, it worked.

Hi Martin, I was able to compile the project with Ne10 library. I was trying to do the same with libtiff library.

Running into the below error. I have attached the screenshots of my project structure.

CMAKE Configure
CMake Error at CMakeLists.txt:41 (target_link_options):
Unknown CMake command “target_link_options”.

-- Configuring incomplete, errors occurred!
See also “/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423/CMakeFiles/CMakeOutput.log”.
See also “/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423/CMakeFiles/CMakeError.log”.
[0/1] Re-running CMake…
-- Could NOT find LIBTIFF (missing: LIBTIFF_INCLUDE_DIR LIBTIFF_LIBRARY)
-- Configuring done
CMake Error at CMakeLists.txt:16 (add_executable):
Target “runtime” links to target “LIBTIFF::LIBTIFF” but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?

CMake Error at CMakeLists.txt:16 (add_executable):
Target “runtime” links to target “LIBTIFF::LIBTIFF” but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
FAILED: build.ninja
/home/umesh/.local/bin/cmake -S/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423 -B/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423
ninja: error: rebuilding ‘build.ninja’: subcommand failed Regards, Umesh



2020_Whitepaper-aws-hosting.pdf

Hi Umesh, Can you please post the contents of your CMakeLists.txt file? What directory is the FindTIFF.cmake file located in? I notice from the Visual Studio Code editor that the FindTIFF.cmake file has unsaved changes … this might not be a problem, but worth checking. Martin.

Martin, FindTiff.cmake is under the cmake directory . I did save the FindTiff.cmake file, however getting the same error. CMakeLists.txt – cmake_minimum_required(VERSION 3.10)

project(runtime)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

################# create target #######################################################

set (WILDCARD_SOURCE *.cpp)
set (WILDCARD_HEADER *.h *.hpp *.hxx)

file(GLOB_RECURSE Headers src/${WILDCARD_HEADER})
file(GLOB_RECURSE Sources src/${WILDCARD_SOURCE})
add_executable(runtime ${Headers} ${Sources})

#######################################################################################

################# project include-paths ###############################################

target_include_directories(runtime
PUBLIC
$CURRENT_SOURCE_DIR}/src>)

#######################################################################################

################# include arp cmake module path #######################################

list(INSERT CMAKE_MODULE_PATH 0 “${ARP_TOOLCHAIN_CMAKE_MODULE_PATH}”)
list(APPEND CMAKE_MODULE_PATH “${PROJECT_SOURCE_DIR}/cmake”)

#######################################################################################

################# set link options ####################################################

WARNING: Without --no-undefined the linker will not check, whether all necessary

libraries are linked. When a library which is necessary is not linked,

the firmware will crash and there will be NO indication why it crashed.

#######################################################################################

target_link_options(runtime PRIVATE LINKER:–no-undefined)

#######################################################################################

################# add link targets ####################################################

find_package(ArpDevice REQUIRED)
find_package(ArpProgramming REQUIRED)
find_package(TIFF REQUIRED)
#find_package(NE10 REQUIRED)

#target_link_libraries(runtime PRIVATE ArpDevice ArpProgramming NE10::NE10)
target_link_libraries(runtime PRIVATE ArpDevice ArpProgramming LIBTIFF)

#######################################################################################

################# install ############################################################

string(REGEX REPLACE “^.\\\\(([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).$” “\\\\1” ARP_SHORT_DEVICE_VERSION ${ARP_DEVICE_VERSION})
install(TARGETS runtime
LIBRARY DESTINATION ${ARP_DEVICE}
${ARP_SHORT_DEVICE_VERSION}/$/lib
ARCHIVE DESTINATION ${ARP_DEVICE}
${ARP_SHORT_DEVICE_VERSION}/$/lib
RUNTIME DESTINATION ${ARP_DEVICE}
${_ARP_SHORT_DEVICE_VERSION}/$/bin)
unset(_ARP_SHORT_DEVICE_VERSION)

#######################################################################################

Please try this FindTIFF.cmake file:

set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)

find_path(TIFF_INCLUDE_DIR
    NAMES LIBTIFF.h
    PATHS external/libtiff/inc
)
find_library(TIFF_LIBRARY
    NAMES tiff
    PATHS build/axcf2152/external/libtiff/modules
)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(TIFF
    DEFAULT_MSG
    TIFF_INCLUDE_DIR TIFF_LIBRARY
)

if(TIFF_FOUND)
    set(TIFF_LIBRARIES ${TIFF_LIBRARY})
    set(TIFF_INCLUDE_DIRS ${TIFF_INCLUDE_DIR})
endif()

if(TIFF_FOUND AND NOT TARGET TIFF::TIFF)
    add_library(TIFF::TIFF UNKNOWN IMPORTED)
    set_target_properties(TIFF::TIFF PROPERTIES
        IMPORTED_LOCATION "${TIFF_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${TIFF_INCLUDE_DIR}"
    )
endif()

mark_as_advanced(
    TIFF_INCLUDE_DIR TIFF_INCLUDE_DIRS
    TIFF_LIBRARY TIFF_LIBRARIES)

… and in the CMakeLists.txt file, please change this line:

target_link_libraries(runtime PRIVATE ArpDevice ArpProgramming LIBTIFF)

to this:

target_link_libraries(runtime PRIVATE ArpDevice ArpProgramming TIFF::TIFF)

Made the changes, Library is included now, but the include dir is still giving error, -- Configuring incomplete, errors occurred!

See also “/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423/CMakeFiles/CMakeOutput.log”.
See also “/home/umesh/Projects/runtime/build/AXCF2152_19.6.3.22423/build/AXCF2152_19.6.3.22423/CMakeFiles/CMakeError.log”.
[0/1] Re-running CMake…
CMake Error at /home/umesh/.local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find TIFF (missing: TIFF_INCLUDE_DIR)
Call Stack (most recent call first):
/home/umesh/.local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
cmake/FindTIFF.cmake:15 (find_package_handle_standard_args)
CMakeLists.txt:49 (find_package)

OK, it’s telling you that it can’t find the LIBTIFF.h file in the path external/libtiff/inc (relative to the location of the CMakeLists.txt file). From the screen shot it looks like that header file might be in a different path - something with cmake in the path. Please check this and update the Find file with the correct path to that header file. Also, it’s worth mentioning that different open-source projects provide different levels of CMake support. The NE10 example was just the way we got that project built based on the CMake support provided by the NE10 library. Other libraries may have different CMake support - e.g. for some, it is not necessary to create your own FindXXX.cmake module. I am no CMake expert, so if you will be using CMake extensively in your own projects it would be worth getting in touch with people who know more about CMake than we do here - perhaps a chat group for the open source library(s) that you plan to use in your project. There are also lots of resources out there for learning CMake, which I plan to study closely at some point in the future. :slight_smile: Martin.

Sure, thanks will check that.