Closed ljlamarche closed 1 year ago
This may not be a completely isolated issue. I managed to (unintentionally) produce something similar installing apexpy on a CentOS7 machine. Here's the specific error:
>>> import apexpy
fortranapex module could not be imported. apexpy probably won't work. Failed with error: /home/llamarche/Tools/apexpy/apexpy/fortranapex.cpython-39-x86_64-linux-gnu.so: undefined symbol: fint_/home/llamarche/Tools/apexpy/apexpy/apex.py:15: UserWarning: fortranapex module could not be imported, so apexpy probably won't work. Make sure you have a gfortran compiler. Failed with error: /home/llamarche/Tools/apexpy/apexpy/fortranapex.cpython-39-x86_64-linux-gnu.so: undefined symbol: fint_
It's a different error, but still seems related to the fint function.
Steps to reproduce:
$ FC=/opt/rh/devtoolset-7/root/bin/gfortran CC=/opt/rh/devtoolset-7/root/bin/gcc python -m build .
FC=/opt/rh/devtoolset-7/root/bin/gfortran CC=/opt/rh/devtoolset-7/root/bin/gcc pip install -e .
Full Output of Inspecting fortranapex.cpython-39-x86_64-linux-gnu.so
I assume this is still something wierd I'm doing because noone else is having this issue, but I can't figure out what... Unless anyone has a better idea, I might try reformulating fint as a module just to see if it makes the problem magically go away?
What happens if you use pip without the -e
flag?
No such luck, same issue :( ...
Ah, I got a similar error pairing CC clang with FC gfortran. From your output:
C compiler for the host machine: arm64-apple-darwin20.0.0-clang (clang 14.0.6 "clang version 14.0.6")
C linker for the host machine: arm64-apple-darwin20.0.0-clang ld64 609
It looks like the CC to gcc isn't working?
Ah, I forgot there were sometimes issues with clang! Do you suppose specifying CC to some version of gcc would help? I can try in a few minutes.
I think it will fix your issue, it worked for me!
Oh no, now it doesn't install at all!
gcc: error: this compiler does not support arm64
Let me see if I can update gcc. The default is identified as "experimental".
@ljlamarche has this been resolved now?
Yes. Ultimately there's two things to remember when building/testing apexpy:
-e
flag with mesonI don't THINK the gcc thing actually had anything to do with this, although I haven't tested it thoroughly. The instructions to use -e
were removed from the documentation, so I think we're set with this!
Description: Yet another instillation issue. This specifically applies to building and installing apexpy from the cloned GitHub repository, following the instructions in this section. After installing the necessary prerequisites to build the package (gfortran, build, and pkg-config), it appears to have successfully build and install the package, however apexpy (specifically fortranapex) cannot be imported:
I've tried many variations on the "known" tricks to solve instillation issues, nothing has worked so far.
To Reproduce: Starting from clean conda environment in cloned apexpy repo (develop branch):
Speculation: The problem appears to be relates to
_f2pywrapfint_
infortranapex.cpython-39-darwin.so
, which is added to the apexpy directory upon pip install. Inspectingfortranapex.cpython-39-darwin.so
reveals that_f2pywrapfint_
is listed as undefined.Pertinent block:
Full output of this command is given at the end of this description.
I've found a few other mentions of similar issues, but it's not clear that there is a definite solution (or even that they are necessarily the same problem. I think the most relevant is a quote from this comment: "Somehow, the constant variables in the class are compiled as indirect symbols that cannot be found in flat namespace on macOS using AppleClang++."
Other potentially useful threads: https://github.com/tensorflow/tensorflow/issues/54242 https://github.com/tensorflow/tensorflow/issues/41682 https://github.com/tensorflow/tensorflow/issues/39262 https://github.com/tensorflow/tensorflow/issues/36945
Potentially noteable is the fact that fint is the ONLY portion of fortran source code that is written as a function rather than a module. I never could figure out why this was, but it may be impacting something? I think it's far more liekly that this is a quirk with my setup.
Computer Information: