I am working with ubuntu 12.04 LTS; I have installed ncl. I have installed PyNIO. I didn't have any problems with these. It was slightly more challenging with PyNGL:
I am using PyNGL-1.4.0. I have the standard ubuntu installations, meaning that I have gcc version 4.6.3, python version 2.7.3, and gfortran version 4.6.3
I compiled fine. But, on the use of PyNGL by running a python script,
import numpy as np
import Ngl
I have an ImportError, stating
undefined symbol: _gfortran_stop_numeric
we note that the command (launched in the terminal from the directory PyGNL-1.4.0)
ldd build/lib.linux-x86_64-2.7/PyNGL/fplib.so
indicates no dependence on the library libgfortran.so.
there lies the problem.
Solution:
1) In PyGNL-1.4.0 obtained after the tar xvzf, remove by hand the build directory:
rm -rf build
2) in the file setup.py, add a dependency on the gfortran library (it was not enough to modify LIBRARITES in my case):
you replace:
#########################################################"
# Instructions for compiling the "_hlu.so" and "fplib.so" files.
EXT_MODULES = [Extension('_hlu',
['Helper.c','hlu_wrap.c','gsun.c'],
define_macros = DMACROS,
include_dirs = INC_DIRS,
library_dirs = LIB_DIRS,
libraries = LIBRARIES,
extra_objects = EXTRA_OBJECTS),
Extension('fplib',
[os.path.join('paft','fplibmodule.c')],
define_macros = DMACROS,
include_dirs = INC_DIRS,
library_dirs = LIB_DIRS,
libraries = LIBRARIES,
extra_objects = EXTRA_OBJECTS
)]
##########################################################
with:
(replace /usr/lib/gcc/x86_64-linux-gnu/4.6/ with the path of libgfortran.so on your computer)
#########################################################"
# Instructions for compiling the "_hlu.so" and "fplib.so" files.
EXT_MODULES = [Extension('_hlu',
['Helper.c','hlu_wrap.c','gsun.c'],
define_macros = DMACROS,
include_dirs = INC_DIRS,
library_dirs = LIB_DIRS,
libraries = LIBRARIES,
extra_objects = EXTRA_OBJECTS,
depends = [('/usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.so')]),
Extension('fplib',
[os.path.join('paft','fplibmodule.c')],
define_macros = DMACROS,
include_dirs = INC_DIRS,
library_dirs = LIB_DIRS,
libraries = LIBRARIES,
extra_objects = EXTRA_OBJECTS,
depends = [('/usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.so')]
)]
##########################################################
3) you compile using
python setup --verbose build
strangely, it will stop by giving a file/directory not present. I had not time to correct this bug.
Just launch the last gcc command given before the error. In my case, I had to launch something like these (don't be afraid, it is just a copy/paste of the last log you see in the screen):
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -O2 build/temp.linux-x86_64-2.7/Helper.o build/temp.linux-x86_64-2.7/hlu_wrap.o build/temp.linux-x86_64-2.7/gsun.o -L/usr/local/ncl/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -lnfpfort -lhlu -lncarg -lncarg_gks -lncarg_c -lngmath -lX11 -lgfortran -o build/lib.linux-x86_64-2.7/PyNGL/_hlu.so
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -O2 build/temp.linux-x86_64-2.7/paft/fplibmodule.o -L/usr/local/ncl/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -lnfpfort -lhlu -lncarg -lncarg_gks -lncarg_c -lngmath -lX11 -lgfortran -o build/lib.linux-x86_64-2.7/PyNGL/fplib.so
4) python setup --verbose install
5) say how the find the ncl python library
export PYNGL_NCARG=/usr/local/ncl/lib (in my case. Put it for example in .bashrc)
6) Then, the python script importing 'import Ngl' 'works!
_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Mon Dec 17 06:11:52 2012
This archive was generated by hypermail 2.1.8 : Fri Dec 21 2012 - 10:43:45 MST