tags:

views:

144

answers:

2

I am trying to build the OSKit source code. It is orginally written against gcc 2.95.2, but on my box I got gcc 4.3.2. And 4.3.2 doesn't allow the following syntax:

 asm volatile("
  pushfl
  popl %0" : "=r" (eflags));
 return eflags;

4.3.2 always complains that:

error: missing terminating " character

There're so many syntax like this, is there a way to let the 4.3.2 accept this? Or is there a more general way to let the 4.3.2 behave like 2.95.2? Or where could I download the 2.95.2 version of gcc?

Thanks!

Update

My real aim is to build the OSKit. OSKit claims to be compilabe with GCC 2.7.x or 2.95.2. My Ubuntu 8.10 is installed with GCC 4.3.2.

I tried the following compiling sequences:

4.3.2 build 2.95.2 --- failed

4.3.2->3.3.6->2.7.2.3 --- success.

4.3.2 -> 2.7.2.3 --- success

3.3.6 -> 2.95.2 --- failed

Though I still don't have 2.95.2, I got 2.7.2.3 at least.

But the OSKit is still broken with 2.7.2.3...

Currently I don't know what to do... :(

Could anyone give me some advice? @_@

A: 

You could download here: http://ftp.gnu.org/gnu/gcc/

The most correct way is to download the old version and install in a directory outside of your PATH.

The GCC has changed much from version 2 to 4 ...

Tiago Natel
Thanks for your answer. I have downloaded the gcc 2.95.2. But it needs to be compiled first. So what gcc version should I use to compile old version gcc? I have tried with gcc 4.3.2. But it just failed.
smwikipedia
Is there a pre-compiled version of old version gcc so I can just install it.
smwikipedia
Your distribution may have a version of gccolder than 4.3 in the repositories, which might be able to compile the positively ancient 2.95.2. You could also try working your way backward from 4.3 to the oldest it can still compile, and then repeat that from there.
Novelocrat
I believe you have to compile the 3.3 version from your gcc-4 and then build to 2.95 from 3.3 ...
Tiago Natel
You can try to compile your code with gcc-3.*, has a good chance of working :)
Tiago Natel
Thanks guys. I am starting my time travelling... I'll let you know when I am back...
smwikipedia
Hi Tiago, your suggestion works. I have just built the gcc 3.3.6. but how could I replace my gcc 4.3.2 with the newly built one?
smwikipedia
Currently, I just change the link of /usr/bin/gcc to my 3.3.6 version. Is that ok enough?
smwikipedia
Now I am trying to making the gcc 2.95.2
smwikipedia
2.95.2 cannot built with 3.3.6. But the oskit claims to be able to be built with gcc 2.7.x besides 2.95.2. So I took a gcc 2.7.2.3 source. I build with the this sequence: 4.3.2->3.3.6->2.7.2.3, it's a success (though I found that 4.3.2 -> 2.7.2.3 is also built-able). But the OSKit is still broken with 2.7.2.3... Currently I don't know what to do... :(
smwikipedia
@smwikipedia: You should be able to build 2.95 with 2.7.
caf
That's a good suggestion. I'll try when I get back home. Thanks caf.
smwikipedia
+1  A: 

I believe that you need something like:

 asm volatile("pushfl\n\t"
              "popl %0"
              : "=r" (eflags)
             );
 return eflags;

Ref: GCC-Inline-Assembly-HOWTO

Clifford
Thanks for your reply. Yes, but the question is there're so much code like these. They can compile with gcc 2.95.2, but not with 4.3.2. How could I install a gcc 2.95.2? I got gcc 4.3.2 on my box and I tried to compile the 2.95.2 source code with it. But failed.
smwikipedia
I cannot believe that the backward compatibility of gcc is so terrible...
smwikipedia
You could write a preprocessor to correct the syntax in bulk.
Clifford
Thanks Clifford. But I'm afraid that approach is much prone to error.
smwikipedia
@smwikipedia: Grepping the final (2002) oskit snapshot only turns up around 200 places where `asm volatile` or `__asm__ volatile` is used. Many of those are not multi-line and would not need to change. You could manually retrofit all of those in a matter of hours, and then move on to all of the other problems that you will undoubtedly encounter in trying to revive a source tree that has been abandoned for 8 years. :)
bk1e
@smwikipedia: And building an ancient compiler from source isn't!? Not only is it not a significant effort (even manually as bk1e points out), but the resulting code base may well benefit from being built with teh more up-to-date compiler.
Clifford