-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: f2py undefined symbol for the new meson backend #28191
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
Comments
Unfortunately this is a conceptual issue and cannot be resolved by python -mnumpy.f2py -c a.f90 b.f90 -m test Note the difference in the generated files, the error arises because the ❯ diff blah_mod/testmodule.c blah/testmodule.c
5c5
< * Generation date: Mon Jan 20 11:07:03 2025
---
> * Generation date: Mon Jan 20 11:06:26 2025
180a181,195
>
> static FortranDataDef f2py_para_def[] = {
> {"n",0,{{-1}},NPY_INT, 1},
> {NULL}
> };
>
> static void f2py_setup_para(char *n) {
> int i_f2py=0;
> f2py_para_def[i_f2py++].data = n;
> }
> extern void F_FUNC(f2pyinitpara,F2PYINITPARA)(void (*)(char*));
> static void f2py_init_para(void) {
> F_FUNC(f2pyinitpara,F2PYINITPARA)(f2py_setup_para);
> }
>
230c245
< ".");
---
> "Fortran 90/95 modules:\n"" para --- n"".");
249a265
> PyDict_SetItemString(d, "para", PyFortranObject_New(f2py_para_def,f2py_init_para)); FWIW this can never have worked in older versions of |
I'm pretty sure this example ( |
Thanks to everyone's helpful discussion. I also tested three versions and
|
Ah my bad, reopening. In my haste I thought it was a compilation with only the |
Dear all, And by my test, i found that it also can be happened on So could anyone tell me it have any process now? This problem prevent us from switching to meson backend. Best wishes, |
Describe the issue:
This is a continued problem of a previous numpy f2py issue. The error information is different and I think it deserves opening a new issue. After adding
-I$(pwd)
tof2py
, there is no compilation error, but there is an importing errorundefined symbol
. The following test is performed using Python 3.12.8 and gcc 8.5.0.Thanks for any kind help and suggestion!
Best,
Jingxiang
Reproduce the code example:
A simple example is shown using two Fortran files and one Python script:
a.f90
b.f90
Compiling commands are
The file
test.cpython-312-x86_64-linux-gnu.so
is generated.Error message:
Start python and it can be found
which means that the integer variable
n
seems not be used during compiling.Python and NumPy Versions:
Python 3.12.8, numpy 2.2.1
Runtime Environment:
Context for the issue:
We are developers of the open source package MOKIT. By using f2py, we offer lots of convenient and efficient Python APIs to users in the computational chemistry field. We are grateful for your numpy f2py functionalities. And we are still looking for a solution to move to new meson backend. Thank you.
The text was updated successfully, but these errors were encountered: