This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: HelloWorld Problems



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]