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

Installation fails during fortran compilation #21

Open
jvines opened this issue Mar 25, 2019 · 2 comments
Open

Installation fails during fortran compilation #21

jvines opened this issue Mar 25, 2019 · 2 comments

Comments

@jvines
Copy link

jvines commented Mar 25, 2019

Hi,

I had CERES installed and running, but I had to make a clean installation of OS X. While reinstalling CERES I encountered the following error during the fortran compilation of CCF

compiling Fortran sources
Fortran f77 compiler: /anaconda3/envs/python2/bin/x86_64-apple-darwin13.4.0-gfortran -ffixed-line-length-none -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -O3 -funroll-loops
Fortran f90 compiler: /anaconda3/envs/python2/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -fno-second-underscore -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -O3 -funroll-loops
Fortran fix compiler: /anaconda3/envs/python2/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -O3 -funroll-loops
compile options: '-I/var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/src.macosx-10.9-x86_64-2.7 -I/anaconda3/envs/python2/lib/python2.7/site-packages/numpy/core/include -I/anaconda3/envs/python2/include/python2.7 -c'
x86_64-apple-darwin13.4.0-gfortran:f77: CCF.f
x86_64-apple-darwin13.4.0-gfortran:f77: /var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/src.macosx-10.9-x86_64-2.7/CCF-f2pywrappers.f
/anaconda3/envs/python2/bin/x86_64-apple-darwin13.4.0-gfortran -Wall -g -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs /var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/src.macosx-10.9-x86_64-2.7/CCFmodule.o /var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/src.macosx-10.9-x86_64-2.7/fortranobject.o /var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/CCF.o /var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/var/folders/2_/h2fpfxyx1mv9gy_hgfmcyx180000gn/T/tmpYgJMiM/src.macosx-10.9-x86_64-2.7/CCF-f2pywrappers.o -L/anaconda3/envs/python2/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5 -L/anaconda3/envs/python2/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/../../.. -L/anaconda3/envs/python2/bin/../lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/../../.. -L/anaconda3/envs/python2/lib -lgfortran -o ./CCF.so
Undefined symbols for architecture x86_64:
"_PyArg_ParseTupleAndKeywords", referenced from:
_f2py_rout_CCF_ccf in CCFmodule.o
_f2py_rout_CCF_ccfpix in CCFmodule.o
_f2py_rout_CCF_ccfcos in CCFmodule.o
"_PyCObject_AsVoidPtr", referenced from:
_initCCF in CCFmodule.o
_F2PyCapsule_AsVoidPtr in fortranobject.o
"_PyCObject_FromVoidPtr", referenced from:
_fortran_getattr in fortranobject.o
_F2PyCapsule_FromVoidPtr in fortranobject.o
"_PyCObject_Type", referenced from:
_initCCF in CCFmodule.o
_F2PyCapsule_Check in fortranobject.o
"_PyComplex_Type", referenced from:
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
"_PyDict_DelItemString", referenced from:
_fortran_setattr in fortranobject.o
"_PyDict_GetItemString", referenced from:
_initCCF in CCFmodule.o
_fortran_getattr in fortranobject.o
"_PyDict_New", referenced from:
_PyFortranObject_New in fortranobject.o
_PyFortranObject_NewAsAttr in fortranobject.o
_fortran_setattr in fortranobject.o
"_PyDict_SetItemString", referenced from:
_initCCF in CCFmodule.o
_F2PyDict_SetItemString in fortranobject.o
_PyFortranObject_New in fortranobject.o
_fortran_getattr in fortranobject.o
_fortran_setattr in fortranobject.o
"_PyErr_Clear", referenced from:
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
_F2PyDict_SetItemString in fortranobject.o
_fortran_repr in fortranobject.o
"_PyErr_Format", referenced from:
_initCCF in CCFmodule.o
_fortran_call in fortranobject.o
_check_and_fix_dimensions in fortranobject.o
"_PyErr_NewException", referenced from:
_initCCF in CCFmodule.o
"_PyErr_NoMemory", referenced from:
_fortran_getattr in fortranobject.o
"_PyErr_Occurred", referenced from:
_initCCF in CCFmodule.o
_f2py_rout_CCF_ccf in CCFmodule.o
_f2py_rout_CCF_ccfpix in CCFmodule.o
_f2py_rout_CCF_ccfcos in CCFmodule.o
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
_F2PyDict_SetItemString in fortranobject.o
...
"_PyErr_Print", referenced from:
_initCCF in CCFmodule.o
_F2PyDict_SetItemString in fortranobject.o
"_PyErr_SetString", referenced from:
_initCCF in CCFmodule.o
_f2py_rout_CCF_ccf in CCFmodule.o
_f2py_rout_CCF_ccfpix in CCFmodule.o
_f2py_rout_CCF_ccfcos in CCFmodule.o
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
_fortran_setattr in fortranobject.o
...
"_PyExc_AttributeError", referenced from:
_initCCF in CCFmodule.o
_fortran_setattr in fortranobject.o
"_PyExc_ImportError", referenced from:
_initCCF in CCFmodule.o
"_PyExc_RuntimeError", referenced from:
_initCCF in CCFmodule.o
_fortran_call in fortranobject.o
"_PyExc_TypeError", referenced from:
_fortran_call in fortranobject.o
_array_from_pyobj in fortranobject.o
"_PyExc_ValueError", referenced from:
_array_from_pyobj in fortranobject.o
_check_and_fix_dimensions in fortranobject.o
"_PyFloat_Type", referenced from:
_double_from_pyobj in CCFmodule.o
"_PyImport_ImportModule", referenced from:
_initCCF in CCFmodule.o
"_PyMem_Free", referenced from:
_fortran_dealloc in fortranobject.o
_fortran_getattr in fortranobject.o
"_PyMem_Malloc", referenced from:
_fortran_getattr in fortranobject.o
"_PyModule_GetDict", referenced from:
_initCCF in CCFmodule.o
"_PyNumber_Float", referenced from:
_double_from_pyobj in CCFmodule.o
"_PyNumber_Int", referenced from:
_int_from_pyobj in CCFmodule.o
"_PyOS_snprintf", referenced from:
_fortran_getattr in fortranobject.o
"_PyObject_GetAttrString", referenced from:
_initCCF in CCFmodule.o
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
_fortran_repr in fortranobject.o
"_PyObject_SetAttrString", referenced from:
_initCCF in CCFmodule.o
"_PySequence_Check", referenced from:
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
"_PySequence_GetItem", referenced from:
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
"_PyString_AsString", referenced from:
_fortran_repr in fortranobject.o
"_PyString_ConcatAndDel", referenced from:
_fortran_getattr in fortranobject.o
"_PyString_FromFormat", referenced from:
_fortran_repr in fortranobject.o
"_PyString_FromString", referenced from:
_initCCF in CCFmodule.o
_fortran_getattr in fortranobject.o
_fortran_repr in fortranobject.o
"_PyString_FromStringAndSize", referenced from:
_fortran_getattr in fortranobject.o
"_PyType_IsSubtype", referenced from:
_double_from_pyobj in CCFmodule.o
_int_from_pyobj in CCFmodule.o
_array_from_pyobj in fortranobject.o
"_PyType_Type", referenced from:
_initCCF in CCFmodule.o
"_Py_BuildValue", referenced from:
_f2py_rout_CCF_ccf in CCFmodule.o
_f2py_rout_CCF_ccfpix in CCFmodule.o
_f2py_rout_CCF_ccfcos in CCFmodule.o
"_Py_FindMethod", referenced from:
_fortran_getattr in fortranobject.o
"_Py_InitModule4_64", referenced from:
_initCCF in CCFmodule.o
"__PyObject_New", referenced from:
_PyFortranObject_New in fortranobject.o
_PyFortranObject_NewAsAttr in fortranobject.o
"__Py_NoneStruct", referenced from:
_f2py_rout_CCF_ccf in CCFmodule.o
_f2py_rout_CCF_ccfpix in CCFmodule.o
_f2py_rout_CCF_ccfcos in CCFmodule.o
_fortran_getattr in fortranobject.o
_fortran_setattr in fortranobject.o
_array_from_pyobj in fortranobject.o
"_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

