[BUG]: pybind11 does not show compiler output on Windows

未关闭
#5,115 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp, python

调研方向

从使用 pybind11.setup_helpers.Pybind11Extension 和在 Windows 上故意无效的 core.cc 的 setup.py 复现程序开始。将编译器输出的行为与提供的 Linux 命令进行比较,然后验证失败的构建会报告编译器输出,而不需要 Cython。

由索引模型根据 Issue 内容生成。

描述

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

2.12.0

Problem description

When I build a Python project using setuptools, the compiler fails on incorrect C++ files, but it shows no output. If I add the line

from Cython.Build import cythonize

to the top of setup.py the compiler output is restore, but that introduces one more dependency.

Reproducible example code
setup.py:

from setuptools import find_packages, setup, Extension
from pybind11.setup_helpers import Pybind11Extension

pybind11_modules = [
    Pybind11Extension(
        "core",
        [
            "core.cc",
        ],
        cxx_std=17,
    ),
]

setup(ext_modules=pybind11_modules)

core.cc:
```c++
int foo(int x) {
  int a = b;
  return x;
}

Output in Linux:

~/tmp$ python setup.py build_ext --inplace
running build_ext
INFO: Disabling color, you really want to install colorlog.
Disabling color, you really want to install colorlog.
/usr/lib/python3/dist-packages/pythran/tables.py:4530: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  if not hasattr(numpy, method):
/usr/lib/python3/dist-packages/pythran/tables.py:4563: FutureWarning: In the future `np.bytes` will be defined as the corresponding NumPy scalar.
  obj = getattr(themodule, elem)
error: Command "x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/jjgarcia/.quantum/lib/python3.11/site-packages/pybind11/include -I/home/jjgarcia/.quantum/include -I/usr/include/python3.11 -c core.cc -o build/temp.linux-x86_64-cpython-311/core.o -fvisibility=hidden -g0 -std=c++17" failed with exit status 1


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

Not a regression
主要语言
C++
星标
18k
派生
2.3k
平均合并
5 天 7 小时
30 天内合并 PR
53

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pybind/pybind11 的其他 Issue

查看 pybind/pybind11 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。