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

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

Open
KeaneWong opened this issue Feb 19, 2025 · 2 comments · May be fixed by #207
Open

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

KeaneWong opened this issue Feb 19, 2025 · 2 comments · May be fixed by #207

Comments

@KeaneWong
Copy link

KeaneWong commented Feb 19, 2025

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.

@Carlosespicur
Copy link

Hi @KeaneWong,
if modifying the CMakeLists file works, please feel free to open a PR and we will review it.

@KeaneWong
Copy link
Author

Hi @KeaneWong, if modifying the CMakeLists file works, please feel free to open a PR and we will review it.

Will do. Will say thatt this fix feels a little patch-y, I'll make the change but by all means if there's a better approach I can take let me know. Thank you

@KeaneWong KeaneWong linked a pull request Feb 20, 2025 that will close this issue
9 tasks
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

Successfully merging a pull request may close this issue.

2 participants