I've been looking in the internet what could be going wrong. I tried changing the default compiler from the one in numpy to the gcc compiler, I tried downgrading to gfortran 4.9 and I tried changing the f2py to f2py2.7, to no avail.

For context: I'm using anaconda3 (since python 2.7 will stop having support next year) and created an environment for python2.7. I installed all the requested packages with conda and swig, gcc and gsl with homebrew.

gfortran --version gives

GNU Fortran (Homebrew GCC 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc --version gives

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

and /anaconda3/envs/python2/bin/x86_64-apple-darwin13.4.0-gfortran --version gives

GNU Fortran (GCC) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

which is the version of gfortran f2py is invoking.

I cannot remember for the life of me how I got it working before I wiped my computer, so I ask the CERES team for help installing this :)

Edit: Forgot to add I'm using OS X Mojave

@jvines
Copy link
Author

jvines commented Mar 25, 2019

Okay, so I managed to fix it by changing the default compiler to the brew installed compiler and by doing export LDFLAGS='-bundle -undefined dynamic_lookup' in the terminal

This is apparently numpy and scipy stuff that interferes with the instalation

@jvines
Copy link
Author

jvines commented Oct 30, 2019

I encountered this problem again in Linux Mint. The solution was to add -shared to LDFLAGS

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

1 participant