Skip to content

FastDDS Python generates .dylib files instead of .so files on MacOS #206

@KeaneWong

Description

@KeaneWong

Summary:
Installing FastDDS-python using the instructions in the README works fine (just installing with brew instead of apt) except that the generated library file comes in the form of .dylib instead of .so, which python does not recognize.

Reproducing:

  1. Follow README instructions using brew to install dependencies
  2. Export fastdds_python_ws/install/fastdds_python/lib/python3.12/site-packages to PYTHONPATH
  3. Attempt to import fastdds in any python process

Expected Behavior:
The library works like it does on Ubuntu distributions

Actual Behavior
Importing causes the following issue:

ImportError: cannot import name '_fastdds_python' from partially initialized module 'fastdds' (most likely due to a circular import)

Changing the .dylib file to a .so file causes it to work properly. From what I understand, this would normally be fixed by passing
sudo colcon build --cmake-args " -DCMAKE_SHARED_LIBRARY_SUFFIX=.so"

But this does not work.
Instead, the only thing that works is by setting the suffix variable inside fastdds_python_ws/src/fastdds_python/fastdds_python/CMakeLists.txt

I did this by addingset(CMAKE_SHARED_LIBRARY_SUFFIX .so) on line 28, right after project(fastdds_python VERSION 2.2.0).

For some reason, the cache variable is being overwritten by something around project(fastdds_python VERSION 2.2.0).

Proposal
Would it be possible to add the line set(CMAKE_SHARED_LIBRARY_SUFFIX .so) to the fastdds_python CMakeLists? Or otherwise see what is causing the variable to overwrite? In my own investigating I can't seem to pin down the reason.

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