public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* maybe successful build of gcc-20020304 and gnat
@ 2002-03-10 21:56 scott worley
  2002-03-10 23:58 ` Florian Weimer
  2002-03-11  1:24 ` Pete Barrie
  0 siblings, 2 replies; 4+ messages in thread
From: scott worley @ 2002-03-10 21:56 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]

Hi,

I was able to build the gcc-20020304 snapshot with GNAT by:

gcc 2.95.3
binutils 2.11.92.0.12.3 20011121
glibc 2.2.4

For the Ada compiler I used Debian's GNAT 3.14p.

Configure gcc with
--program-suffix=-3.1b
--enable-shared
--enable-threads
--enable-version-specific-runtime-libs
--enable-languages=ada,c,c++,objc,f77
--enable-nls
--without-included-gettext

Followed the instructions to build GNAT,
make bootstrap
cd gcc
make gnatlib_and_tools

So now I've got the new gcc under /usr/local.  A small hello.c will
compile and run but I'm unable to compile c++ test program.

#include <iostream>

class stupidExample {
...
}

int main()
{
	stupidExample example1;

	cout << "Test class method " << example1.getValue() << "\n";

	return(0);
}

The compiler complains about cout not being defined.  Must I provide a
path for c++ header files?

make install put the c++ headers in:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++

I've tried using this path with -I or #include with no luck.  My c test
program included stdlib.h & stdio.h which live in the same dir hierarchy
and gcc-3.1b found them.

What stupid mistake have I made?

Also, out of curiosity I looked at gcc-3.1 & g++-3.1 binaries with a hex
editor and both are full of paths to the gcc-2.95.3 in /usr.  Is the
default gcc-20020304 build setup with debug info. or does this mean I
screwed the build up.

thanks,
scott
folokai@earhtlink.net




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: maybe successful build of gcc-20020304 and gnat
  2002-03-10 21:56 maybe successful build of gcc-20020304 and gnat scott worley
@ 2002-03-10 23:58 ` Florian Weimer
  2002-03-11 10:06   ` scott worley
  2002-03-11  1:24 ` Pete Barrie
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2002-03-10 23:58 UTC (permalink / raw)
  To: scott worley; +Cc: gcc-help

scott worley <folokai@earthlink.net> writes:

> I was able to build the gcc-20020304 snapshot with GNAT by:

Mainline or branch?

> The compiler complains about cout not being defined.  Must I provide a
> path for c++ header files?

cout is defined in namespace std, so you have to use "std::cout" (or
"using namespace std;").

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

* Re: maybe successful build of gcc-20020304 and gnat
  2002-03-10 21:56 maybe successful build of gcc-20020304 and gnat scott worley
  2002-03-10 23:58 ` Florian Weimer
@ 2002-03-11  1:24 ` Pete Barrie
  1 sibling, 0 replies; 4+ messages in thread
From: Pete Barrie @ 2002-03-11  1:24 UTC (permalink / raw)
  To: scott worley, gcc-help

At 21:48 10/03/2002 -0800, scott worley wrote:
>Hi,
>
>I was able to build the gcc-20020304 snapshot with GNAT by:
>
>gcc 2.95.3
>binutils 2.11.92.0.12.3 20011121
>glibc 2.2.4
>
>For the Ada compiler I used Debian's GNAT 3.14p.
>
>Configure gcc with
>--program-suffix=-3.1b
>--enable-shared
>--enable-threads
>--enable-version-specific-runtime-libs
>--enable-languages=ada,c,c++,objc,f77
>--enable-nls
>--without-included-gettext
>
>Followed the instructions to build GNAT,
>make bootstrap
>cd gcc
>make gnatlib_and_tools
>
>So now I've got the new gcc under /usr/local.  A small hello.c will
>compile and run but I'm unable to compile c++ test program.
>
>#include <iostream>
>
>class stupidExample {
>...
>}
>
>int main()
>{
>         stupidExample example1;
>
>         cout << "Test class method " << example1.getValue() << "\n";
>
>         return(0);
>}
>
>The compiler complains about cout not being defined.  Must I provide a
>path for c++ header files?
>
>make install put the c++ headers in:
>/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++
>
>I've tried using this path with -I or #include with no luck.  My c test
>program included stdlib.h & stdio.h which live in the same dir hierarchy
>and gcc-3.1b found them.
>
>What stupid mistake have I made?


I've been through this over the last few days and
have been kindly helped by various people. Thanks! Here's
the most useful advice in relation to your problem...

Try this for your C++ test:

#include <iostream>
using std:: cout; using std::endl;
int main ()
{
cout << "Hello World!" << endl;
return 0;
}

check on your compiler version:
gcc -v or g++ -v

Build with:
g++ -o foo foo.cpp -L/usr/local/lib
or (for example)...
/usr/local/bin/g++ -o foo foo.cpp -L/usr/local/lib



(see the recent mail from Kayvan A. Sylvan )

And do this if everything works...

"In your specs file (you can find its location by ``gcc -v''), add the
-L/usr/local/lib to the head of the "*link:" section and now
you no longer have to use the -L flag and other gcc versions
can co-exist peacefully."

HTH

Pete



>Also, out of curiosity I looked at gcc-3.1 & g++-3.1 binaries with a hex
>editor and both are full of paths to the gcc-2.95.3 in /usr.  Is the
>default gcc-20020304 build setup with debug info. or does this mean I
>screwed the build up.
>
>thanks,
>scott
>folokai@earhtlink.net
>
>
>

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

* Re: maybe successful build of gcc-20020304 and gnat
  2002-03-10 23:58 ` Florian Weimer
