Rohit,
Thank you responding to my posting.
I attempted to do a 'meson' build. The build failed. The commands I used
follow:
echo f2py build for divapy
echo deleting previous build
rm -i *.so
rm -i divapy.f
rm -i divapy-f2pywrappers.f
rm -i divapymodule.c
echo concatenating files
cat *.f > divapy.f
echo building Python wrappers using meson
/Users/user/opt/anaconda3/bin/python -m numpy.f2py divapy.f -m
divapy --lower
meson --wipe builddir
meson setup builddir
meson compile -C builddir
cd builddir
/Users/user/opt/anaconda3/bin/python -c 'import divapy'
echo done.
The meson log file is attached for reference. The output written to the
terminal is:
The Meson build system
Version: 1.1.1
Source dir: /Users/user/Various_Python_Examples/diva.f_for_f2py
Build dir: /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir
Build type: native build
Project name: diva_example
Project version: 0.1
C compiler for the host machine: cc (clang 14.0.3 "Apple clang
version 14.0.3 (clang-1403.0.22.14.1)")
C linker for the host machine: cc ld64 857.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
meson.build:8: WARNING: add_languages is missing native:, assuming
languages are wanted for both host and build.
Fortran compiler for the host machine: gfortran (gcc 13.1.0 "GNU
Fortran (Homebrew GCC 13.1.0) 13.1.0")
Fortran linker for the host machine: gfortran ld64 857.1
Program python3 found: YES (/usr/local/opt/python@3.11/bin/python3.11)
Found pkg-config: /usr/local/bin/pkg-config (0.29.2)
meson.build:14:15: ERROR: Command
`/usr/local/opt/python@3.11/bin/python3.11 -c 'import os;
os.chdir(".."); import numpy; print(numpy.get_include())'` failed
with status 1.
A full log can be found at
/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-logs/meson-log.txt
WARNING: Running the setup command as `meson [options]` instead of
`meson setup [options]` is ambiguous and deprecated.
The Meson build system
Version: 1.1.1
Source dir: /Users/user/Various_Python_Examples/diva.f_for_f2py
Build dir: /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir
Build type: native build
Project name: diva_example
Project version: 0.1
C compiler for the host machine: cc (clang 14.0.3 "Apple clang
version 14.0.3 (clang-1403.0.22.14.1)")
C linker for the host machine: cc ld64 857.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
meson.build:8: WARNING: add_languages is missing native:, assuming
languages are wanted for both host and build.
Fortran compiler for the host machine: gfortran (gcc 13.1.0 "GNU
Fortran (Homebrew GCC 13.1.0) 13.1.0")
Fortran linker for the host machine: gfortran ld64 857.1
Program python3 found: YES (/usr/local/opt/python@3.11/bin/python3.11)
Found pkg-config: /usr/local/bin/pkg-config (0.29.2)
meson.build:14:15: ERROR: Command
`/usr/local/opt/python@3.11/bin/python3.11 -c 'import os;
os.chdir(".."); import numpy; print(numpy.get_include())'` failed
with status 1.
A full log can be found at
/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-logs/meson-log.txt
ERROR: Current directory is not a meson build directory:
`/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir`.
Please specify a valid build dir or change the working directory to it.
It is also possible that the build directory was generated with an old
meson version. Please regenerate it in this case.
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'divapy'
done.
(base) user@Mac-Pro diva.f_for_f2py %
In doing a deeper dive, I found that I have meson installed under Homebrew.
Before I open an issue, I'd like to know do I need to have meson and/or
meson-python installed under Anaconda?
Sam Dupree.
On 7/29/23 10:49, Rohit Goswami wrote:
More of a workaround, since it seems like the wrappers and binding
files are generated could you try the `meson` build following this
page in the documentation?
https://numpy.org/devdocs/f2py/buildtools/meson.html
`distutils` support is patchy at best, but if the meson build doesn't
work the bindings might be incorrect, please open an issue in that case.
--- Rohit
------------------------------------------------------------------------
*From:* Samuel H Dupree Jr <sdup...@speakeasy.net>
*Sent:* Saturday, 29 July 2023 09:33
*To:* Discussion of Numerical Python
*Subject:* [Numpy-discussion] How to get numpy.distutils.fcompiler to
find my absoft compiler
Hello everyone,
I'm trying to wrap some Fortran77 subroutines from the Math77 library
using f2py3. f2py3 responds with a message:
File
"/Users/user/opt/anaconda3/lib/python3.9/site-packages/numpy/distutils/fcompiler/__init__.py",
line 426, in get_version
raise CompilerNotFound()
numpy.distutils.fcompiler.CompilerNotFound
I'm running Python ver. 3.9.17 under the Anaconda distribution
(anaconda Command line client (version 1.12.0)) on a Mac Pro (2019) under
Mac OS X Ventura ver. 13.4.1. The Fortran compiler is Absoft Pro
Fortran ver. 22.0.
The set of subroutines to be wrapped were concatenated into a single
file named divapy.f. The command used to wrap the routines was
--fcompiler=absoft --f77exec=/Applications/Absoft22.0/bin/f77
-c -m diva divapy.f
I've attached a file containing the complete set of messages output by
f2py3 using the command above.
Any suggestions as to how to fix this problem?
Sam Dupree.
_______________________________________________
NumPy-Discussion mailing list --numpy-discussion@python.org
To unsubscribe send an email tonumpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address:sdup...@speakeasy.net
Build started at 2023-07-30T02:43:32.028878
Main binary: /usr/local/opt/python@3.11/bin/python3.11
Build Options:
Python system: Darwin
The Meson build system
Version: 1.1.1
Source dir: /Users/user/Various_Python_Examples/diva.f_for_f2py
Build dir: /Users/user/Various_Python_Examples/diva.f_for_f2py/builddir
Build type: native build
Project name: diva_example
Project version: 0.1
-----
Detecting compiler via: cc --version
compiler returned <Popen: returncode: 0 args: ['cc', '--version']>
compiler stdout:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.5.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
compiler stderr:
Running command: cc -E -dM -
-----
Detecting linker via: cc -Wl,--version
linker returned <Popen: returncode: 1 args: ['cc', '-Wl,--version']>
linker stdout:
linker stderr:
ld: unknown option: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----
Detecting Apple linker via: cc -Wl,-v
linker stdout:
linker stderr:
@(#)PROGRAM:ld PROJECT:ld64-857.1
BUILD 23:13:24 May 7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386
x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
/usr/local/lib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Sanity testing C compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command:
/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-private/sanitycheckc.exe
C compiler for the host machine: cc (clang 14.0.3 "Apple clang version 14.0.3
(clang-1403.0.22.14.1)")
C linker for the host machine: cc ld64 857.1
-----
Detecting compiler via: cc --version
compiler returned <Popen: returncode: 0 args: ['cc', '--version']>
compiler stdout:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.5.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
compiler stderr:
Running command: cc -E -dM -
-----
Detecting linker via: cc -Wl,--version
linker returned <Popen: returncode: 1 args: ['cc', '-Wl,--version']>
linker stdout:
linker stderr:
ld: unknown option: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----
Detecting Apple linker via: cc -Wl,-v
linker stdout:
linker stderr:
@(#)PROGRAM:ld PROJECT:ld64-857.1
BUILD 23:13:24 May 7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386
x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
/usr/local/lib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Sanity testing C compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command:
/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-private/sanitycheckc.exe
C compiler for the build machine: cc (clang 14.0.3 "Apple clang version 14.0.3
(clang-1403.0.22.14.1)")
C linker for the build machine: cc ld64 857.1
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
meson.build:8: WARNING: add_languages is missing native:, assuming languages
are wanted for both host and build.
Running command: gfortran -E -dM -
-----
Detecting linker via: gfortran -Wl,--version
linker returned <Popen: returncode: 1 args: ['gfortran', '-Wl,--version']>
linker stdout:
linker stderr:
collect2 version 13.1.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/
-dynamic -arch x86_64 -macosx_version_min 13.0.0 -o a.out
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../..
--version -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path
-rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13
-rpath /usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc -rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current
ld: unknown option: --version
collect2: error: ld returned 1 exit status
-----
Detecting Apple linker via: gfortran -Wl,-v
linker stdout:
linker stderr:
collect2 version 13.1.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/
-dynamic -arch x86_64 -macosx_version_min 13.0.0 -o a.out
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../..
-v -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path -rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13
-rpath /usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc -rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current
@(#)PROGRAM:ld PROJECT:ld64-857.1
BUILD 23:13:24 May 7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386
x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/lib
Framework search paths:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Sanity testing Fortran compiler: gfortran
Is cross compiler: False.
Sanity check compiler command line: gfortran sanitycheckf.f90 -o
sanitycheckf.exe
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command:
/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-private/sanitycheckf.exe
Fortran compiler for the build machine: gfortran (gcc 13.1.0 "GNU Fortran
(Homebrew GCC 13.1.0) 13.1.0")
Fortran linker for the build machine: gfortran ld64 857.1
Running command: gfortran -E -dM -
-----
Detecting linker via: gfortran -Wl,--version
linker returned <Popen: returncode: 1 args: ['gfortran', '-Wl,--version']>
linker stdout:
linker stderr:
collect2 version 13.1.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/
-dynamic -arch x86_64 -macosx_version_min 13.0.0 -o a.out
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../..
--version -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path
-rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13
-rpath /usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc -rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current
ld: unknown option: --version
collect2: error: ld returned 1 exit status
-----
Detecting Apple linker via: gfortran -Wl,-v
linker stdout:
linker stderr:
collect2 version 13.1.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/
-dynamic -arch x86_64 -macosx_version_min 13.0.0 -o a.out
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc
-L/usr/local/Cellar/gcc/13.1.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../..
-v -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path -rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13
-rpath /usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc -rpath
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current
@(#)PROGRAM:ld PROJECT:ld64-857.1
BUILD 23:13:24 May 7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386
x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current/gcc
/usr/local/Cellar/gcc/13.1.0/lib/gcc/current
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/lib
Framework search paths:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Sanity testing Fortran compiler: gfortran
Is cross compiler: False.
Sanity check compiler command line: gfortran sanitycheckf.f90 -o
sanitycheckf.exe
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command:
/Users/user/Various_Python_Examples/diva.f_for_f2py/builddir/meson-private/sanitycheckf.exe
Fortran compiler for the host machine: gfortran (gcc 13.1.0 "GNU Fortran
(Homebrew GCC 13.1.0) 13.1.0")
Fortran linker for the host machine: gfortran ld64 857.1
Program python3 found: YES (/usr/local/opt/python@3.11/bin/python3.11)
Searching for 'python-3.11' via pkgconfig lookup in LIBPC
Pkg-config binary for 1 is not cached.
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Found pkg-config: /usr/local/bin/pkg-config (0.29.2)
Determining dependency 'python-3.11' with pkg-config executable
'/usr/local/bin/pkg-config'
env[PKG_CONFIG_LIBDIR]:
/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/pkgconfig
env[PKG_CONFIG_PATH]:
Called `/usr/local/bin/pkg-config --modversion python-3.11` -> 0
stdout:
3.11
-----------
env[PKG_CONFIG_LIBDIR]:
/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/pkgconfig
env[PKG_CONFIG_PATH]:
Called `/usr/local/bin/pkg-config --cflags python-3.11` -> 0
stdout:
-I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11
-----------
env[PKG_CONFIG_LIBDIR]:
/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/pkgconfig
env[PKG_CONFIG_ALLOW_SYSTEM_LIBS]: 1
env[PKG_CONFIG_PATH]:
Called `/usr/local/bin/pkg-config --libs python-3.11` -> 0
env[PKG_CONFIG_LIBDIR]:
/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/pkgconfig
env[PKG_CONFIG_PATH]:
Called `/usr/local/bin/pkg-config --libs python-3.11` -> 0
Running command: /usr/local/opt/python@3.11/bin/python3.11 -c 'import os;
os.chdir(".."); import numpy; print(numpy.get_include())'
--- stdout ---
--- stderr ---
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
meson.build:14:15: ERROR: Command `/usr/local/opt/python@3.11/bin/python3.11 -c
'import os; os.chdir(".."); import numpy; print(numpy.get_include())'` failed
with status 1.
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com