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(cmake): remove extra = in flto assignment #5207

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

varunagrawal
Copy link
Contributor

Description

When compiling a library with Pybind11 v2.13.1 on MacOS with Clang, CMake throws the error

clang: error: unsupported argument '' to option 'flto='

This is due to a stray = when defining flto= in the Clang case within pybind11Common.cmake.
This PR fixes this issue by removing the extra =, and after that the library compiles normally.

Suggested changelog entry:

Remove extra = when assigning flto value in the case for Clang.

@henryiii henryiii merged commit e0f9e77 into pybind:master Jun 28, 2024
84 checks passed
@henryiii henryiii changed the title Remove extra = in flto assignment fix(cmake): remove extra = in flto assignment Jun 28, 2024
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jun 28, 2024
@henryiii
Copy link
Collaborator

FYI, as a way to work around this, you can use CMake instead of our custom flags by defining CMAKE_INTERPROCEDURAL_OPTIMIZATION.

@varunagrawal
Copy link
Contributor Author

@henryiii I saw the note about CMAKE_INTERPROCEDURAL_OPTIMIZATION in the compiling.rst doc but figured a more fundamental fix would be nice to have so things work out of the box. :)

@varunagrawal varunagrawal deleted the mac-flto-fix branch June 28, 2024 02:37
@henryiii
Copy link
Collaborator

Sure, just wanted to make sure you weren't stuck until the next release. Really hoping CPython 3.13b3 comes out soon so we can move to PyMutex for 3.13 before release, but we might need the GCC 9 fix sooner.

I think this bug has been around for a while. Don't think we've touched this too much recently.

@henryiii
Copy link
Collaborator

Thanks, by the way, if I didn't say so before. :)

@varunagrawal
Copy link
Contributor Author

You're very welcome. Happy to contribute fixes and reduce your burden where I can (in contrast to just raising an issue).

Thank you for the prompt response. Pybind is in good hands.

@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants