Hi,
I'm not sure in which forum I could post this, so I will just try here. I can't imagine I'm the only one with this problem.
The general problem is that I get 'undefined symbol' errors whenever I try to import a Python package into my Python code, which includes shared libraries compiled with the Intel Fortran compiler (ifort, v12.0.4). These undefiend symbols are usually defined in libraries supplied by Intel in the Compiler Suite, but are not linked correctly to the shared library used in python.
This happened with various software packages.
Here is an example:
I'm using the Intel compilers (composerxe-2011.4.191) and the Enthought Python Distro (v7.1-1) on (k)ubuntu 11.04, 64bit. the package is PyNIO from NCAR (http://www.pyngl.ucar.edu/Download/b...from_src.shtml).
It compiles and installs alright (setup.py install), but when I try to import the package, I get this error:
>>> import nio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /opt/EPD/epd-7.1-1-rh5-x86_64/lib/python2.7/site-packages/PyNIO/nio.so: undefined symbol: for_cpystr
>>>
The symbol 'for_cpystr' is actually defined in a Fortran library related to the Intel compiler suite:
$ nm /opt/intel/composerxe-2011.4.191/compiler/lib/intel64/libifcore.so | grep 'for_cpystr'
00000000000cfc60 T for_cpystr
The library is in my LD_LIBRARY_PATH and adding it to /etc/ld.so.conf.d/ doesn't help either. The source install resides in /opt/EPD/epd-7.1-1-rh5-x86_64/lib/python2.7/site-packages/ and
$ ldd /opt/EPD/epd-7.1-1-rh5-x86_64/lib/python2.7/site-packages/PyNIO/nio.so | grep 'libifcore.so'
turns up nothing, so it seems these libraries are not correctly linked in. Which leads me to suspect that the F2CLIBS and F2CLIBS_PREFIX environment variables are not properly read by the setup.py script.
I have defined them in the following way:
export F2CLIBS='m ifcore irc ifport'
export F2CLIBS_PREFIX=/opt/intel/composerxe-2011.4.191/compiler/lib/intel64/
With this combination (although different syntax) I was able to successfully build NCL. From my limited understanding of what the setup.py script does, this should produce a list of the required libraries required by f2py. But obviously it does not work that way.
In fact none of the above libraries are actually linked in to 'nio.so', except 'libm.so' which points to the standard GNU/Linux version.
I'm kinda stuck here, but I really want to figure this out!
I've attached a script with the compiler flags I'm using.
Any help would be highly appreciated!
Thanks,
Chopstick
I'm not sure in which forum I could post this, so I will just try here. I can't imagine I'm the only one with this problem.
The general problem is that I get 'undefined symbol' errors whenever I try to import a Python package into my Python code, which includes shared libraries compiled with the Intel Fortran compiler (ifort, v12.0.4). These undefiend symbols are usually defined in libraries supplied by Intel in the Compiler Suite, but are not linked correctly to the shared library used in python.
This happened with various software packages.
Here is an example:
I'm using the Intel compilers (composerxe-2011.4.191) and the Enthought Python Distro (v7.1-1) on (k)ubuntu 11.04, 64bit. the package is PyNIO from NCAR (http://www.pyngl.ucar.edu/Download/b...from_src.shtml).
It compiles and installs alright (setup.py install), but when I try to import the package, I get this error:
>>> import nio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /opt/EPD/epd-7.1-1-rh5-x86_64/lib/python2.7/site-packages/PyNIO/nio.so: undefined symbol: for_cpystr
>>>
The symbol 'for_cpystr' is actually defined in a Fortran library related to the Intel compiler suite:
$ nm /opt/intel/composerxe-2011.4.191/compiler/lib/intel64/libifcore.so | grep 'for_cpystr'
00000000000cfc60 T for_cpystr
The library is in my LD_LIBRARY_PATH and adding it to /etc/ld.so.conf.d/ doesn't help either. The source install resides in /opt/EPD/epd-7.1-1-rh5-x86_64/lib/python2.7/site-packages/ and
$ ldd /opt/EPD/epd-7.1-1-rh5-x86_64/lib/python2.7/site-packages/PyNIO/nio.so | grep 'libifcore.so'
turns up nothing, so it seems these libraries are not correctly linked in. Which leads me to suspect that the F2CLIBS and F2CLIBS_PREFIX environment variables are not properly read by the setup.py script.
I have defined them in the following way:
export F2CLIBS='m ifcore irc ifport'
export F2CLIBS_PREFIX=/opt/intel/composerxe-2011.4.191/compiler/lib/intel64/
With this combination (although different syntax) I was able to successfully build NCL. From my limited understanding of what the setup.py script does, this should produce a list of the required libraries required by f2py. But obviously it does not work that way.
In fact none of the above libraries are actually linked in to 'nio.so', except 'libm.so' which points to the standard GNU/Linux version.
I'm kinda stuck here, but I really want to figure this out!
I've attached a script with the compiler flags I'm using.
Any help would be highly appreciated!
Thanks,
Chopstick