Skip to content

Installing using GNU autotools possibly outdated #407

@DharminB

Description

@DharminB

Problem

Installing using GNU autotools steps created following issues

  1. find_package in custom cmake project does not work (since FreeOpcUaConfig.cmake has not been generated)
  2. subset of include files don't get copied to target include dir (e.g. opc/common/logger.h, entire opc/spdlog dir)

Additional info
OS: GNU/Linux (Ubuntu 20.04)
install target: /usr/local
repo branch: master
autoconf version: 2.69
custom cmake project file

cmake_minimum_required(VERSION 3.10.2)
project(my_opcua_proj)

add_compile_options(-std=c++11 -Wall)

find_package(FreeOpcUa REQUIRED)

add_library(my_server
    src/my_server.cpp
)
target_link_libraries(my_server
    ${ADDITIONAL_LINK_LIBRARIES}
    opcuaprotocol
    opcuacore
    opcuaserver
)

where my_server.cpp is exact copy of freeopcua/src/examples/example_server.cpp


Tried Solution

For 1, a temporary "fix" was applied by creating /usr/local/lib/cmake/FreeOpcUaConfig.cmake with following content

# Set the paths for FreeOpcUA
set(FreeOpcUA_INCLUDE_DIRS "/usr/local/include")
set(FreeOpcUA_LIBRARY_DIRS "/usr/local/lib")

# Add the include and library directories to the appropriate variables
list(APPEND CMAKE_INCLUDE_PATH ${FreeOpcUA_INCLUDE_DIRS})
list(APPEND CMAKE_LIBRARY_PATH ${FreeOpcUA_LIBRARY_DIRS})

# Provide information about the FreeOpcUA libraries
set(FreeOpcUA_LIBRARIES "opcuaprotocol opcuacore opcuaserver")

which helped progress to issue 2. where the cmake call succeeds but make call fails with error about unable to find opc/common/logger.h in custom cmake project. This was "fixed" by manually copying logger.h from cloned freeopcua/include/opc/common/ to the respective directory in /usr/local/include. After that, same issue occurs during make call with spdlog files.

Upon uninstalling and removing all the files from target install and installing using cmake instructions worked like a charm.


Possible Conclusion

Maybe 🤷🏽‍♂️ autotools instructions are outdated compared to cmake.

PS: For my use case installation with cmake was sufficient. Just created issue for future users since I could not find anything similar in the open issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions