[Bug 294485] devel/pybind11: bad pkg-config (.pc) file and duplication with devel/py-pybind11

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 13 Apr 2026 17:46:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294485

            Bug ID: 294485
           Summary: devel/pybind11: bad pkg-config (.pc) file and
                    duplication with devel/py-pybind11
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: yuri@freebsd.org
          Reporter: jcfyecrayz@liamekaens.com
             Flags: maintainer-feedback?(yuri@freebsd.org)
          Assignee: yuri@freebsd.org

The pybind11.pc file that is installed is bad:
  - Installed in <prefix>/share/pkgconfig instead of the standard freebsd
location: <prefix>/libdata/pkgconfig
  - The prefix value is bad (empty)
  - Conflicts with bin/pybind11-config (from devel/py-pybind11) result in
confusion about which include paths should be used.  For example, when both
devel/py-pybind11 and devel/pybind11 are installed:
    - py-scipy's meson.build has:
      - pybind11_dep = dependency('pybind11', version: '>=2.13.2')
    - 'pkg-config --cflags pybind11' when devel/pybind11 is preferred over
bin/pybind11-config. Currently that provides a bad set of -I flags because of
the bad .pc file.
    - But if only devel/py-pybind11 is installed, the -I flags produced by
bin/pybind11-config are different (and they are not incorrect - although read
below about duplication of .h files)
    - meson's dependency() function will use the results from pkg-config
--cflags first, resulting in a different set of -I flags than the set from
pybind11-config.  Currently this causes science/py-scipy 1.10.2 to fail to find
pybind11.h because of the bad pybind11.pc.

Second, there is duplication between devel/pybind11 and devel/py-pybind11. 
They both install the same .h files in a include/pybind11/ directory.  The
former in <PREFIX>/include.  The latter in
<PYTHONPREFIX_SITELIBDIR>/pybind11/include/pybind11.  Similarly, they both
install .cmake files - and py-pybind11 also installs a .pc file as it turns out
(that is buried under site-packages, so will never be found by pkgconf by
default, but it's prefix value is not empty).

There may be a case for having just the header files for use by c++ projects
(and probably the .cmake files).

If it makes little sense to have a pkg with just header files and not
<python>/site-packages/ then maybe devel/pybind11 and devel/py-pybind11 should
just be combined.

But maybe there is a case for just having the <python>/site-packages in one
package (probably for py ports that would want it as a RUN_DEPEND) and a
separate port with just the .h files (as a BUILD_DEPEND).

If separate ports still make sense (really only if there is a run-time need for
the site-packages/pybind11/*.py files - it's not clear to me these are not ONLY
useful at build-time - apologies for the possibly confusing double negative), I
am not sure which one should have the .cmake files - probably pybind11 as a
BUILD_DEPEND since there's no need for .cmake files in a run-time context.  And
keeping the .cmake and .h files out of a pure python package allows for
concurrent installs of different python version for the py-pybind11 package.

Either way (combined port or separate ports), pulling the cmake files and .h
and .pc files out from under <python>/site-packages into <prefix>/include and
<prefix>/share/cmake is probably best, although I don't know how much the
pybind11 build process makes that harder to do.  And fixing the .pc file, of
course.

-- 
You are receiving this mail because:
You are the assignee for the bug.