@ 2002-03-11 10:06   ` scott worley
  0 siblings, 0 replies; 4+ messages in thread
From: scott worley @ 2002-03-11 10:06 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

On Mon, 11 Mar 2002 08:58:20 +0100
Florian Weimer <fw@deneb.enyo.de> wrote:

> scott worley <folokai@earthlink.net> writes:
> 
> > I was able to build the gcc-20020304 snapshot with GNAT by:
> 
> Mainline or branch?
> 
> > The compiler complains about cout not being defined.  Must I provide a
> > path for c++ header files?
> 
> cout is defined in namespace std, so you have to use "std::cout" (or
> "using namespace std;").

Florian,

I read through the gcc mailing list and found the announcement for gcc-20020304 snapshot.  Followed the link to the ftp site and downloaded the tar ball.  I have tried using cvs in the past, for example, used the -rgcc_ss_20020225 and cvs created two directories, gcc and gcc-20020225.  The gcc-20020225 dir didn't seem complete, no configure script.  So I decided to use the tar balls.

I've spent about a week trying to build GNAT from gcc cvs, -rgcc_latest_snapshot, or using one of the snapshot tar balls.  Since my goal was GNAT most of the problems were due to not having a 'good' pre-install of GNAT.  I tried the pre-built gnat from nyu and couldn't figure out how to set everythink up to work without conflicting with system gcc(2.95.3)

/usr/bin/gcc is gcc 2.95.3 with
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3 in ld.so.conf

nyu gnat, modified install makefile to put it in /opt/gnat
/opt/gnat/bin/gnat,gnatmake,... all point to .gnat-script which runs bin's
in /opt/gnat/bin/real/gcc,gnatmake,...
/opt/gnat/lib/gcc-lib/i686-pc-linux-gnu/2.8.1 didn't think to put this in ld.so.conf

PATH=/usr/bin:/usr/local/bin:...:/opt/gnat/bin
ADAC=/opt/gnat/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/gnat1

I think one problem with this setup is:
1. some build process calls gnat which knows it's real binary is /opt/gnat/bin/real/gcc (2.8.1) which is OK
2. /opt/gnat/bin/real/gcc was built to use the normal names for all the other gcc programs, linker, etc.
3. Since the path has gcc(2.95.3) first then the build fails because gcc(2.8.1) is trying to use tools from gcc(2.95.3).

gcc3's configure script would find /opt/gnat/lib/.../gnat1 OK when I had ADAC set but failed on some other gnat test because the resulting objdir/gcc/Makefile would not have any gnat build rules in it.

So from another machine running Debian(sid) I tar'd gnat-3.14p which debian modified to use differnent names, i.e. gcc -> gnatgcc.  Put this into /usr and added the /usr/lib/gcc-lib/i486.../2.95.3 to ld.so.conf and gcc3 was able to build gnat, c, c++, objc and f77.

If I understood the unix compile/link toolchain better, this would not have taken so long.

Thanks for the help.  I don't use c++, the last time was about 10 years ago and was Borland's Turbo c++.

scott
folokai@earthlink.net

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

end of thread, other threads:[~2002-03-11 18:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-10 21:56 maybe successful build of gcc-20020304 and gnat scott worley
2002-03-10 23:58 ` Florian Weimer
2002-03-11 10:06   ` scott worley
2002-03-11  1:24 ` Pete Barrie

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