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

Fix macOS boost-python issues #4903

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

akashlevy
Copy link
Contributor

@akashlevy akashlevy commented Feb 14, 2025

What are the reasons/motivation for this change?

This PR resolves the issue below seen on my macOS Apple Silicon with a vanilla Yosys clone:

akashlevy@Akashs-MacBook-Pro yosys % make -j8 ENABLE_PYOSYS=1
$BREW_PREFIX is [/opt/homebrew/opt]
Makefile:343: *** BOOST_PYTHON_LIB could not be detected. Please define manually.  Stop.

There are two issues:

  1. The boost include path is incorrect ($(BREW_PREFIX)/boost/include/boost instead of $(BREW_PREFIX)/boost/include). This means that the canonical form of Boost includes such as #include <boost/...> will not work
  2. boost-python3 library needs to be linked to detect boost-python3 properly

You can work around these issues by manually setting the BOOST_PYTHON_LIB, but this PR makes it so that is not needed.

Explain how this is achieved.

  1. Use $(BREW_PREFIX)/boost/include as the Boost include path
  2. Add -L$(BREW_PREFIX)/boost-python3/lib to the LINKFLAGS and include LINKFLAGS in CHECK_BOOST_PYTHON

If applicable, please suggest to reviewers how they can test the change.

This was tested on an Apple Silicon macOS (M2) with Pyosys enabled and was able to properly compile. I do not have access to an Intel macOS, it would be great if this can be tested against some builds as well.

@KrystalDelusion
Copy link
Member

Would you be willing to add a ci job for pyosys to the extra-builds.yml? If you use a strategy matrix you can specify both macos-latest (which uses M1) and macos-13 (which is Intel based); maybe throw in ubuntu-latest for well-roundedness.

@akashlevy
Copy link
Contributor Author

Certainly, I can try to do that when I get time

@KrystalDelusion KrystalDelusion self-assigned this Feb 20, 2025
`python-config --ldflag` includes output of `python-config --libs`; and the `$(CXX)` call in `CHECK_BOOST_PYTHON` still needs those libs.
Move all of the `$(shell $(PYTHON_CONFIG) ..` lines to the top of the block.
@KrystalDelusion KrystalDelusion merged commit 9d3ab96 into YosysHQ:main Feb 20, 2025
25 checks passed
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 this pull request may close these issues.

2 participants