What is libg2c library?
What is GNU Fortran?
g77
consists of several components:
A modified version of the
gcc
command, which also might be installed as the system'scc
command. (In many cases,cc
refers to the system's “native” C compiler, which might be a non-GNU compiler, or an older version ofgcc
considered more stable or that is used to build the operating system kernel.)The
g77
command itself, which also might be installed as the system'sf77
command.The
libg2c
run-time library. This library contains the machine code needed to support capabilities of the Fortran language that are not directly provided by the machine code generated by theg77
compilation phase.
libg2c
is just the unique nameg77
gives to its version oflibf2c
to distinguish it from any copy oflibf2c
installed fromf2c
(or versions ofg77
that builtlibf2c
under that same name) on the system.
You may think of it as, libg2c
is to g77
as libc
is to gcc
.
Note that as of the GCC 4.x series, g77
has been discontinued, replaced by gfortran, which produces programs that do not require an extra libg2c
runtime library.
compiling fortran 77 code with ifort : libg2c missing
libg2c is a library used by the obsolete g77 compiler. If the reference is in a makefile you found, just remove it. The "ifort" command should be able to provide the necessary libraries.
How to find out which compiler was used: g77 or gfortran
nm filename | fgrep ' __g77'
will give results if g77 was used, meanwhile
nm filename | fgrep '@@GFORTRAN'
will give results if gfortran is used.
Linker errors with Fortran to C library - /usr/lib/libf2c.so: undefined reference to 'MAIN__'
You should have paid closer attention to the first error message. The linker is telling you that no symbol MAIN__
can be found, which is what f2c is expected that the fortran main will be compiled to in your C or C++ code somewhere. The f2c library itself was working just fine.
The solution to the original error would be to make sure the correct entry point is defined in your code. It might be that by using C++ to compile, you have name mangling problems and the correct entry point for the f2c library doesn't exist.
Now by messing around with the f2c libraries, you have totally broken your f2c installation. Reinstall it and start again...
Trying to install PostStat, a library to add statistics function into Postgres
change -lg2c by -lf2c
Add to poststat.c , at the end
int MAIN__(){
return (0);
}
Trying to install PostStat, a library to add statistics function into Postgres
change -lg2c by -lf2c
Add to poststat.c , at the end
int MAIN__(){
return (0);
}
Determine which compiler built my LAPACK
From the same INSTALL
file you referenced...
How to check the ABI of blas/lapack/atlas
-----------------------------------------
One relatively simple and reliable way to check for the compiler used to build
a library is to use ldd on the library. If libg2c.so is a dependency, this
means that g77 has been used. If libgfortran.so is a a dependency, gfortran has
been used. If both are dependencies, this means both have been used, which is
almost always a very bad idea.
If I had to guess, I would probably guess gfortran also as the only two free fortran compilers that I know of are g77 and gfortran and g77 development is pretty much dead as far as I know ... Another thing to check is g77 (by default) appended two underscores to symbols whereas gfortran (by default) only appends one. This is probably the thing that is most important for numpy to know ... although there may be other subtle differences (if numpy is doing some dirty hacking to get at information stored in a common block for instance).
Related Topics
How to Identify Padding Scheme Used in Rsa Signature of a Certificate, Using Openssl
Run Shell Script After Xserver Is Started
Built-In Kernel Driver Still Need Device Tree
Hbase Does Not Run After ./Start-Hbase.Sh - Permission Denied
Curl Http Post File Upload Using Curl -Data in Linux Command Line
How to Use Sysfs Inside Kernel Module
Need Some Advise to Begin Programming on Arm (With Linux) Platform
Insufficient Permission Pushing to Git Shared Repo Over Smart Http
Are Debug Symbols Loaded into Memory on Linux
Creating an Alias in Ubuntu, in .Profile
Unix/Linux Ipc: Reading from a Pipe. How to Know Length of Data at Runtime
Caputre Opengl Window in X11 with Fast Framerate - Possible
How to Enable Hocr Font Info in Tesseract 4
Extract Parent Domain Name from a List of Url Through Bash Shellscripting
Linux + Find Word in File Under Directory But Quickly
How to Compare 3 Files Together (To See What Is in Common Between Them)