8000 GitHub · Where software is built
[go: up one dir, main page]

Skip to content
BUG: f2py undefined symbol for the new meson backend #28191
Open
@1234zou

Description

@1234zou

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) to f2py, there is no compilation error, but there is an importing error undefined 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

module para
 implicit none
 integer :: n
end module para

b.f90

subroutine prt_n
 use para, only: n
 implicit none
 n = 5
 write(6,'(A,I2)') 'n=', n
end subroutine prt_n

Compiling commands are

gfortran a.f90 -c
f2py -c a.o b.f90 -m test -I$(pwd)

The file test.cpython-312-x86_64-linux-gnu.so is generated.

Error message:

Start python and it can be found

>>>from test import prt_n
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /public/home/jxzou/wfu/pbc_pm_test/test.cpython-312-x86_64-linux-gnu.so: undefined symbol: __para_MOD_n

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:

[{'numpy_version': '2.2.1',
  'python': '3.12.8 | packaged by Anaconda, Inc. | (main, Dec 11 2024, '
            '16:31:09) [GCC 11.2.0]',
  'uname': uname_result(system='Linux', node='mu012', release='4.18.0-372.64.1.kos5.x86_64', version='#1 SMP Tue Aug 8 20:23:39 EDT 2023', machine='x86_64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2',
                                'AVX512F',
                                'AVX512CD',
                                'AVX512_SKX',
                                'AVX512_CLX',
                                'AVX512_CNL',
                                'AVX512_ICL'],
                      'not_found': ['AVX512_KNL', 'AVX512_KNM']}},
 {'filepath': '/public/home/jxzou/software/anaconda3/envs/mokit-py312/lib/libmkl_rt.so.2',
  'internal_api': 'mkl',
  'num_threads': 64,
  'prefix': 'libmkl_rt',
  'threading_layer': 'intel',
  'user_api': 'blas',
  'version': '2023.1-Product'},
 {'filepath': '/public/home/jxzou/software/anaconda3/envs/mokit-py312/lib/libiomp5.so',
  'internal_api': 'openmp',
  'num_threads': 64,
  'prefix': 'libiomp',
  'user_api': 'openmp',
  'version': None}]

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0