public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* HelloWorld Problems
@ 2002-01-08 15:48 X X
  0 siblings, 0 replies; 2+ messages in thread
From: X X @ 2002-01-08 15:48 UTC (permalink / raw)
  To: gcc-help

Hello Community,

I am having problems compiling a simple HelloWorld program using GNU GCC. I
can't seem to use the -G, -symbolic, or -shared switches (which I don't
really need for my simple program, but do need for something a bit more
robust)...

The Specs...

OS: Solaris7
COMPILER: GNU gcc 2.95.3 (from sunfreeware.com)
LINKER: GNU ld 2.11.2 (with BFD 2.11.2) (from sunfreeware.com)

LD_LIBRARY_PATH=/usr/local/lib

The Program...

#include <iostream.h>

int main(int argc, char** argv)
{
cout << "HELLO WORLD!" << endl;
return 0;
}

The compiles (and the results)...

FIRST COMPILE

[/]$g++ -c -o HelloWorld.o HelloWorld.cpp

The above is successful and produces HelloWorld object file

[/]$g++ -o HelloWorld HelloWorld.o

The above is successful and produces HelloWord executable file

[/]$HelloWorld
HELLO WORLD!

The above is successful and outputs HELLO WORLD! on the console.

[/]$ldd HelloWorld
libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

SECOND COMPILE

[/]$g++ -c -o HelloWorld.o HelloWorld.cpp

The above is successful and produces HelloWorld object file

[/]$g++ -G -o HelloWorld HelloWorld.o

The above is successful and produces HelloWord executable file

[/]$HelloWorld

The above is NOT successful. It just hangs...

[/]$truss -f HelloWorld
18643:  execve("HelloWorld", 0xFFBEF83C, 0xFFBEF844)  argc = 1

and it just hangs.

[/]$ldd HelloWorld
libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

THIRD COMPILE

[/]$g++ -c -o HelloWorld.o HelloWorld.cpp

The above is successful and produces HelloWorld object file

[/]$g++ -shared -o HelloWorld HelloWorld.o

The above is successful and produces HelloWorld executable file

[/]$HelloWorld
Segmentation Fault(coredump)

The above is NOT successful. It immediately core dumps with a segmentation
fault...

[/]$truss -f HelloWorld
18659:execve("HelloWorld", 0xFFBEF83C, 0xFFBEF844)  argc = 1
18659:  Incurred fault #6, FLTBOUNDS  %pc = 0x00000008
18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
18659:  Received signal #11, SIGSEGV [default]
18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
18659:      *** process killed ***

[/]$ldd HelloWorld
libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

FOURTH COMPILE

[/]$g++ -c -o HelloWorld.o HelloWorld.cpp

The above is successful and produces HelloWorld object file

[/]$g++ -symbolic -o HelloWorld HelloWorld.o

The above is successful and produces HelloWorld executable file

[/]$HelloWorld
Segmentation Fault(coredump)

The above is NOT successful. It immediately core dumps with a segmentation
fault...

[/]$truss -f HelloWorld
18659:execve("HelloWorld", 0xFFBEF83C, 0xFFBEF844)  argc = 1
18659:  Incurred fault #6, FLTBOUNDS  %pc = 0x00000008
18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
18659:  Received signal #11, SIGSEGV [default]
18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
18659:      *** process killed ***

[/]$ldd HelloWorld
libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

Again, I am having trouble using the -G, -shared, or -symbolic switches. I
do admit that I am not a compile person and have limited understanding of
the switches I am using, so hopefully my mistake will be silly.

Thanks Community!

x1x82


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: HelloWorld Problems
@ 2002-01-08 16:44 X X
  0 siblings, 0 replies; 2+ messages in thread
From: X X @ 2002-01-08 16:44 UTC (permalink / raw)
  To: gcc-help


Well, I think part of my problem is that using any of those switches is 
completely unappropriate when building and executable file.

Doh!

x1x82

