Ask Your Question

incompatible libgfortran version?

asked 2013-03-27 16:28:42 +0200

kjlvcxzoiperwq gravatar image

I am using a python code that someone else wrote that links to some fortran libraries. I can get the code to work with my system installation of python (Python 2.7.2+ default, Oct 4 2011, 20:06:09 [GCC 4.6.1] on linux2). My operating system is Ubuntu 11.10. When I try to use the same python code in sage, I get the following error:

OSError: /opt/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/ version `GFORTRAN_1.4' not found (required by [omitting the full path on this website for privacy reasons]/

when the

ctypes.cdll.LoadLibrary(u"[omitting the full path on this website for privacy reasons]/")

command is run.

I really don't know anything about fortran or how ctypes works, but it appears as though the sage version that I am using has a different libgfortran version than my operating system used when I created the fortran object files from the fortran code and linked them with the gfortran command. Here is some output from the command "dpkg --list | grep compiler|grep fortran"

ii gfortran 4:4.6.1-2ubuntu5 GNU Fortran 95 compiler ii gfortran-4.6 4.6.1-9ubuntu3 GNU Fortran 95 compiler

Is there some way I can tell sage to use the same libgfortran as my system python distribution? Will updating sage resolve this issue?

edit retag flag offensive close merge delete


although I would have liked to know the cause of this for future reference, upgrading to the latest version of sage did resolve the issue somehow.

kjlvcxzoiperwq gravatar imagekjlvcxzoiperwq ( 2013-04-05 01:17:03 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-30 19:47:43 +0200

Volker Braun gravatar image

It seems that Sage built its own gcc/gfortran since your host compilers were deemed inadequate (possibly a version where we ran into compiler bugs). Open a Sage shell (sage -sh) and recompile your module, this will then use the same compiler as Sage.

edit flag offensive delete link more


this didn't work. i checked, and it doesn't appear that sage -sh is causing a different compiler to be used. does this prove it?

kjlvcxzoiperwq gravatar imagekjlvcxzoiperwq ( 2013-04-01 11:11:09 +0200 )edit

user@user-cfd-workstation:~$ which gfortran /usr/bin/gfortran user@user-cfd-workstation:~$ sage -sh Starting subshell with Sage environment variables set. Be sure to exit when you are done and do not do anything with other copies of Sage! Bypassing shell configuration files ... SAGE_ROOT=/opt/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux (sage subshell) user-cfd-workstation:~ user$ which gfortran /usr/bin/gfortran SAGE_ROOT=/opt/sage-4.8-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux (sage subshell) user-cfd-workstation:~ user$

kjlvcxzoiperwq gravatar imagekjlvcxzoiperwq ( 2013-04-01 11:11:31 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-03-27 16:28:42 +0200

Seen: 685 times

Last updated: Mar 30 '13