Re: How do I install this missing library?
From: Rick Moen (rick_at_linuxmafia.com)
Date: Tue, 20 Sep 2005 01:24:00 -0400
Random Penguin <email@example.com> wrote:
> Hi guys...
> work@home:~/lstc/lsopt_2.2/Executables/LSOPT_EXE> ldd lsopt
> linux-gate.so.1 => (0xffffe000)
> libg2c.so.0 => not found
> libm.so.6 => /lib/tls/libm.so.6 (0x4002a000)
> libc.so.6 => /lib/tls/libc.so.6 (0x4004d000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> Yes, I tried Googling for it. The suggested command:
> ./configure --enable-languages=c,c++,f77
> doesn't work. I get:
> work@home:~/lstc/lsopt_2.2/Executables/LSOPT_EXE> ./configure
> -bash: ./configure: No such file or directory
Greetings again. Elsewhere in this thread, you'll notice I warned you
that computer geeks have a ghastly tendency to answer questions exactly
as posed -- even if they're quietly thinking to themselves "But _why_
would the user want to do that?"
In this case, you inadvertantly framed the question as "Why am I getting
"No such file or directory" when I type "./configure"?
But, reading your post carefully, that is _not_ the problem you really
wanted to solve. You have some sort of (locally installed, I guess)
binary called "lsopt" that is trying to dereference (locate and load)
library "libg2c.so.0" and failing -- on a SUSE Linux 9.2. system.
Impliedly, your big-picture question is: "How can I run lsopt?"
Maybe, you grabbed a binary copy of Livermore Software Technology Corp's
LS-OPT, the optimization and probabilistic analysis program? In that
caes, you really should be carefully following LSTC's installation
instructions, which will tell you how to ensure that the program's
dependencies have been met.
If it turns out that LSTC's instructions include "You are responsible
for making sure that libg2c.so.0 exists on your system", then we have a
slightly different [sub-]problem.
Some googling reveals that libg2c is "gcc's internal replacement for
libf2c, the FORTRAN to C wrapper's library." I'm guessing that those
words will be familiar to you -- that you've done the same googling I
did, and found this post:
That poster said:
libg2c is part of gcc. Actually, it is gcc's internal replacement for
libf2c, the FORTRAN to C wrapper's library. What you need is a FORTRAN
enabled gcc package:
Er, slow down. I see what you did, but you need to stop and consider
what you're doing and why.
The debian.org poster was saying that libg2c is a library that gets
built when you _build gcc_ with FORTRAN-support enabled at that time
(as an option while building gcc). You should be aware that gcc is
a _suite_ of compilers, not (any longer) just a C compiler, which is
why it's now been retroactively renamed the GNU Compiler Collection
(instead of its original name of GNU C Compiler).
_But_, that having been said, the f2c component of gcc (the FORTRAN-to-C
preprocessor component) apparently isn't always present in standard gcc
installations. The Debian poster was saying that, if you don't already
have libg2c available on your system, even though you have gcc installed
(and do you, by the way?), then it might be because the guys who
compiled your distribution's version of gcc didn't bother to compile
_it_ with the necessary FORTRAN-support compilation options.
The Debian poster assumed he was talking to someone who knew the basics
of how (and why, and when) to locate a codebase in source code form and
recompile it. One hopes that his advice was appropriate in the original
context. It's less clear that it is appropriate in yours.
For one thing, gcc is very close to the top of my list of things _not_
to tell a newcomer to compile. It is a very large and very complex
codebase, which goes through some unusual steps to complete the compile.
(It compiles the compiler, then uses that to compile itself again, and
then compares the two new compilers to make sure they're the same.)
Compiling gcc takes a really, really long time and a tremendous amount
of RAM and disk space. Believe me, you will not want to do that unless
you really must. And you would not wisely take on that task until after
you know your way around Linux/Unix systems and know the basics of
compiling things, well. You would start with something really small,
like the source code to GNU tar, and make sure you understand what's
going on, there, before moving on to larger and more complex things.
You'd want to have at least a vague notion about autoconf (and thus
about files called "configure" that you find in the top level of an
unpacked source code tarball), about GNU make, about system libraries
and the dynamic loader (ldd) + its cache + its configuration file.
Not to put too fine a point on it, you would _definitely_ not seek to
compile gcc at a time when you type "./configure" _outside_ the source
tree you're seeking to compile, and are mystified when the system
responds "bash: ./configure: No such file or directory".
That error message means:
1. bash (your shell) is saying something to you. ("bash:")
2. It's saying that it looked around in the current directory
for the file you asked it to run, "configure", and didn't see
any such file.
What's the big picture, on that? The Debian poster was saying: "Look,
if you really need libg2c (which is an optionally-compiled part of gcc),
and _if_ you already have gcc installed, then obviously your problem
is that your gcc was compiled without FORTRAN support. Therefore,
_if_ that's your situation, and you care enough to go through the
_serious_ pain of compiling gcc, then
1. fetch the source code to whatever version of gcc you wish to
2. untar that source code.
3. cd into the unpacked archive's top-level directory.
4. _Then_, type "./configure --enable-languages=c,c++,f77"
5. (Impliedly,) then carry out whatever other steps the gcc
source tarball's README specifies, to complete that process.
The obvious question, in any event, is: _Is there a better way_
to install a FORTRAN-enabled set of gcc files on your SUSE 9.2 system?
Damn straight there is! I googled for
SUSE package libg2c
and it popped out immediately: You're going to want to install a
binary RPM package -- a package _right on_ your SUSE Linux 9.2
installation CDs, called "gcc-g77", which furnishes
/usr/lib/libg2c.so.0, among other things.
> I don't really want to redownload & burn my SuSE 9.2 DVD...
Well, now you now one reason why you made a big error in _not_ keeping
around a copy of your installation media. Silly user.
SUSE package libg2c 9.2
finds, as an early hit:
...but there's a gotcha....
In downloading RPMs, you face the pitfall of making _very_ sure that you
are getting RPMs for the correct CPU architecture. SUSE installs
slightly different sets of RPMs, depending on whether your CPU is x86_64
(i.e., either AMD64 or EM64T) on the one hand, or generic x86 (which is
dubbed "i386") on the other. Here are all of RPMfind.net's RPMs for
SUSE's 9.2 release -- listing all the architectures:
And, whoops, rpmfind.net itself has a broken link in place of its 9.2
tree. But there's a link to a "local mirror" at
Digging down, we find directories that have actual binary RPMs:
Which of those you should visit will depend on what sort of architecture
you have -- and, guess what? You didn't bother to mention that.
In the i586 tree:
In the x86_64 tree:
gcc-g77-3.3.4-11.x86_64.rpm <= Used for 32-bit compilation.
gcc-g77-32bit-9.2-200412202043.x86_64.rpm <= Used for 64-bit compilation.
I'll bet that installing whichever set of those is appropriate for your
architecture will fix your problem -- _without_ having to spend hours
and hours recompiling gcc.
And: "rpm -Uvh something.rpm" will do the trick (carried out as the
root user), given that something.rpm has been downloaded to the current
And^2: You might as well redownload and burn your SUSE 9.2 DVD.
-- Cheers, Mark Moraes: "Usenet is not a right." Rick Moen Edward Vielmetti: "Usenet is a right, a left, a jab, firstname.lastname@example.org and a sharp uppercut to the jaw. The postman hits! You have new mail."