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

BLD/DEV: special: build warnings #20740

Open
4 of 5 tasks
fancidev opened this issue May 18, 2024 · 9 comments
Open
4 of 5 tasks

BLD/DEV: special: build warnings #20740

fancidev opened this issue May 18, 2024 · 9 comments
Labels
Build issues Issues with building from source, including different choices of architecture, compilers and OS DX Everything related to making the experience of working on SciPy more pleasant scipy.special
Milestone

Comments

@fancidev
Copy link
Contributor

fancidev commented May 18, 2024

There are some warning messages when building SciPy on MacOS (duplicate warnings with the same cause are removed for clarity):

  • 1:
[48/1383] Generating symbol file scipy/special/libsf_error_state.dylib.p/libsf_error_state.dylib.symbols
WARNING: ['arm64-apple-darwin20.0.0-nm'] does not work. Relinking will always happen on source changes.
error: arm64-apple-darwin20.0.0-nm: invalid argument --
Usage: arm64-apple-darwin20.0.0-nm [-agnopruUmxjlfAPL[s segname sectname] [-] [-t format] [[-arch <arch_flag>] ...] [file ...]
[71/1383] Compiling C++ object scipy/special/_gufuncs.cpython-310-darwin.so.p/_gufuncs.cpp.o
../scipy/special/_gufuncs.cpp:57:5: warning: mixture of designated and non-designated initializers in the same initializer list is a C99 extension [-Wc99-designator]
    .m_name = "_gufuncs",
    ^~~~~~~~~~~~~~~~~~~~
../scipy/special/_gufuncs.cpp:56:5: note: first non-designated initializer is here
    PyModuleDef_HEAD_INIT,
    ^~~~~~~~~~~~~~~~~~~~~
/Users/lucascolley/mambaforge/envs/scipy-dev/include/python3.10/moduleobject.h:51:31: note: expanded from macro 'PyModuleDef_HEAD_INIT'
#define PyModuleDef_HEAD_INIT { \
                              ^~~
1 warning generated.
[90/1383] Compiling C++ object scipy/special/_special_ufuncs.cpython-310-darwin.so.p/_special_ufuncs.cpp.o
../scipy/special/_special_ufuncs.cpp:210:5: warning: mixture of designated and non-designated initializers in the same initializer list is a C99 extension [-Wc99-designator]
    .m_name = "_special_ufuncs",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../scipy/special/_special_ufuncs.cpp:209:5: note: first non-designated initializer is here
    PyModuleDef_HEAD_INIT,
    ^~~~~~~~~~~~~~~~~~~~~
/Users/lucascolley/mambaforge/envs/scipy-dev/include/python3.10/moduleobject.h:51:31: note: expanded from macro 'PyModuleDef_HEAD_INIT'
#define PyModuleDef_HEAD_INIT { \
                              ^~~
1 warning generated.
  • The following warning has been there for a few weeks: (fixed by commit 727e8e6)
[14/260] Compiling C++ object scipy/sp...cpython-311-darwin.so.p/_gufuncs.cpp.o
In file included from ../scipy/special/_gufuncs.cpp:1:
../scipy/special/ufunc.h:24:5: warning: implicit conversion of NULL constant to 'bool' [-Wnull-conversion]
    import_array();
    ^~~~~~~~~~~~~~
../venv/lib/python3.11/site-packages/numpy/core/include/numpy/__multiarray_api.h:1558:151: note: expanded from macro 'import_array'
#define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NULL; } }
                                                                                                                                               ~~~~~~ ^
In file included from ../scipy/special/_gufuncs.cpp:1:
../scipy/special/ufunc.h:29:5: warning: implicit conversion of NULL constant to 'bool' [-Wnull-conversion]
    import_umath();
    ^~~~~~~~~~~~~~
../venv/lib/python3.11/site-packages/numpy/core/include/numpy/__ufunc_api.h:279:20: note: expanded from macro 'import_umath'
            return NULL;\
            ~~~~~~ ^
2 warnings generated.
[27/260] Compiling C++ object scipy/sp...311-darwin.so.p/special_wrappers.cpp.o
In file included from ../scipy/special/special_wrappers.cpp:53:
../scipy/special/special/cephes/hyperg.h:251:9: warning: non-void function does not return a value in all control paths [-Wreturn-type]
        }
        ^
1 warning generated.

See also gh-19734

@github-actions github-actions bot added the Build issues Issues with building from source, including different choices of architecture, compilers and OS label May 18, 2024
@lucascolley
Copy link
Member

The highs one is known, see gh-19734. I believe @steppi is intending to circle back to any new warnings from special at some point.

@lucascolley lucascolley changed the title BLD:C++ compilation warnings during python dev.py build BLD/DEV: special: build warnings May 18, 2024
@lucascolley lucascolley added DX Everything related to making the experience of working on SciPy more pleasant scipy.special labels May 18, 2024
@steppi
Copy link
Contributor

steppi commented May 19, 2024

The following warning seems to reveal that a } is missing due to misleading indentation:

I see, it does look like there's a missing bracket in the final if block of hy1f1a. I think this was just copied verbatim from the original cephes code, which probably had this same issue. Actually it looks like I introduced this one. In any case I'll submit a PR with a fix.

