Rewrite source code to compile with GCC? - Minix

This is a discussion on Rewrite source code to compile with GCC? - Minix ; Hello all, I've been trying work on Minix in Linux, and have had an insanely difficult time trying to install the Amsterdam Compiler kit (nearly impossible to do on a Ubuntu distribution!). Would it be worthwhile to rewrite the code ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Rewrite source code to compile with GCC?

  1. Rewrite source code to compile with GCC?

    Hello all,

    I've been trying work on Minix in Linux, and have had an insanely
    difficult time trying to install the Amsterdam Compiler kit (nearly
    impossible to do on a Ubuntu distribution!). Would it be worthwhile to
    rewrite the code to a more...modern C standard (and if so, is anyone
    else interested in helping me)? That way it would be compileable using
    the GCC?

    Alternatively, is there any way to (lazily) change the Makefile files
    to use the GCC and compile using the K&R style?

    Cheers!
    Pablo


  2. Re: Rewrite source code to compile with GCC?

    Well, what has to be done as far as rewriting goes? I would think that
    the large part of the work would simply be recompiling everything with
    GCC. I mean... C is C, right? What we're really talking about is
    different formats of the executables and libraries. ACK makes a.out,
    GCC makes ELF (although you can force it to make a.out, I think). So
    what all has to be done?


  3. Re: Rewrite source code to compile with GCC?

    On Feb 13, 11:37 am, ssil...@stormsilver.net wrote:
    > Well, what has to be done as far as rewriting goes? I would think that
    > the large part of the work would simply be recompiling everything with
    > GCC. I mean... C is C, right? What we're really talking about is
    > different formats of the executables and libraries. ACK makes a.out,
    > GCC makes ELF (although you can force it to make a.out, I think). So
    > what all has to be done?


    Well...
    * The functions currently in Minix are in the K&R style, which the GCC
    doesn't like.
    * The assembly code is...unique, so it would have to be completely
    rewritten; what would be better is to write a linux script to convert
    the Minix assembly to GAS-assembleable assembly.
    * The Makefiles may need to be revised.

    There's probably more that I'm forgetting.


  4. Re: Rewrite source code to compile with GCC?

    > * The functions currently in Minix are in the K&R style, which the GCC
    > doesn't like.


    Goodness no. gcc has no problems with it.

    > * The assembly code is...unique, so it would have to be completely
    > rewritten; what would be better is to write a linux script to convert
    > the Minix assembly to GAS-assembleable assembly.


    True, 'asmconv' does this (available in the minix gcc package) (or
    binutils perhaps).

    =Ben



  5. Re: Rewrite source code to compile with GCC?

    On Feb 13, 11:50 pm, Ben Gras wrote:
    > > * The functions currently in Minix are in the K&R style, which the GCC
    > > doesn't like.

    >
    > Goodness no. gcc has no problems with it.


    Really? All I could get is the CPP to work, anything beyond that
    wouldn't...which would mean the makefiles would have to be rewritten
    instead of the C files.

    > > * The assembly code is...unique, so it would have to be completely
    > > rewritten; what would be better is to write a linux script to convert
    > > the Minix assembly to GAS-assembleable assembly.

    >
    > True, 'asmconv' does this (available in the minix gcc package) (or
    > binutils perhaps).
    >
    > =Ben

    Asmconv, eh? I have the feeling this is only available on Minix, and
    unfortunately I cannot get VMWarePlayer to work properly on my Ubuntu
    system


  6. Re: Rewrite source code to compile with GCC?

    > Asmconv, eh? I have the feeling this is only available on Minix, and
    > unfortunately I cannot get VMWarePlayer to work properly on my Ubuntu
    > system


    Perhaps you should give the free VMware Server a try. I've had VMware
    Server running on several machines including Ubuntu (up to 6.06). I
    don't recall if I never tried to get it running on 6.10.

    On Ubuntu, you're going to need the full kernel source tree, and you
    should be running that kernel when you attempt to install VMware
    Server, because it will need to do a rebuild of some kernel modules it
    produces. Unfortunately, VMware will only try to build kernel modules
    for the currently running kernel, as far as I can tell.

    However, to make things easy, use the proper config file from /boot
    that Ubuntu supplies when you install one of the kernel source trees.
    Then you can just copy that config over and use it to do a full kernel/
    module build and install.

    Good luck!


  7. Re: Rewrite source code to compile with GCC?

    > I mean... C is C, right?

    No, it isn't, unfortunately.

    Quote: "Sometimes a particular compiler generates well-behaved actions that
    are not the same as would be obtained using a different C compiler." (taken
    from http://en.wikipedia.org/wiki/Critici...mming_language)

    This means that one compiler might create code that does what the programme
    once wanted, but a compiler switch (or a version switch, e.g. gcc 2.95 to
    3.0 or 4.0) renders the program unusable. There are even undefined values
    (like "i++ + i++") which are not expected in a programming language. You may
    read this article and other ones of the subject there.

    To make it short: C is dependend on the compiler used to create your
    program, the architecture and your source code itself.

    Regards,
    Sebastian



  8. Re: Rewrite source code to compile with GCC?

    > No, it isn't, unfortunately.

    Well that sucks. So where does this leave us? It sounds like it would
    be a fair bit of work to convert to using GCC. Are there enough
    benefits to make it worthwhile?

    Pablo: I'm running Minix inside of QEMU on Ubuntu 6.10. It seems to
    work very well. (except no kqemu.. don't know why) I've been trying to
    come up with a solution for editing my source code on the host
    (Ubuntu) so that I can use Eclipse, or on another machine (Mac) so
    that I can use Xcode, and then compile inside of the Minix guest so
    that I can use the standard compiler there (which I believe is ACK),
    but no luck on a solution just yet.


  9. Re: Rewrite source code to compile with GCC?

    On Feb 15, 9:46 am, ssil...@stormsilver.net wrote:
    > > No, it isn't, unfortunately.

    >
    > Well that sucks. So where does this leave us? It sounds like it would
    > be a fair bit of work to convert to using GCC. Are there enough
    > benefits to make it worthwhile?
    >
    > Pablo: I'm running Minix inside of QEMU on Ubuntu 6.10. It seems to
    > work very well. (except no kqemu.. don't know why) I've been trying to
    > come up with a solution for editing my source code on the host
    > (Ubuntu) so that I can use Eclipse, or on another machine (Mac) so
    > that I can use Xcode, and then compile inside of the Minix guest so
    > that I can use the standard compiler there (which I believe is ACK),
    > but no luck on a solution just yet.


    Actually I googled "Minix + gcc" and came upon a somewhat new
    operating system called "Brainix" which is inspired by Minix 3; it's
    kind of like a microkernel version of linux. I've decided to play
    around more with Brainix and, since it needs the help (there are,
    what, 5 developpers involved on it? and it cannot even start up a
    shell yet :-\ ) I made the decision to help with their operating
    system. Plus it compiles with GCC!

    I've started using Bochs too, since the head developper helped me set
    it up.

    Personally, I think that there is little to lose by switching to the
    GCC for developping Minix. It would make porting easier, it would
    allow for inline assembly usuage, it would allow compilation on non-
    Minix systems without installing a dated compiler using an antiquetied
    script. But that's my horrible bias, seeing as I'm a zealot for the
    GNU project and microkernels.


  10. Re: Rewrite source code to compile with GCC?

    In article <1171673360.951558.312050@h3g2000cwc.googlegroups.c om>,
    Pablo Rodriguez wrote:
    >Personally, I think that there is little to lose by switching to the
    >GCC for developping Minix. It would make porting easier, it would
    >allow for inline assembly usuage, it would allow compilation on non-
    >Minix systems without installing a dated compiler using an antiquetied
    >script. But that's my horrible bias, seeing as I'm a zealot for the
    >GNU project and microkernels.


    Please tell me, you do cross-compile FreeBSD (or NetBSD or OpenBSD) on
    Linux?, Do you cross-compile Linux on any of the BSDs?

    Getting Minix to compile using gcc is trivial.

    Making sure that all the Minix Makefiles are suitable for cross-compiling
    will be an endless nightmare.

    (And the Minix3 maintainers do not like inline assembler, you probably won't
    get that in the official distribution anyhow :-)


    --
    That was it. Done. The faulty Monk was turned out into the desert where it
    could believe what it liked, including the idea that it had been hard done
    by. It was allowed to keep its horse, since horses were so cheap to make.
    -- Douglas Adams in Dirk Gently's Holistic Detective Agency

  11. Re: Rewrite source code to compile with GCC?

    Philip Homburg wrote:
    > Please tell me, you do cross-compile FreeBSD (or NetBSD or OpenBSD) on
    > Linux?, Do you cross-compile Linux on any of the BSDs?


    Cross-compiling NetBSD on Linux is trivial, but developers have gone
    through a lot of effort to make it so.

    Ben

+ Reply to Thread