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

Cross compiling a dependent application with cmake - host idlc and cycloneddsidlcxx #364

Open
Entropy512 opened this issue Jan 25, 2023 · 2 comments

Comments

@Entropy512
Copy link

This is somewhat of a continuation of the conversation in eclipse-cyclonedds/cyclonedds#794 (comment)

I'm trying to start from @stan-guer 's comment, adapting it to use cyclonedds-cxx:

if(CMAKE_CROSSCOMPILING)
  include("${Cyclone_HOST_PREFIX}/lib/cmake/CycloneDDS-CXX/idlcxx/Generate.cmake")
endif()

idlcxx_generate(TARGET messages FILES HelloWorldData.idl WARNINGS no-implicit-extensibility)

(yes, I'm starting with trying to cross-compile hello world as a standalone dependent app with some restructuring of the file tree - since the example is dependent on being built within the cyclonedds source tree)

I've set Cyclone_HOST_PREFIX in my toolchain file to where I installed the host-architecture build of cyclonedds and cyclonedds-cxx (In my case, ~/cyclonedds_host)

The question is - how do I add Cyclone_HOST_PREFIX to the search path so that find_library() works for cycloneddsidlcxx? I get the following:

CMake Error at /home/adodd/cyclonedds_host/lib/cmake/CycloneDDS-CXX/idlcxx/Generate.cmake:27 (find_library):
  Could not find _idlcxx_shared_lib using the following names:
  cycloneddsidlcxx
Call Stack (most recent call first):
  idl/CMakeLists.txt:5 (idlcxx_generate)

Adding Cyclone_HOST_PREFIX to CMAKE_FIND_ROOT_PATH does not work.

@Entropy512
Copy link
Author

I've made a bit of progress, first - need to include idlc/Generate.cmake too:

if(CMAKE_CROSSCOMPILING)
  include("${Cyclone_HOST_PREFIX}/lib/cmake/CycloneDDS-CXX/idlcxx/Generate.cmake")
  include("${Cyclone_HOST_PREFIX}/lib/cmake/CycloneDDS/idlc/Generate.cmake")
endif()

In addition, after a bit of digging into cmake_fu, I figured out WHY my current protobuf cross-compile stuff is working in another project (One of the variables I set overrides find_program), and adapted it to the variables used by Generate.cmake:

set(Cyclone_HOST_PREFIX $ENV{HOME}/cyclonedds_host)
set(_idlcxx_shared_lib ${Cyclone_HOST_PREFIX}/lib/libcycloneddsidlcxx.so.0.11.0)
set(_idlc_executable ${Cyclone_HOST_PREFIX}/bin/idlc)

Now the problem is that the generator expects the -o option to work properly, but it does not - I am guessing this is due to #148 not yet being adapted to eclipse-cyclonedds/cyclonedds#1263

@alexleel
Copy link

alexleel commented Apr 7, 2023

Hi @Entropy512
I got a similar issue as "Could not find _idlc_executable using the following names: idlc" when I set -DBUILD_EXAMPLES=ON.
Could you please help to trouble shooting it?
I did not find cyclonedds_host in my machine

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