8000 Cross-compiled eCAL requires manual Protobuf target definition in CMake configuration · Issue #2218 · eclipse-ecal/ecal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Cross-compiled eCAL requires manual Protobuf target definition in CMake configuration #2218
Open
@sunwenqi0713

Description

@sunwenqi0713

Problem Description

Subject: Cross-compiled eCAL requires manual Protobuf target definition in CMake configuration

Issue Description

After cross-compiling and installing eCAL to a custom prefix (/opt/makeblock), CMake fails to configure dependent projects with the following error:

CMake Error at CMakeLists.txt:14 (find_package):
  Found package configuration file:
    /opt/makeblock/lib/cmake/eCAL/eCALConfig.cmake
  but it set eCAL_FOUND to FALSE so package "eCAL" is considered to be NOT FOUND.  
  Reason given by package:
  The following imported targets are referenced, but are missing:  
  protobuf::libprotobuf

The error occurs because eCALConfig.cmake expects the imported target protobuf::libprotobuf, which is not automatically resolved in the cross-compilation environment.

Workaround

Manually defining Protobuf targets resolves the issue:

# Workaround: Explicitly define missing Protobuf targets
if(NOT TARGET protobuf::libprotobuf)
  add_library(protobuf::libprotobuf SHARED IMPORTED)
  set_target_properties(protobuf::libprotobuf PROPERTIES
    IMPORTED_LOCATION "/opt/makeblock/lib/libprotobuf.so"
    INTERFACE_INCLUDE_DIRECTORIES "/opt/makeblock/include"
  )
endif()

if(NOT TARGET protobuf::libprotobuf-lite)
  add_library(protobuf::libprotobuf-lite SHARED IMPORTED)
  set_target_properties(protobuf::libprotobuf-lite PROPERTIES
    IMPORTED_LOCATION "/opt/makeblock/lib/libprotobuf-lite.so"
    INTERFACE_INCLUDE_DIRECTORIES "/opt/makeblock/include"
  )
endif()

find_package(eCAL REQUIRED)  # Succeeds after manual target definitions

Questions

  1. Expected Behavior?
    Should cross-compiled eCAL automatically propagate Protobuf dependencies, or is manual target definition required?
    If manual setup is expected, should this be documented?

  2. Missing Configuration?
    Does the eCAL build system require additional flags (e.g., -DProtobuf_DIR) when cross-compiling to establish proper target dependencies?

  3. CMake Script Improvement
    Could eCALConfig.cmake include fallback logic to handle cases where protobuf::libprotobuf is not found in the CMake registry?

Additional Context

  • Protobuf was cross-compiled and installed to the same prefix (/opt/makeblock).
  • find_package(Protobuf) works if explicitly called before find_package(eCAL), but eCAL’s config does not invoke this internally.
  • Native (non-cross) builds on x86_64 work without manual intervention.

How to reproduce

When cross-compiling eCAL for ARM64 on an Ubuntu x86_64 host...

How did you get eCAL?

Custom Build / Built from source

Environment

  • OS: Ubuntu 22.04 (host) / ARM64 (target)]
  • eCAL Version: v5.13.3
  • Protobuf Version: v3.12.4
  • CMake Version: 3.26.2
  • Cross-compilation Toolchain: aarch64-linux-gcc-v12.3

eCAL System Information


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

      0