@lucascolley
Copy link
Member

I also see

[47/1383] Generating symbol file scipy/special/libsf_error_state.dylib.p/libsf_error_state.dylib.symbols
WARNING: ['arm64-apple-darwin20.0.0-nm'] does not work. Relinking will always happen on source changes.
error: arm64-apple-darwin20.0.0-nm: invalid argument --
Usage: arm64-apple-darwin20.0.0-nm [-agnopruUmxjlfAPL[s segname sectname] [-] [-t format] [[-arch <arch_flag>] ...] [file ...]
...
[70/1383] Compiling C++ object scipy/special/_gufuncs.cpython-310-darwin.so.p/_gufuncs.cpp.o
...
In file included from ../scipy/special/_gufuncs.cpp:1:
../scipy/special/_gufuncs.cpp:57:5: warning: mixture of designated and non-designated initializers in the same initializer list is a C99 extension [-Wc99-designator]
    .m_name = "_gufuncs",
    ^~~~~~~~~~~~~~~~~~~~
../scipy/special/_gufuncs.cpp:56:5: note: first non-designated initializer is here
    PyModuleDef_HEAD_INIT,
    ^~~~~~~~~~~~~~~~~~~~~
/Users/lucascolley/mambaforge/envs/scipy-dev/include/python3.10/moduleobject.h:51:31: note: expanded from macro 'PyModuleDef_HEAD_INIT'
#define PyModuleDef_HEAD_INIT { \
                              ^~~

@fancidev
Copy link
Contributor Author

@steppi I can make a PR for the first warning if you want. It’s an easy fix, though the code will not look pretty as import_array and import_umath are macros with a return statement in it.

@steppi
Copy link
Contributor

steppi commented May 28, 2024

@steppi I can make a PR for the first warning if you want. It’s an easy fix, though the code will not look pretty as import_array and import_umath are macros with a return statement in it.

Thanks @fancidev, that would be great.

@fancidev
Copy link
Contributor Author

Actually it is already fixed by @rgommers !

@lucascolley lucascolley added this to the 1.14.0 milestone May 28, 2024
@lucascolley lucascolley reopened this May 30, 2024
@lucascolley
Copy link
Member

lucascolley commented May 30, 2024

this is not actually done quite yet, remaining warnings for me locally:

  • 1:
[48/1383] Generating symbol file scipy/special/libsf_error_state.dylib.p/libsf_error_state.dylib.symbols
WARNING: ['arm64-apple-darwin20.0.0-nm'] does not work. Relinking will always happen on source changes.
error: arm64-apple-darwin20.0.0-nm: invalid argument --
Usage: arm64-apple-darwin20.0.0-nm [-agnopruUmxjlfAPL[s segname sectname] [-] [-t format] [[-arch <arch_flag>] ...] [file ...]
  • 2:
[71/1383] Compiling C++ object scipy/special/_gufuncs.cpython-310-darwin.so.p/_gufuncs.cpp.o
../scipy/special/_gufuncs.cpp:57:5: warning: mixture of designated and non-designated initializers in the same initializer list is a C99 extension [-Wc99-designator]
    .m_name = "_gufuncs",
    ^~~~~~~~~~~~~~~~~~~~
../scipy/special/_gufuncs.cpp:56:5: note: first non-designated initializer is here
    PyModuleDef_HEAD_INIT,
    ^~~~~~~~~~~~~~~~~~~~~
/Users/lucascolley/mambaforge/envs/scipy-dev/include/python3.10/moduleobject.h:51:31: note: expanded from macro 'PyModuleDef_HEAD_INIT'
#define PyModuleDef_HEAD_INIT { \
                              ^~~
1 warning generated.
  • 3:
[90/1383] Compiling C++ object scipy/special/_special_ufuncs.cpython-310-darwin.so.p/_special_ufuncs.cpp.o
../scipy/special/_special_ufuncs.cpp:210:5: warning: mixture of designated and non-designated initializers in the same initializer list is a C99 extension [-Wc99-designator]
    .m_name = "_special_ufuncs",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../scipy/special/_special_ufuncs.cpp:209:5: note: first non-designated initializer is here
    PyModuleDef_HEAD_INIT,
    ^~~~~~~~~~~~~~~~~~~~~
/Users/lucascolley/mambaforge/envs/scipy-dev/include/python3.10/moduleobject.h:51:31: note: expanded from macro 'PyModuleDef_HEAD_INIT'
#define PyModuleDef_HEAD_INIT { \
                              ^~~
1 warning generated.

@lucascolley lucascolley modified the milestones: 1.14.0, 1.15.0 May 30, 2024
@fancidev
Copy link
Contributor Author

@lucascolley Sorry about early closure. Feel free to update the task list in the original post to leverage on GitHub’s task tracking GUI.

@rgommers
Copy link
Member

rgommers commented Jun 6, 2024

All but one warnings are fixed. The last warning from nm is due to shared libraries + Python + Meson, as discussed in mesonbuild/meson#11131. I'll look into that one.

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 DX Everything related to making the experience of working on SciPy more pleasant scipy.special
Projects
None yet
Development

No branches or pull requests

4 participants