
|
[haiku-development]
||
[Date Prev]
[08-2007 Date Index]
[Date Next]
||
[Thread Prev]
[08-2007 Thread Index]
[Thread Next]
[haiku-development] GCC2 and GCC4 on same System
- From: "Michael Lotz" <mmlr@xxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Sun, 26 Aug 2007 13:18:01 +0200
Hi everyone
The recent discussion about providing a "hybrid" system where GCC2 and
GCC4 compiled apps life side by side has made me think a bit. I looked
at the "problem", but really didn't see it. I have thought about the
app to kernel connection -> syscalls with a defined interface. I have
thought about the app to app_server connection -> communication via
ports with a defined protocol. I have thought about inter app
communication -> messaging through ports and in defined BMessage
format. Also the interface for sharing memory using areas is defined
and should not depend on the compiler version. I thought about the
runtime_loader, but we use the same code for both, the GCC2 and the
GCC4 compiled Haiku. So it actually has to understand both versions. So
after all I came to the conclusion that there is no problem:
http://haiku.mlotz.ch/gcc2and4.png
This is a shot made from a QEMU instance running my nativly installed
gcc 2.95.3 compiled Haiku. Additionally I have a Linux box where I
compiled with the gcc 4.1.2 from the buildtools (btw. building gcc 4
for BeOS and building a working image is possible with very few
patches, but that's a different story). I have created a directory "/
boot/gcc4" and put in the binaries from the GCC4 image in there. I have
also added a "lib" dir there and moved all the GCC4 system libraries to
that directory. Then I ran the AboutSystem application from this
directory - it worked just the logo was not shown. So I've put in the
GCC4 compiled translators to "/boot/home/config/add-ons/Translators".
The runtime_loader now tries to load each of the translators in both
the system and the config directory. Depending on which application you
run (GCC2 or GCC4), one of both will generate errors, but it will still
load everything that is necessary. So the logo problem was solved too
and I could for example use both GCC2 and GCC4 compiled ShowImage to
load some pictures.
In the screenshot you can see various things to ensure that I didn't
mess up the whole thing and accidently used the same compiler for both
versions. First there are two AboutSystem apps open. One shows r22028
as it is the one compiled on Linux some time ago and the other shows
r22046. So these two are definitely different applications. Then,
knowing that gcc has the habit of embedding version information into
application it compiles, I used DiskProbe to check each binary. You can
see the lower DiskProbe showing the GCC 4.1.2 version and the upper one
the (not completely up to date) GCC 2.95.3 of the actually installed
image. Then there is BeBounce running with a binary compiled for R5
some years ago directly from unmodified sample code. In the background
there is also a Terminal showing the "ps" output to proove that two
versions of AboutSystem are running ("/boot/gcc4/AboutSystem" and "/
boot/beos/apps/AboutSystem" below). The only thing that is not true
about the screenshot is the update of 2 hours, but I guess this comes
from the QEMU emulation.
Conclusion: there is no problem with using GCC2 and GCC4 compiled
applications on the same system at the same time. You simply have to
provide the libraries and add-ons for both versions. I have
successfully tested all the GUI apps, the only thing that obviously
does not work is using ProcessController, NetworkStatus and PowerStatus
in replicant mode in the Deskbar, as the GCC2 compiled Deskbar cannot
load the GCC4 binaries.
Just as a heads up on that topic
Michael
|

|