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

Installing error in the compilation of "build_FortFlex.sh" #37

Open
envhyf opened this issue Aug 6, 2018 · 3 comments
Open

Installing error in the compilation of "build_FortFlex.sh" #37

envhyf opened this issue Aug 6, 2018 · 3 comments

Comments

@envhyf
Copy link

envhyf commented Aug 6, 2018

Following the instruction, I have installed all the packages and met error when compiling the setup.py file.
I found out that the issue was in the process of the compilation of build_FortFlex.sh
The error shows like this:

ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
error: Command "/usr/local/bin/gfortran -Wall -g -L/usr/local/NETCDF/lib  /var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpmru57eln/var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpmru57eln/src.macosx-10.9-x86_64-3.5/FortFlexmodule.o /var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpmru57eln/var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpmru57eln/src.macosx-10.9-x86_64-3.5/fortranobject.o /var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpmru57eln/FortFlex.o -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -L/Users/HYF/anaconda/envs/py35/lib -lgfortran -o ./FortFlex.cpython-35m-darwin.so" failed with exit status 1

I would like to have an advice how to proceed.

PS: essential information about my compilation environment:

Darwin I.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64 i386 MacBookAir7,2 Darwin        
Python 3.5, gcc 4.9.4
@FrancescAlted
Copy link
Member

That's weird. I have just tried the master branch on my OSX box and it correctly compiles the extension. My context:

$ python -c "import reflexible; reflexible.print_versions()"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
reflexible version: 0.5.0
NumPy version:     1.14.2
Python version:    3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
Platform:          darwin-x86_64
Byte-ordering:     little
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

I suppose this is unrelated, but which version of gfortran do you have? Mine is 8.1.0:

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/8.1.0/libexec/gcc/x86_64-apple-darwin17.5.0/8.1.0/lto-wrapper
Target: x86_64-apple-darwin17.5.0
Configured with: ../configure --build=x86_64-apple-darwin17.5.0 --prefix=/usr/local/Cellar/gcc/8.1.0 --libdir=/usr/local/Cellar/gcc/8.1.0/lib/gcc/8 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC 8.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-nls
Thread model: posix
gcc version 8.1.0 (Homebrew GCC 8.1.0) 

@envhyf
Copy link
Author

envhyf commented Aug 8, 2018

@FrancescAlted, thanks for your reply. I have found out some issues related with this problem.

  1. I read that reflexible was built on Python3 environment, while the default f2py environment in my computer was based on Python 2.7.

  2. The computer was in X86_64 architecture, while the compilation processe seems to be with i386 architecture. Thus, I change the archflag to x86_64 by adding "--arch=X86_64".

The revised ./build_FortFlex.sh shows as follows:

#!/bin/bash
#"/Users/HYF/anaconda/envs/py35/bin/f2py " is the path to call f2py function in python3
rm -f FortFlex.pyf
/Users/HYF/anaconda/envs/py35/bin/f2py -m FortFlex -h FortFlex.pyf FortFlex.f
/Users/HYF/anaconda/envs/py35/bin/f2py  -c --fcompiler=gfortran --arch=X86_64 FortFlex.pyf FortFlex.f
mv *.so ..

By this way, the error "ld: symbol(s) not found for architecture i386" disappers.
However, a new error just appears.

Warning: Unused variable ylat0 declared at (1)
FortFlex.f: In function ‘sumgrid’:
FortFlex.f:256: warning: ‘co’ is used uninitialized in this function
FortFlex.f:256: note: ‘co’ was declared here
FortFlex.f: In function ‘readheader’:
FortFlex.f:529: warning: ‘ltopo’ is used uninitialized in this function
FortFlex.f: In function ‘readgrid_v6’:
FortFlex.f:382: warning: ‘smallnum’ is used uninitialized in this function
FortFlex.f:418: warning: ‘lspec2’ is used uninitialized in this function
FortFlex.f:384: warning: ‘n’ may be used uninitialized in this function
FortFlex.f: In function ‘readgrid’:
FortFlex.f:112: warning: ‘n’ may be used uninitialized in this function
error: Command "gfortran -Wall -g -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops X86_64 -I/var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpdcd8m5an/src.macosx-10.9-x86_64-3.5 -I/Users/HYF/anaconda/envs/py35/lib/python3.5/site-packages/numpy/core/include -I/Users/HYF/anaconda/envs/py35/include/python3.5m -c -c FortFlex.f -o /var/folders/wg/d26_jxbj2p9gp7nkl90q0fbm0000gn/T/tmpdcd8m5an/FortFlex.o" failed with exit status 1

I don't know how to fix it. Is it related with my gcc version (4.9.2) which is lower than yours (8.1.0) ?

@FrancescAlted
Copy link
Member

That's a good question; I only see warnings in your output, so this should not be a problem Just in case, you might want to try an updated gfortran and try. I installed my version via $ brew install gcc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants