Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing using GNU autotools possibly outdated #407

Open
DharminB opened this issue Jul 10, 2023 · 1 comment
Open

Installing using GNU autotools possibly outdated #407

DharminB opened this issue Jul 10, 2023 · 1 comment

Comments

@DharminB
Copy link

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.

@guojing555
Copy link

guojing555 commented Jul 10, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants