Skip to content

fix(cmake): remove extra = in flto assignment#5207

Merged
henryiii merged 1 commit into
pybind:masterfrom
varunagrawal:mac-flto-fix
Jun 28, 2024
Merged

fix(cmake): remove extra = in flto assignment#5207
henryiii merged 1 commit into
pybind:masterfrom
varunagrawal:mac-flto-fix

Conversation

@varunagrawal

Copy link
Copy Markdown
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.

@varunagrawal
varunagrawal requested a review from henryiii as a code owner June 28, 2024 01:43
@henryiii
henryiii merged commit e0f9e77 into pybind:master Jun 28, 2024
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

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

@varunagrawal

Copy link
Copy Markdown
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.

2 participants