>From: "X X" <x1x82@hotmail.com>
>To: gcc-help@gcc.gnu.org
>Subject: HelloWorld Problems
>Date: Tue, 08 Jan 2002 19:48:35 -0400
>
>Hello Community,
>
>I am having problems compiling a simple HelloWorld program using GNU GCC. I
>can't seem to use the -G, -symbolic, or -shared switches (which I don't
>really need for my simple program, but do need for something a bit more
>robust)...
>
>The Specs...
>
>OS: Solaris7
>COMPILER: GNU gcc 2.95.3 (from sunfreeware.com)
>LINKER: GNU ld 2.11.2 (with BFD 2.11.2) (from sunfreeware.com)
>
>LD_LIBRARY_PATH=/usr/local/lib
>
>The Program...
>
>#include <iostream.h>
>
>int main(int argc, char** argv)
>{
>cout << "HELLO WORLD!" << endl;
>return 0;
>}
>
>The compiles (and the results)...
>
>FIRST COMPILE
>
>[/]$g++ -c -o HelloWorld.o HelloWorld.cpp
>
>The above is successful and produces HelloWorld object file
>
>[/]$g++ -o HelloWorld HelloWorld.o
>
>The above is successful and produces HelloWord executable file
>
>[/]$HelloWorld
>HELLO WORLD!
>
>The above is successful and outputs HELLO WORLD! on the console.
>
>[/]$ldd HelloWorld
>libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
>libm.so.1 => /usr/lib/libm.so.1
>libc.so.1 => /usr/lib/libc.so.1
>libdl.so.1 => /usr/lib/libdl.so.1
>/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
>
>SECOND COMPILE
>
>[/]$g++ -c -o HelloWorld.o HelloWorld.cpp
>
>The above is successful and produces HelloWorld object file
>
>[/]$g++ -G -o HelloWorld HelloWorld.o
>
>The above is successful and produces HelloWord executable file
>
>[/]$HelloWorld
>
>The above is NOT successful. It just hangs...
>
>[/]$truss -f HelloWorld
>18643:  execve("HelloWorld", 0xFFBEF83C, 0xFFBEF844)  argc = 1
>
>and it just hangs.
>
>[/]$ldd HelloWorld
>libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
>libm.so.1 => /usr/lib/libm.so.1
>libc.so.1 => /usr/lib/libc.so.1
>libdl.so.1 => /usr/lib/libdl.so.1
>/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
>
>THIRD COMPILE
>
>[/]$g++ -c -o HelloWorld.o HelloWorld.cpp
>
>The above is successful and produces HelloWorld object file
>
>[/]$g++ -shared -o HelloWorld HelloWorld.o
>
>The above is successful and produces HelloWorld executable file
>
>[/]$HelloWorld
>Segmentation Fault(coredump)
>
>The above is NOT successful. It immediately core dumps with a segmentation
>fault...
>
>[/]$truss -f HelloWorld
>18659:execve("HelloWorld", 0xFFBEF83C, 0xFFBEF844)  argc = 1
>18659:  Incurred fault #6, FLTBOUNDS  %pc = 0x00000008
>18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
>18659:  Received signal #11, SIGSEGV [default]
>18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
>18659:      *** process killed ***
>
>[/]$ldd HelloWorld
>libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
>libm.so.1 => /usr/lib/libm.so.1
>libc.so.1 => /usr/lib/libc.so.1
>libdl.so.1 => /usr/lib/libdl.so.1
>/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
>
>FOURTH COMPILE
>
>[/]$g++ -c -o HelloWorld.o HelloWorld.cpp
>
>The above is successful and produces HelloWorld object file
>
>[/]$g++ -symbolic -o HelloWorld HelloWorld.o
>
>The above is successful and produces HelloWorld executable file
>
>[/]$HelloWorld
>Segmentation Fault(coredump)
>
>The above is NOT successful. It immediately core dumps with a segmentation
>fault...
>
>[/]$truss -f HelloWorld
>18659:execve("HelloWorld", 0xFFBEF83C, 0xFFBEF844)  argc = 1
>18659:  Incurred fault #6, FLTBOUNDS  %pc = 0x00000008
>18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
>18659:  Received signal #11, SIGSEGV [default]
>18659:    siginfo: SIGSEGV SEGV_MAPERR addr=0x00000008
>18659:      *** process killed ***
>
>[/]$ldd HelloWorld
>libstdc++.so.2.10.0 => /usr/local/lib/libstdc++.so.2.10.0
>libm.so.1 => /usr/lib/libm.so.1
>libc.so.1 => /usr/lib/libc.so.1
>libdl.so.1 => /usr/lib/libdl.so.1
>/usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
>
>Again, I am having trouble using the -G, -shared, or -symbolic switches. I
>do admit that I am not a compile person and have limited understanding of
>the switches I am using, so hopefully my mistake will be silly.
>
>Thanks Community!
>
>x1x82
>
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-09  0:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-08 15:48 HelloWorld Problems X X
2002-01-08 16:44 X X

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).