* Is this bug in g++ /gcc-3.4.0 ?
@ 2004-05-10 1:40 yuki shimada
2004-05-10 14:00 ` llewelly
2004-05-10 14:04 ` Is this bug in g++ /gcc-3.4.0 ? Claudio Bley
0 siblings, 2 replies; 4+ messages in thread
From: yuki shimada @ 2004-05-10 1:40 UTC (permalink / raw)
To: gcc-help
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
Hollo!
I am Yuki Shimada.
This time , I had installed gcc-3.4.0 into my RedHat9.
And then,I had compiled "hello.cc" by using "g++". But cannot excute
"./a.out". Compiler tells me a error.
(Incase of "hellp.c" complied by "gcc", "./a.out" can excute well.)
#1 error from g++
[yuki@localhost c++]$ g++ hello.cc
[yuki@localhost c++]$ ./a.out
./a.out: error while loading shared libraries: libstdc++.so.6: cannot
open shared object file: No such file or directory
[yuki@localhost c++]$
#2 my source code: see attachment of this mail.
Is this a bug ?
thank you.
epsoft@mint.ocn.ne.jp
Yuki Shimada
[-- Attachment #2: hello.cc --]
[-- Type: text/x-c++, Size: 331 bytes --]
//hello.cc
#include<iostream>
using namespace std;
int main(){
cout<<"Hello !"<<endl;
return 0;
};
//
//[yuki@localhost c++]$ g++ hello.cc
//[yuki@localhost c++]$ ./a.out
// ./a.out: error while loading shared libraries: libstdc++.so.6:
// cannot open shared object file: No such file or directory
//[yuki@localhost c++]$
//
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is this bug in g++ /gcc-3.4.0 ?
2004-05-10 1:40 Is this bug in g++ /gcc-3.4.0 ? yuki shimada
@ 2004-05-10 14:00 ` llewelly
[not found] ` <1084241684.3170.2.camel@localhost.localdomain>
2004-05-10 14:04 ` Is this bug in g++ /gcc-3.4.0 ? Claudio Bley
1 sibling, 1 reply; 4+ messages in thread
From: llewelly @ 2004-05-10 14:00 UTC (permalink / raw)
To: yuki shimada; +Cc: gcc-help
yuki shimada <epsoft@mint.ocn.ne.jp> writes:
> Hollo!
> I am Yuki Shimada.
> This time , I had installed gcc-3.4.0 into my RedHat9.
> And then,I had compiled "hello.cc" by using "g++". But cannot excute
> "./a.out". Compiler tells me a error.
> (Incase of "hellp.c" complied by "gcc", "./a.out" can excute well.)
>
> #1 error from g++
> [yuki@localhost c++]$ g++ hello.cc
> [yuki@localhost c++]$ ./a.out
> ./a.out: error while loading shared libraries: libstdc++.so.6: cannot
> open shared object file: No such file or directory
You need to tell your linker-loader where to find libstdc++.so.6
. Use 'man ld.so' to read about the linker-loader.
By default, gcc will install libstdc++.so.6 into /usr/local/lib . If
you configured gcc with --prefix, it will be in $prefix/local/lib
. If you don't know where libstdc++.so.6 is,
$ find / -iname 'libstdc++.so.6' -print
will tell you where it is.
Once you know where libstdc++.so.6 is, you can use ldconfig or
LD_LIBRARY_PATH to tell the linker-loader where it is. Use 'man
ldconfig' and 'man ld.so.conf' to read about ldconfig . Usually:
# echo /usr/local/lib >> /etc/ld.so.conf
# ldconfig
(run as root)
is correct. If libstdc++.so.6 is not in /usr/local/lib, replace
'/usr/local/lib' with the directory containing libstdc++.so.6 .
To use LD_LIBRARY_PATH, set it as an environment variable:
in bash:
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
in csh:
> setenv LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
Again, if libstdc++.so.6 is not in /usr/local/lib, replace it
with the directory containing libstdc++.so.6 .
> #2 my source code: see attachment of this mail.
> Is this a bug ?
It's not a bug. Thank you for providing more information.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is this bug in g++ /gcc-3.4.0 ?
2004-05-10 1:40 Is this bug in g++ /gcc-3.4.0 ? yuki shimada
2004-05-10 14:00 ` llewelly
@ 2004-05-10 14:04 ` Claudio Bley
1 sibling, 0 replies; 4+ messages in thread
From: Claudio Bley @ 2004-05-10 14:04 UTC (permalink / raw)
To: gcc-help
On Mon, May 10, 2004 at 10:01:41AM +0900, yuki shimada wrote:
> Hollo!
Konnichiha!
> I am Yuki Shimada.
> This time , I had installed gcc-3.4.0 into my RedHat9.
> And then,I had compiled "hello.cc" by using "g++". But cannot excute
> "./a.out". Compiler tells me a error.
No, this is not a compiler error - the compiler is already done; the
program was compiled successfully.
> (Incase of "hellp.c" complied by "gcc", "./a.out" can excute well.)
>
> #1 error from g++
> [yuki@localhost c++]$ g++ hello.cc
> [yuki@localhost c++]$ ./a.out
> ./a.out: error while loading shared libraries: libstdc++.so.6: cannot
> open shared object file: No such file or directory
> [yuki@localhost c++]$
> #2 my source code: see attachment of this mail.
>
> Is this a bug ?
No, it's not a bug. It means the dynamic linker/loader (ld.so) hasn't found the
dynamic library it was looking for (libstdc++.so.6).
Just read the friendly `ld.so' man page (man ld.so) also avialable online;
e.g. here:
http://unixhelp.ed.ac.uk/CGI/man-cgi?ld.so+8
in order to set it up that it can find the libraries where you installed them.
--
Claudio
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is this bug in g++ /gcc-3.4.0 #3?
[not found] ` <1084241684.3170.2.camel@localhost.localdomain>
@ 2004-05-11 4:58 ` llewelly
0 siblings, 0 replies; 4+ messages in thread
From: llewelly @ 2004-05-11 4:58 UTC (permalink / raw)
To: yuki shimada; +Cc: gcc-help
I cc'd this to the gcc-help list because someone else there may either
have a suggestion, or may have the same problem.
yuki shimada <epsoft@mint.ocn.ne.jp> writes:
> Dear person
> I am Yuki Shimada.
> Thank you for your helpping me.
> I had tried
>
> 1) I can find "libstdc++.so.6" is in "/usr/local/lib/libstdc++.so.6"
> for example, I can read following list.
> libstdc++.so
> libstdc++.so.6
> libstdc++.so.6.0.0
>
> ( "find / -iname 'libstdc++.so.6' -print" takes very long time in my
> cpu .
> So I did not complete it . )
>
> 2) # echo /usr/local/lib >> /etc/ld.so.conf
> # ldconfig
> ---> after that,in "/etc/ld.so.conf", command list are as followes.
>
> /usr/kerberos/lib
> /usr/X11R6/lib
> /usr/lib/sane
> /usr/lib/qt-3.1/lib
> /usr/local/lib
>
>
> 3) in bash: I added some command like followings. Is this OK ?
>
> # .bash_profile
>
> # Get the aliases and functions
> if [ -f ~/.bashrc ]; then
> . ~/.bashrc
> fi
>
> # User specific environment and startup programs
>
> PATH=$PATH:$HOME/bin
> $export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
> BASH_ENV=$HOME/.bashrc
> USERNAME="root"
You don't need to do both LD_LIBRARY_PATH and ldconfig; only one or
the other. LD_LIBRARY_PATH is per-user, ldconfig affects the whole
machine. The cache updated by ldconfig is checked before
LD_LIBRARY_PATH, however.
>
> export USERNAME BASH_ENV PATH
>
> 4) For about "csh", I have no knowledge about this.
> Usually,I use "linux ". Must I set LD_LIBRARY_PATH in csh ?
You only need to set LD_LIBRARY_PATH for the shell you use. If you
only use bash, don't worry about csh.
> 5) compilling and excuting result for my case;
>
> [root@localhost c++]# g++ hello.cc
> [root@localhost c++]# ./a.out
> ./a.out: /lib/libgcc_s.so.1: version `GCC_3.3' not found (required by
> /usr/local/lib/libstdc++.so.6)
> [root@localhost c++]#
This is rather strange. I don't get this problem my fbsd or linux
boxen. But I think the problem can be solved a same way: find
libgcc_s.so.1, and then add the dir it is in to ldconfig.
There are two caveats: you will have more than
one libgcc_s.so.1 The one you want is probably in
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/lib or in
/usr/local/lib . You can find out for sure it is the right one by
using:
$ nm /usr/local/lib/libgcc_s.so.1 | grep GCC_3.4
which should print something like:
00000000 A GCC_3.4
The second caveat is that the directory containing the libgcc_s.so.1
from gcc 3.4 *must* come first in both lists. So change your
ld.so.conf to look like this:
/usr/local/lib
/lib
/usr/lib
/usr/kerberos/lib
/usr/X11R6/lib
/usr/lib/sane
/usr/lib/qt-3.1/lib
Finally run:
# ldconfig
If this doesn't work, try LD_PRELOAD (which is also explained in the
ld.so man page.) like this:
$ export LD_PRELOAD=/usr/local/lib/libgcc_s.so.1
> 6) totally, I can not excute ./a.out still now.
> Must I install "GCC_3.3" ?
GCC_3.3 is a symbol which libstdc++.so.6 requires. You could install
gcc 3.3.3, but it wouldn't help; you still need to make ld.so find
the *right* libgcc_s.so.1, and then, instead of having two, you'd
have 3! So hold off on installing gcc 3.3.3 until you get 3.4
working.
> 7)Please help me!.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-11 4:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-10 1:40 Is this bug in g++ /gcc-3.4.0 ? yuki shimada
2004-05-10 14:00 ` llewelly
[not found] ` <1084241684.3170.2.camel@localhost.localdomain>
2004-05-11 4:58 ` Is this bug in g++ /gcc-3.4.0 #3? llewelly
2004-05-10 14:04 ` Is this bug in g++ /gcc-3.4.0 ? Claudio Bley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).