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

MAINT: fix a C++ build error with GCC 13 #19409

Merged
merged 1 commit into from Oct 19, 2023

Conversation

tirthasheshpatel
Copy link
Member

Reference issue

None

What does this implement/fix?

Compiling SciPy with GCC 13 gives the following error:

FAILED: scipy/io/_fast_matrix_market/_fmm_core.cpython-311-x86_64-linux-gnu.so.p/src__fmm_core.cpp.o 
ccache c++ -Iscipy/io/_fast_matrix_market/_fmm_core.cpython-311-x86_64-linux-gnu.so.p -Iscipy/io/_fast_matrix_market -I../scipy/io/_fast_matrix_market -I../scipy/io/_fast_matrix_market/fast_matrix_market/include -I../../virtualenvs/scipy-dev/lib/python3.11/site-packages/numpy/core/include -I../scipy/io/_fast_matrix_market/fast_matrix_market/dependencies/fast_float/include -Iscipy/io/_fast_matrix_market/fast_matrix_market/dependencies/ryu -I../scipy/io/_fast_matrix_market/fast_matrix_market/dependencies/ryu -I/usr/include/python3.11 -I/usr/local/google/home/tirthp/oss/virtualenvs/scipy-dev/lib/python3.11/site-packages/pybind11/include -I/usr/include/x86_64-linux-gnu/python3.11 -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -O2 -g -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION -DFMM_SCIPY_PRUNE -DFMM_USE_FAST_FLOAT -DFMM_USE_RYU -DFMM_FROM_CHARS_INT_SUPPORTED -DFMM_TO_CHARS_INT_SUPPORTED -MD -MQ scipy/io/_fast_matrix_market/_fmm_core.cpython-311-x86_64-linux-gnu.so.p/src__fmm_core.cpp.o -MF scipy/io/_fast_matrix_market/_fmm_core.cpython-311-x86_64-linux-gnu.so.p/src__fmm_core.cpp.o.d -o scipy/io/_fast_matrix_market/_fmm_core.cpython-311-x86_64-linux-gnu.so.p/src__fmm_core.cpp.o -c ../scipy/io/_fast_matrix_market/src/_fmm_core.cpp
../scipy/io/_fast_matrix_market/src/_fmm_core.cpp:8:54: error: ‘uint32_t’ does not name a type
    8 |     field_type get_field_type([[maybe_unused]] const uint32_t* type) {
      |                                                      ^~~~~~~~
../scipy/io/_fast_matrix_market/src/_fmm_core.cpp:6:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
    5 | #include <fast_matrix_market/types.hpp>
  +++ |+#include <cstdint>
    6 | namespace fast_matrix_market {
../scipy/io/_fast_matrix_market/src/_fmm_core.cpp:12:54: error: ‘uint64_t’ does not name a type
   12 |     field_type get_field_type([[maybe_unused]] const uint64_t* type) {
      |                                                      ^~~~~~~~
../scipy/io/_fast_matrix_market/src/_fmm_core.cpp:12:54: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
../scipy/io/_fast_matrix_market/src/_fmm_core.cpp:12:16: error: redefinition of ‘fast_matrix_market::field_type fast_matrix_market::get_field_type(const int*)’
   12 |     field_type get_field_type([[maybe_unused]] const uint64_t* type) {
      |                ^~~~~~~~~~~~~~
../scipy/io/_fast_matrix_market/src/_fmm_core.cpp:8:16: note: ‘fast_matrix_market::field_type fast_matrix_market::get_field_type(const int*)’ previously defined here
    8 |     field_type get_field_type([[maybe_unused]] const uint32_t* type) {
      |                ^~~~~~~~~~~~~~
[1282/1607] Generating scipy/linalg/flapack_module with a custom command
ninja: build stopped: subcommand failed.
Build failed!

This PR fixes the error by explicitly including the <cstdint> header.

@tirthasheshpatel tirthasheshpatel added the Build issues Issues with building from source, including different choices of architecture, compilers and OS label Oct 19, 2023
Copy link
Contributor

@tylerjereddy tylerjereddy left a comment

Choose a reason for hiding this comment

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

I reproduced the error locally with gcc 13.2.0 on x86_64 Linux and confirmed the fix with this feature branch. Should we quickly check with @alugowski perhaps?

@tylerjereddy tylerjereddy added this to the 1.12.0 milestone Oct 19, 2023
@tirthasheshpatel
Copy link
Member Author

Sounds good. Would be nice if @alugowski can confirm this.

@alugowski
Copy link
Contributor

Yes, that fixes the issue.

@tylerjereddy tylerjereddy merged commit 541f213 into scipy:main Oct 19, 2023
21 of 23 checks passed
@tylerjereddy
Copy link
Contributor

thanks!

@tirthasheshpatel tirthasheshpatel deleted the fix-build-error branch October 19, 2023 21:21
alugowski added a commit to alugowski/scipy that referenced this pull request Nov 3, 2023
Keep in sync with upstream.

The changes are purely on the C++ side. Mainly:
 * Fix `#include` errors on GCC 13, though this has already been patched in scipy#19409
 * Support for C++23 fixed-width floating point types, and string types.
alugowski added a commit to alugowski/scipy that referenced this pull request Nov 3, 2023
Keep in sync with upstream.

The changes are purely on the C++ side. Mainly:
 * Fix `#include` errors on GCC 13, though this has already been patched in scipy#19409
 * Support for C++23 fixed-width floating point types, and string types.
 * New mechanism to handle `symmetric` Matrix Market files. May in the future replace the current Python method.
perimosocordiae pushed a commit to perimosocordiae/scipy that referenced this pull request Nov 8, 2023
Keep in sync with upstream.

The changes are purely on the C++ side. Mainly:
 * Fix `#include` errors on GCC 13, though this has already been patched in scipy#19409
 * Support for C++23 fixed-width floating point types, and string types.
 * New mechanism to handle `symmetric` Matrix Market files. May in the future replace the current Python method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build issues Issues with building from source, including different choices of architecture, compilers and OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants