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

[pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under gcc8 and python312 #63949

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Apr 28, 2024

PR Category

Others

PR Types

Others

Description

修复 #63741 引入的问题

可以在 registry.baidubce.com/device/paddle-cpu:ubuntu18-aarch64-gcc82-python-all 镜像下复现

复现步骤

export PY_VERSION=3.12 CMAKE_BUILD_TYPE=Release WITH_DOC=OFF  WITH_GPU=OFF WITH_DISTRIBUTE=ON WITH_PSCORE=ON WITH_MKL=OFF  WITH_ARM=ON WITH_TESTING=OFF WITH_INFERENCE_API_TEST=OFF WITH_CACHE=ON CMAKE_EXPORT_COMPILE_COMMANDS=ON
# 省略pip install 各种包
bash paddle/scripts/paddle_build.sh build_only
[ 59%] Built target extern_brpc
In file included from /usr/local/include/python3.12/pythread.h:128,
                 from /usr/local/include/python3.12/Python.h:89,
                 from /paddle/paddle/fluid/eager/pylayer/py_layer_node.h:17,
                 from /paddle/paddle/fluid/eager/pylayer/py_layer_node.cc:15:
/usr/local/include/python3.12/cpython/pythread.h:42:31: error: missing initializer for member ‘_Py_tss_t::_key’ [-Werror=missing-field-initializers]
 #define Py_tss_NEEDS_INIT   {0}
                               ^
/paddle/build/third_party/pybind/src/extern_pybind/include/pybind11/detail/../detail/internals.h:82:23: note: in expansion of macro ‘Py_tss_NEEDS_INIT’
                     = Py_tss_NEEDS_INIT;                                                          \
                       ^~~~~~~~~~~~~~~~~
/paddle/build/third_party/pybind/src/extern_pybind/include/pybind11/detail/../detail/internals.h:197:5: note: in expansion of macro ‘PYBIND11_TLS_KEY_INIT’
     PYBIND11_TLS_KEY_INIT(tstate)
     ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/python3.12/cpython/pythread.h:42:31: error: missing initializer for member ‘_Py_tss_t::_key’ [-Werror=missing-field-initializers]
 #define Py_tss_NEEDS_INIT   {0}
                               ^
/paddle/build/third_party/pybind/src/extern_pybind/include/pybind11/detail/../detail/internals.h:82:23: note: in expansion of macro ‘Py_tss_NEEDS_INIT’
                     = Py_tss_NEEDS_INIT;                                                          \
                       ^~~~~~~~~~~~~~~~~
/paddle/build/third_party/pybind/src/extern_pybind/include/pybind11/detail/../detail/internals.h:199:5: note: in expansion of macro ‘PYBIND11_TLS_KEY_INIT’
     PYBIND11_TLS_KEY_INIT(loader_life_support_tls_key)
     ^~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
paddle/fluid/eager/pylayer/CMakeFiles/py_layer_node.dir/build.make:75: recipe for target 'paddle/fluid/eager/pylayer/CMakeFiles/py_layer_node.dir/py_layer_node.cc.o' failed
make[2]: *** [paddle/fluid/eager/pylayer/CMakeFiles/py_layer_node.dir/py_layer_node.cc.o] Error 1
CMakeFiles/Makefile2:59652: recipe for target 'paddle/fluid/eager/pylayer/CMakeFiles/py_layer_node.dir/all' failed
make[1]: *** [paddle/fluid/eager/pylayer/CMakeFiles/py_layer_node.dir/all] Error 2
Makefile:135: recipe for target 'all' failed

closes #63906

Copy link

paddle-bot bot commented Apr 28, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Apr 28, 2024
@gouzil gouzil changed the title [pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under aarch64 and gcc8 [pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under aarch64 and gcc8 only python12 Apr 28, 2024
@gouzil gouzil changed the title [pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under aarch64 and gcc8 only python12 [pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under aarch64 and gcc8 only python312 Apr 28, 2024
@@ -22,6 +22,23 @@ set(SOURCE_INCLUDE_DIR ${SOURCE_DIR}/include)

include_directories(${PYBIND_INCLUDE_DIR})

set(PYBIND_PATCH_COMMAND "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个注释吧,说明这个 patch 可以在 gcc 9.1+ 安全移除

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@SigureMo SigureMo changed the title [pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under aarch64 and gcc8 only python312 [pybind11] Fixed compiling errors for pybind11 -Wmissing-field-initializers under gcc8 and python312 Apr 29, 2024
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@gouzil gouzil merged commit 898ecab into PaddlePaddle:develop Apr 29, 2024
30 checks passed
runzhech pushed a commit to runzhech/Paddle that referenced this pull request Apr 30, 2024
runzhech pushed a commit to runzhech/Paddle that referenced this pull request Apr 30, 2024
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 6, 2024
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 10, 2024
@gouzil gouzil deleted the fix_pybind11_v2_12_0_arm_gcc8 branch July 20, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants