fix: expose required symbol using clang (#5700)

* test: Added test case for visibility of common symbols across shared libraries

* style: pre-commit fixes

* tests: cmake target name fix

* tests: Added visibility test to ci

* tests: set the default visibility to hidden

* prototype/proof-of-concept fix: PYBIND11_EXPORT_GUARDED_DELETE

* Fix silly oversight: actually use PYBIND11_EXPORT_GUARDED_DELETE

* Update struct_smart_holder.h

* style: pre-commit fixes

* Update include/pybind11/detail/struct_smart_holder.h

* Update struct_smart_holder.h

* ci: fix addition to reusable-standard.yml

* Update CMakeLists.txt

* refactor: rename tests to test_cross_module_rtti

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
This commit is contained in:
Peter Steneteg
2025-06-03 22:02:19 +02:00
committed by GitHub
parent d4d2ec1ad8
commit b19489145b
11 changed files with 268 additions and 3 deletions

View File

@@ -230,6 +230,9 @@ jobs:
- name: Interface test
run: cmake --build . --target test_cmake_build
- name: Visibility test
run: cmake --build . --target test_cross_module_rtti
manylinux:
name: Manylinux on 🐍 3.13t • GIL
@@ -328,6 +331,9 @@ jobs:
- name: C++ tests
run: cmake --build --preset default --target cpptest
- name: Visibility test
run: cmake --build --preset default --target test_cross_module_rtti
- name: Run Valgrind on Python tests
if: matrix.valgrind
run: cmake --build --preset default --target memcheck
@@ -386,6 +392,8 @@ jobs:
- name: Interface test
run: cmake --build build --target test_cmake_build
- name: Visibility test
run: cmake --build build --target test_cross_module_rtti
# Testing NVCC; forces sources to behave like .cu files
cuda:
@@ -505,6 +513,8 @@ jobs:
- name: Interface test
run: cmake --build build --target test_cmake_build
- name: Visibility test
run: cmake --build build --target test_cross_module_rtti
# Testing on GCC using the GCC docker images (only recent images supported)
gcc:
@@ -556,6 +566,9 @@ jobs:
- name: Interface test
run: cmake --build build --target test_cmake_build
- name: Visibility test
run: cmake --build build --target test_cross_module_rtti
- name: Configure - Exercise cmake -DPYBIND11_TEST_OVERRIDE
if: matrix.gcc == '12'
shell: bash
@@ -638,6 +651,11 @@ jobs:
set +e; source /opt/intel/oneapi/setvars.sh; set -e
cmake --build build-11 --target test_cmake_build
- name: Visibility test
run: |
set +e; source /opt/intel/oneapi/setvars.sh; set -e
cmake --build build-11 --target test_cross_module_rtti
- name: Configure C++17
run: |
set +e; source /opt/intel/oneapi/setvars.sh; set -e
@@ -670,6 +688,10 @@ jobs:
set +e; source /opt/intel/oneapi/setvars.sh; set -e
cmake --build build-17 --target test_cmake_build
- name: Visibility test
run: |
set +e; source /opt/intel/oneapi/setvars.sh; set -e
cmake --build build-17 --target test_cross_module_rtti
# Testing on CentOS (manylinux uses a centos base).
centos:
@@ -732,6 +754,9 @@ jobs:
- name: Interface test
run: cmake --build build --target test_cmake_build
- name: Visibility test
run: cmake --build build --target test_cross_module_rtti
# This tests an "install" with the CMake tools
install-classic:
@@ -961,6 +986,9 @@ jobs:
- name: Interface test C++20
run: cmake --build build --target test_cmake_build
- name: Visibility test
run: cmake --build build --target test_cross_module_rtti
- name: Configure C++20 - Exercise cmake -DPYBIND11_TEST_OVERRIDE
run: >
cmake -S . -B build_partial
@@ -1034,6 +1062,9 @@ jobs:
- name: Interface test C++11
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target test_cmake_build
- name: Visibility test
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target test_cross_module_rtti
- name: Clean directory
run: git clean -fdx
@@ -1055,6 +1086,9 @@ jobs:
- name: Interface test C++14
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target test_cmake_build
- name: Visibility test
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target test_cross_module_rtti
- name: Clean directory
run: git clean -fdx
@@ -1076,6 +1110,9 @@ jobs:
- name: Interface test C++17
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cmake_build
- name: Visibility test
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target test_cross_module_rtti
windows_clang:
if: github.event.pull_request.draft == false
@@ -1143,6 +1180,9 @@ jobs:
- name: Interface test
run: cmake --build . --target test_cmake_build -j 2
- name: Visibility test
run: cmake --build . --target test_cross_module_rtti -j 2
- name: Clean directory
run: git clean -fdx
@@ -1210,6 +1250,9 @@ jobs:
- name: Interface test
run: cmake --build . --target test_cmake_build -j 2
- name: Visibility test
run: cmake --build . --target test_cross_module_rtti -j 2
- name: CMake Configure - Exercise cmake -DPYBIND11_TEST_OVERRIDE
run: >
cmake -S . -B build_partial

View File

@@ -74,6 +74,9 @@ jobs:
- name: Interface test
run: cmake --build build --target test_cmake_build
- name: Visibility test
run: cmake --build build --target test_cross_module_rtti
- name: Setuptools helpers test
run: |
uv pip install --python=python --system setuptools