pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.08k stars 2.05k forks source link

[BUG]: FLTO command line typo results in clang error #5098

Closed gpapan closed 1 month ago

gpapan commented 2 months ago

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

2.12.0

Problem description

I think a bug/typo was introduced in L309 of https://github.com/pybind/pybind11/pull/4642/files. Instead of

HAS_FLTO_THIN "-flto${thin}${cxx_append}" "-flto=${thin}${linker_append}"

it should be

HAS_FLTO_THIN "-flto${thin}${cxx_append}" "-flto${thin}${linker_append}"

This change landed in https://github.com/pybind/pybind11/releases/tag/v2.12.0. The bug is still there in pybind11's current master: tools/pybind11Common.cmake#L328.

The issue above results in linker command containing -flto= or -flto==thin, which result in clang errors like the one below:

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

Reproducible example code

See discussion above.

Is this a regression? Put the last known working version here if it is.

2.11.1