Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
GNU is Not Unix

GCC 3.2 Released 311

bkor forwards the GCC 3.2 release announcement, without attributing it as such: "The GCC 3.2 release is now available, or making its way to, the GNU FTP sites. The purpose of this release is to provide a stable platform for OS distributors to use building their next OS releases. A primary objective was to stabilize the C++ ABI; we believe that the interface to the compiler and the C++ standard library are now stable. There are almost no other bug-fixes or improvements in this compiler, relative to GCC 3.1.1. Be aware that C++ code compiled by GCC 3.2 will not interoperate with code compiled by GCC 3.1.1. More detail about the release is available. Many people contributed to this release -- too many to name here!"
This discussion has been archived. No new comments can be posted.

GCC 3.2 Released

Comments Filter:
  • by eviltypeguy ( 521224 ) on Thursday August 15, 2002 @12:52PM (#4077896)
    I've been waiting for this. Building glibc in the past w/ gcc3 was PAINFUL beyond measure. There are still many optimization options that I have to use with programs otherwise gcc3's optimizers optimize away too much.

    For example, if I compile the modified Quake engine project I work on without -fno-strict-aliasing bizarre graphical errors occur. (Or used, need to check 3.2 now :)

    Or if I compile with -march=athlon I get fairly mixed results, code that sometimes segfaults for no apparent reason, etc.

    Anyway, congrats to the gcc3.2 team...
    • by edhall ( 10025 ) <slashdot@weirdnoise.com> on Thursday August 15, 2002 @02:09PM (#4078599) Homepage

      Bugs that come and go depending upon whether strict aliasing rules are assumed or not are generally due to broken code. The C standard is quite explicit about when aliasing is allowed and when it isn't. (Aliasing is when there are two or more pointers to the same region of memory. This is generally OK if the pointers are of the same type, or if an appropriate union is used. Two pointers of different types pointing to the same region of memory are generally veboten (char* is an exception).)

      The aliasing rules tend to be a source of trouble since violating them was fairly common in pre-standard days. (The V6 Unix kernel used to use generic pointers -- like "register *p" -- just about everywhere, something that is prohibited under ANSI.) They exist to allow the compiler to optimize based on the assumption that only pointers of the appropriate type can be used to access a stored value, and thus that value can be assumed to be unmodified (allowing redundant accesses to be eliminated) in a larger number of cases.

      A Google search on "C aliasing" will turn up a fair amount of info on the subject.

      -Ed
      • It makes it much harder to certify this though when the same behavior isn't present under gcc2.95x or other compilers, such as MSVC, MingW, or the *BSD compilers, etc.

        Even if the aliasing case is indeed a bug in the code somewhere, the fact that -march=i686 works perfectly, while -march=athlon can cause X to segfault, the program segfault, or the program not show all the graphics leads me to believe it still needs help.

        Don't get me wrong, I was happy to see the new Athlon option, but it doesn't do me much good when very minimalistic code gets generated incorrectly...
  • by Anonymous Coward
    GCC 3.2 works great when compiling FreeBSD.
  • What am I supposed to do with games/commercial software compiled with 2.95.x? Is that not going to work? Someone please enlighten me...
    • yes they will work (Score:5, Informative)

      by Ender Ryan ( 79406 ) <MONET minus painter> on Thursday August 15, 2002 @01:11PM (#4078080) Journal
      All your existing binaries will still work, you just won't be able to link against them when compiling with GCC 3.2. Most commercial apps are statically linked against whatever GUI toolkit they use (as for games, all Loki's games are), so you have nothing to worry about.

    • Keep your old libs around. But that is why I don't like binary code, cause I have to maintain seperate revisions of libstdc++.
    • If you're using such software and it's dynamically linked, you could do the following: (as long as it's not SUID/SGID...)

      1. ldd to determine what shared libraries are used -- at least, the ones that were specified at link time. Run-time linking, you'd need to determine by testing and perhaps strace().

      2. Put copies of compatible versions of these libraries in a directory set up for this purpose.

      3. Write a script that sets LD_LIBRARY_PATH to that directory, runs the program, and unsets it afterwards. Don't put this directory in /etc/ld.so.conf unless there aren't going to be newer versions of these libraries that recompiled programs will use...

      Then the binary should look in LD_LIBRARY_PATH first for the libraries.

      If it's SUID/SGID... you'd probably need to do something more, like imprisoning the program in a chroot() jail with its own set of libraries, because ld.so will ignore the LD_LIBRARY_PATH variable in that case.
  • by Anonymous Coward
    What I'd really like to see is gdb working with GCC3.2. We've been developing with gnu c++ 3.1 here, and 3.1 is much more standards-compliant than, say, 2.96. However, using gdb in conjunction with it is a real headache. Perhaps with this stabilized 3.2 release, there shall come a day when gdb is really useful.
    • by Anonymous Coward
      Blame GDB. Maybe there will come a day when the GDB team understands that most people are not doing embedded work, and that C++ is *very* important.
      That day is not here.

      The reason you can't do things like useful debugging of optimized programs isn't because GCC can't produce the debug info necessary. It can, and would (IE patches exist that make it do so, and would be accepted without any trouble), but GDB can't handle the information.
      This is unlikely to change unless someone whacks the GDB team upside the head. Most are embedded developers, and just don't get that the majority of GDB users don't care about cross-debugging 18 versions of the same chip, over a serial line. They want to be able to debug their desktop programs.

      This is why things like namespace support, dwarf2 location expression/location list support, etc, are *not* priorities for gdb, but things like "multi-arch" (using one gdb to debug 18 OS/ISA/ABI variations of a given architecture) are *requirements* for targets not to be obsoleted.
      • The reason you can't do things like useful debugging of optimized programs isn't because GCC can't produce the debug info necessary. It can, and would (IE patches exist that make it do so, and would be accepted without any trouble), but GDB can't handle the information.

        <HUMOR>
        Darn that Microsoft! You can't even debug Linux code properly without needing an IE patch!
        </HUMOR>
  • Thank God! (Score:5, Funny)

    by Da Masta ( 238687 ) <.dmu_net. .at. .hotmail.com.> on Thursday August 15, 2002 @01:05PM (#4078028)
    aware that C++ code compiled by GCC 3.2 will not interoperate with code compiled by GCC 3.1.1

    Good thing I didn't waste an entire f*cking week compiling Gentoo 1.3 with GCC 3.1. It would have been a STUPID WASTE of time if I had done that. Yeah, good thing I saw this coming.

    GOD DAMNED PIECE OF F*CKING SH*T!
  • Stabilized C++ (Score:2, Insightful)

    This is the *main* thing:

    A primary objective was to stabilize the C++ ABI; we believe that the interface to the compiler and the C++ standard library are now stable.


    Hopefully they will freeze the C++ interface for a long time and linux/bsd distributions will not have backward compatibility issues when upgrading GCC. THANK YOU SO MUCH to al the GCC developers/contributors.
  • by doorbot.com ( 184378 ) on Thursday August 15, 2002 @01:10PM (#4078076) Journal
    In the past few weeks I've been working on moving my main (home) server from Slackware on i386 to Debian on UltraSparc.

    The Debian 3.0r0 install went fine (although for those trying it, be sure to select "rescue" when you boot off the CD). I recompiled my kernel using egcs64 and added RAID1 support into the kernel (with RAID0 as a module). I was able to setup my RAID partitions without difficulty, and the RAID0 arrays mount just fine. Unfortunately, when I try to mount the RAID1 arrays I get an oops, and any attempts to access the RAID device after that simply hang (that's a technical term ;)).

    After a few searches on various mailing list archives, I found this post on the Linux-Sparc list [theaimsgroup.com]. I tried this particular patch and was able to mount the RAID1, but after a few minutes copying data to the drive gave me another oops.

    So, one supposition was that the oops was due to a compiler bug, but since egcs64 is so old (from 1998 I think) it's not going to get fixed. So I was looking at GCC 3.1.1 yesterday and got it installed but I was unable to compile a kernel with it (make couldn't find the compiler).

    Is GCC 3.2 usable for Sparc? The GCC site had a report of a successful build of 2.4.18 using GCC 3.1.1 so I expect 3.2 would also work for UltraSparc. However, I tried to get GCC 3.1 working on a Gentoo install I did on my U30 and it died a horrible death. If GCC 3.2 will work, how do I install it as a replacement for GCC 2.95 and egcs64? When I installed the debs for 3.1.1 they didn't seem to replace either GCC or egcs. Can I pass some arguments to make-kpkg to provide the location of the compiler, as well as the -m64 option for UltraSparc?
    • So I was looking at GCC 3.1.1 yesterday and got it installed but I was unable to compile a kernel with it (make couldn't find the compiler).

      Huh? Have gcc with exactly this name in your path (check with type -p gcc . This didn't work?!

  • by Neon Spiral Injector ( 21234 ) on Thursday August 15, 2002 @01:29PM (#4078238)
    Looks like it produces smaller code than 3.1:

    803130 Aug 15 13:18 vmlinuz
    804713 Aug 6 09:08 vmlinuz.old

    At least by a tiny bit. Those are both Linux 2.4.19 kernels with the same .config files.
  • ABI ?? (Score:2, Interesting)

    by jo-do-cus ( 597235 )
    call me stupid, I know about API's, but what exactly is an ABI ?????
    • Re:ABI ?? (Score:5, Informative)

      by Anonymous Coward on Thursday August 15, 2002 @01:52PM (#4078449)
      Application Binary Interface

      ABI's define what is necessary for two pieces of compiled code to interoperate properly. So you have OS ABI's (which define syscall interfaces, argument passing, etc), Programming language ABI's (C++'s ABI generally includes virtual table format, name mangling format, exception handling format, etc), etc.

      Think of it as the API defined for compiled code.
      Compiled code that is compliant with a given ABI will interoperate properly with other code compliant to that ABI.

    • Re: ABI ?? (Score:3, Informative)

      by Antity ( 214405 )

      call me stupid, I know about API's, but what exactly is an ABI ?????

      API: Application-Programmer-Interface.

      ABI: Application-Binary-Interface.

      ABI is the convention used when creating object files (.o). How the assembly calling convention is, how the symbols are named... this sort of stuff.

  • by Neon Spiral Injector ( 21234 ) on Thursday August 15, 2002 @01:51PM (#4078434)
    This always seems to happen with a major release of GCC, it can't compile the latest release of glibc out of the box. This one dies with: ../sysdeps/unix/sysv/linux/errlist.c:41: weak declaration of `_old_sys_nerr' must precede definition

    Too bad it isn't Friday, or else I'd just blow it off for the weekend. I'll probally look into fixing it now. (Don't worry I'll Google first).
  • Precompiled headers (Score:4, Interesting)

    by FooBarWidget ( 556006 ) on Thursday August 15, 2002 @02:02PM (#4078531)
    Does anybody know when GCC wil finally support precompiled headers?
  • by frankie ( 91710 ) on Thursday August 15, 2002 @02:03PM (#4078538) Journal
    This is really bad timing for Apple folks.

    AFAIK, the entirety of Jaguar is compiled with GCC 3.1 [google.com]. Replacing all the libraries with v3.2 is gonna be some mighty huge software updates...
    • AFAIK, the entirety of Jaguar is compiled with GCC 3.1 [google.com]. Replacing all the libraries with v3.2 is gonna be some mighty huge software updates...

      This only affects C++ code. And only libraries and object files.

      Also, it's perfectly possible to have both compilers on the same system. No need to rush for gcc-3.2, anyway.

    • by Pius II. ( 525191 ) <PiusII@nospAM.gmx.de> on Thursday August 15, 2002 @02:49PM (#4078945)
      OS X mostly uses Objective C (like the various Step implementations) which doesn't have the C++ ABI problems: methods are implemented as messages of sorts. This approach means that you can have completely different objects which simply have some method in common, and call them the same way. Also, the Apple branch of gcc has many improvements over the main branch, namely the ability to mix Objective C and C++ (Objective C++). Everyone keeps naggin' the gcc maintainers to include those changes... perhaps now they'll have finally time to do it, so we can use programs like Chimera under GNUstep... I believe there are also many PPC optimizations in the apple version lacking in the main branch. So, it's really not that bad for apple...
    • I'm sure Apple decided to use 3.1 based on the API being stable, so they've gotten the rug pulled from under them!

      The problem isn't only system libraries which are based on C++ but their developer tools which use gcc 3.1. This means when Apple moves to 3.2 they will have to inform everybody that all their libraries will also have to be redistributed with their programs.

      In the meantime I worry that bugs in 3.1 which are fixed in 3.2 will be difficult to merge with 3.1 which only Apple will be using. What a pain |-\

      I'm not sure if drivers are effected because they use a limited C++ subset. If they are Apple will probably maintain 3.1 for a long time, even though they will be the only ones doing it |-\ Anyway, there is no telling if 3.2 is stable either!
    • by captredballs ( 71364 ) on Thursday August 15, 2002 @03:27PM (#4079107) Homepage
      I can't find the link, but there was a good summary of a discussion (kernel cousin?) between users and distribution developers about the upcoming release plans for gcc. Apple had commiting to not upgrading to 3.2, but they would think about backporting bug fixes into their tree. Since they are the main distribution point for gcc for OSX, they'll be able to control it.
  • Switching Compilers (Score:3, Interesting)

    by Catskul ( 323619 ) on Thursday August 15, 2002 @02:08PM (#4078595) Homepage
    From what Im reading in the comments, there can be problems when upgrading compilers across ABI versions. Can someone either summerize the possible difficulties, or point to a place on the web where I can read about them. What I mean is: If I switch from gcc 2.9x to gcc 3.2, what will I not be able to do, and what problems can I expect
    • by Antity ( 214405 ) on Thursday August 15, 2002 @02:21PM (#4078696) Homepage

      If I switch from gcc 2.9x to gcc 3.2, what will I not be able to do, and what problems can I expect

      If you compile programs or libraries with GCC 3.2, they won't be able to link against libraries that were compiled with prior GCC compiler versions. But this only affects C++ code! C code is unaffected.

      And: This isn't really a problem if you compile on your own anyway. You just don't need to "switch compilers". Just do a parallel installation. For example: ../gcc-3.2/configure --program-suffix=32 --prefix=/usr && make bootstrap and it will end up as "gcc32" in your system.

  • Stable C++ ABI??? (Score:5, Interesting)

    by Anonymous Coward on Thursday August 15, 2002 @02:09PM (#4078607)
    Finally a stable C++ ABI ???

    1. This means that C++ _including objects+classes+ will, with a bit of grunt work, be able to be integrated with real-oo scripting languages just as easily as C - it's the constantly changing C++ ABI that has prevented, until now, "easy" bridging of, say, C++'s object model to Common Lisp's CLOS, without having to recompile everything in sight at the drop of a hat - it will now be possible to produce a C++-to-lisp analogue of, say, CMUCL's excellent "alien:" lisp package (nothing to do with the deb2rpm tool), or SWIG-but-for-proper+C++ for python and perl.

    2. It will mean that third-party binary distribution of C++ code is a lot more viable. Remember the way Netscape, Realplayer and flash used to break with every new RedHat release? - well, that was primarily becuase of libstdc++ not linking properly due to changing ABI.

    3. This should also mean that the prelink "hack" and it's ld.so-integrated successor can stabilise and become part of standard linux distros - no mare agonisingly slow KDE startup times!
  • Some time back, I decided to try out GCC 3.0.1 (I think it was). I downloaded the code and ./configure'd it with what the configure script said was the option to add a suffix (with the notion that I'd end up with my 'default' compiler being "gcc" (GCC 2.95.3) but have the option of trying something with "CC=gcc3".

    I did a "make bootstrap" and a "make install"...and ended up with two "gcc's" on the hard drive - no suffixes. It ended up causing a lot of odd problems due to compiled programs trying to link to both versions of the libraries and so on. Of course, there is no "make uninstall"...I finally managed to track down all the files GCC 3.0.1 had installed by hand and delete them, now my system works again...

    I'd actually like to try out gcc 3.1.1, at least - any advice on getting it to coexist as an obvious, separate "option" from the default gcc, and will the same advice actually work for gcc 3.2?

    • I did a "make bootstrap" and a "make install"...and ended up with two "gcc's" on the hard drive - no suffixes.

      Use /path/to/configure --prefix=/usr --program-suffix=SOMETEXT and you will end up with a binary installed as " /usr/bin/gccSOMETEXT ".

      This works.

    • by Plutor ( 2994 ) on Thursday August 15, 2002 @02:30PM (#4078773) Homepage
      I got into a good habit at my first SysAdminning job that prevents this kinda problem. Make a directory in /usr/local/package/. Make a subdirectory dist, and untar the source there. configure --prefix=/usr/local/package/. make and make install, and then when you have all your /usr/local/package/bin/ and lib directories, make sym links.

      "Uninstalling" and "upgrading" becomes as easy as "for F in `ls -l /usr/local/* | grep '-> /usr/local/package/'`; do rm $F; done".

      At the aforementioned job, the directory I installed to was actually /usr/local/package/version/architecture/, but I consider that overkill on my home machine.
    • Use a different prefix! I have 4 different GCC versions on my system (2.96 and 3.0 both provided by RedHat, and 3.1 and 3.2).
      I configure GCC 3.2 like this: ../gcc-3.2/configure --prefix=/usr/local/gcc32 [misc unimportant options here]

      This way, *all* files will be installed in subdirectories inside /usr/local/gcc32. The binaries go to /usr/local/gcc32/bin, the libraries to /usr/local/gcc32/lib, etc. Removing GCC is as easy as rm -Rf /usr/local/gcc32

      To make sure GCC will work:
      - make a symlink /usr/bin/gcc32 to /usr/local/gcc32/bin/gcc
      - add /usr/local/gcc32/lib to /etc/ld.so.conf and run ldconfig

      I just installed GCC 3.2 an hour ago, but I installed GCC 3.1 using the same method (except that the prefix is /usr/local/gcc31) and everything work just fine; no problems whatsoever. I successfully compiled an entire GNOME 2 system using GCC 3.1.

  • Are there any benchmarks anywhere that compares the speed of code generated by GCC 3.2, 3.1, 3.0 and 2.9x?

    That would be interesting to see, especially on modern processors with SSE, SSE2, etc.
    • I don't have any links to comparisons (I know they exist), but I can tell you this: bzip2 is 25% faster when compiled with GCC 3.1.0 compared to bzip2 compiled with GCC 2.95.2, on a Pentium 233 MMX.
      GCC 3.1.1/3.2 optimize even better.
  • by Anonymous Coward on Thursday August 15, 2002 @02:23PM (#4078707)
    For those who want to compile GCC-3.2 yourself:

    - you really should get/compile/install binutils--2.13.90.0.4 first!
    - make sure you specify "--enable-shared --enable-threads=posix --enable-__cxa_atexit" when you do a 'configure' of GCC-3.2. Otherwise it won't be fully ABI compatible!!!
    - then the usual "make bootstrap" etc ...

    Good luck, Max
  • C++ stability (Score:3, Interesting)

    by Compuser ( 14899 ) on Thursday August 15, 2002 @02:23PM (#4078710)
    If C++ ABI is now declared stable does this
    automatically imply that GCC is now fully C++
    standards compatible? If not then what is
    left to change?
    • Re:C++ stability (Score:2, Informative)

      They did everything they could to fix all known C++ ABI bugs. I hope they really did fix all C++ ABI bugs, but there's a very small chance that there are still undiscovered bugs. Nobody knows wether there are still bugs left until somebody discover them (or not).
    • Re:C++ stability (Score:2, Informative)

      by Anonymous Coward
      No, it means that GCC is now fully compatible with the "Common C++ ABI", a multi-vendor standard. This means that you can compile code C/C++ with GNU GCC and e.g. the Intel compiler and link both object files together. The resulting executable will work since both compilers have the same ABI!
    • Apples and oranges (Score:5, Informative)

      by devphil ( 51341 ) on Thursday August 15, 2002 @04:49PM (#4079246) Homepage


      The C++ standard says nothing about ABIs. (Well, there are some layout rules when dealing with POD structs, but nothing about a C++ ABI.)

      We're not meeting the C++ standard in two regards (at least I can't think of any more): first, we don't have export for templates. That will largely be a fallout of the precompiled header projects (two or three PCH branches have been in the repository for a long time now; both Apple and Red Hat have been contributing their implementations).

      Second, we don't do two-stage name lookup for templates. Which most user don't need to worry about. That will come when the current 15-year-old parser has finished being rewritten (and there are branches doing that already as well).

      Also, keep in mind that although the compiler C++ ABI is stable, the C++ library ABI is not. Declaring it stable at this point would be a massively stupid thing to do; there are far too many optimizations to be made still, and those involve changing the ABI. For example, there's a reworking of the memory allocator that currently exists on my whiteboard, and as soon as it gets finished off and checked in, the library ABI will be broken. Vendors already have methods in place for dealing with multiple versions of a library installed; this will be nothing new to them.

  • Hopefully it will compile without any major problems, unlike releases 3.0 and 3.1. I have yet to successfully compile GCC 3.1 on Solaris running on an Ultrasparc. I had few problems with 2.95.3.

    -Aaron

  • Athlon performance? (Score:3, Interesting)

    by evilpaul13 ( 181626 ) on Thursday August 15, 2002 @02:46PM (#4078912)
    Have all the problems that arose in 3.0 regarding performance on AMD Athlon processors been resolved? memcpy() among other things were quite slow when compared to similar processors with GCC 3, and with GCC 2.95.
  • I've been using GCC 3.2_pre on a Gentoo Linux [gentoo.org] PIII laptop for about a month. Everything seems to work just fine.

    That is, gcc 3.2 is the ONLY gcc on this computer. So the ABI interop issue isn't a problem, I suppose.
  • by kcbrown ( 7426 ) <slashdot@sysexperts.com> on Thursday August 15, 2002 @05:20PM (#4079303)
    Suppose I have a system that uses an older compiler and I want to put gcc 3.2 on it. No problem as far as naming the compiler and such goes, that's the easy part.

    But now I have to recompile every single C++ library on the system in order to make the new compiler truly useful.

    Yet, at the same time, I want to be able to run my old C++ binaries and also want to be able to drop back to my older compiler if necessary.

    The best way to accomplish this, I suppose, is to put the new libraries in their own directory and modify gcc 3.2's spec file to include a -L directive to the linker to reference those libraries at link time and a -rpath directive at link time so that the resulting binary references that directory at runtime.

    The other options I thought of involve either renaming the libraries (thus requiring manual intervention when compiling any package that would refer to the libraries by their "old" names) or changing their major version number (surely a serious abuse of the purpose of the major number! And it would cause problems when linking using the old compiler anyway). Neither of those are very palatable.

    Anyone have better ideas on how to do this?

"May your future be limited only by your dreams." -- Christa McAuliffe

Working...