OpenBSD Journal

BSD-licensed C compiler

Contributed by jose on from the non-gcc dept.

alison writes:
"I just noticed a link to this site from a Slashdot thread about lint. It's a BSD-licensed C compiler developed initially by a British defense agency and now released to the public. This looks really, really cool. I know Theo and the team have always had a bit of a chip on their shoulder about having to compile with the GPLed gcc, and this could be just the ticket to getting the whole base install under a BSD license. Has anyone tried to get this to run under OpenBSD? Apparently it compiles under FreeBSD/x86... That's a start!"
I've tried Tendra (the compiler) a bit in the past, and evidently a few other OpenBSD hackers have, as well. I don't think its anywhere near supported, but it may be worth checking out if you're into porting applications and development systems. An alternative to GCC, which could be readily modified as OpenBSD hackers tend to do, would be nice to have. Granted, something like ProPolice would have to be integrated to prevent feature loss, but that could be done with some effort. Anyone poke Tendra at all on OpenBSD?

(Comments are closed)


Comments
  1. By grey () on

    "February 16, 2003: TenDRA now has configuration targets for Cygwin, Darwin, FreeBSD, HP-UX, Linux (not quite foolproof for all distributions yet), NetBSD, ---OpenBSD--- [emphasis added], and OSF1/Tru64."

    I did download and do a make on this; make install didn't quite seem to go as planned, so I was having a little bit of troubles with testing out a simple helloworld.c it looks promising though, and they definitely seem to have the right head on their shoulders in many respects.

    It is noteworthy to see is that development efforts on Tendra have been steadily increasing since I first noticed its existence last fall.

    I can't speak for any OpenBSD developers personally, but I think that it is on the radar of a few people at the least (though, right now more in the way that projects like opencm are - they look promising, but have yet to deliver the necessary functionality to wholely migrate).

    Fingers crossed? (it sure would be nice to escape some of the irrationalities of GNU, outside of even license differences).

    Comments
    1. By alison () on

      Hi, i was the one who posted the story... I actually posted it a month or two back, when Tendra was pretty much only compiling on FreeBSD. I'm glad they've come a bit further.

      Something i didn't really touch on in what i submitted, but i think is particularly important, is that this is a C compiler that has been used and developed by the military, and uses a compilation sequence that seems to be (in theory) safer, stricter and more standards-compliant than gcc. This seems like a good overlap with the main focal points of the OpenBSD project.


      On a complete side-note, GNU's idea of "standards-compliance" can be more frustrating than useful, particularly in the case of their anally-retentive attitude to #pragmas. Want to turn a warning on or off real quick to test something? Too bad - you can't add one line of code. You have to write a block of code logic, use mysterious __GNU__ #defines that are hidden somewhere in the middle of a godawful POS "info" file, change all the makefiles, blah blah... But that's a whole nother discussion.

  2. By Anonymous Coward () on

    Just read the subject header and the first thoughts that came to mind; "omfg, the possibility of a efficient C compiler? it can't be true." of course, the subject header says nothing about efficiency. :|

  3. By Anonymous Coward () on

    Just read the subject header and the first thoughts that came to mind; "omfg, the possibility of a efficient C compiler? it can't be true." of course, the subject header says nothing about efficiency. :|

    Comments
    1. By Jeroen Ruigrok () asmodai@tendra.org on http://www.tendra.org/

      I did some tests last year with tcc 4.1.2 , gcc 2.95.3, and gcc 3.2.x.

      This is what I found (make-world.log is a full make world of FreeBSD logged):

      tcc 4.1.2:

      247179 cat
      text data bss dec hex filename
      56676 4492 9952 71120 115d0 cat

      ./cat /usr/src/make-world.log 0.00s user 0.04s system 7% cpu 0.538 total
      ./cat /usr/src/make-world.log 0.00s user 0.02s system 4% cpu 0.503 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 6% cpu 0.510 total
      ./cat /usr/src/make-world.log 0.00s user 0.02s system 4% cpu 0.498 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 6% cpu 0.506 total

      gcc 2.95.3:

      252433 cat
      text data bss dec hex filename
      55692 4396 9920 70008 11178 cat

      ./cat /usr/src/make-world.log 0.01s user 0.02s system 2% cpu 1.077 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 2% cpu 1.087 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 2% cpu 1.095 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 2% cpu 1.082 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 2% cpu 1.085 total

      gcc 3.2.x:

      298838 cat
      text data bss dec hex filename
      60492 5692 9952 76136 12968 cat

      ./cat /usr/src/make-world.log 0.00s user 0.02s system 4% cpu 0.505 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 6% cpu 0.483 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 6% cpu 0.483 total
      ./cat /usr/src/make-world.log 0.00s user 0.02s system 4% cpu 0.498 total
      ./cat /usr/src/make-world.log 0.00s user 0.03s system 6% cpu 0.500 total

      So you see that both gcc 3.2.x and tcc 4.1.2 are quite a bit faster in execution than 2.95.x.
      Of course, please apply some salt to this, since it was hardly tested under scientific supervision or whatnot.

      I need to run these tests again, since I think gcc 3.2.x improved pretty well in some aspects. I'll add compilation times in the next tests.

      Comments
      1. By djm () on

        cat is a pretty bad choice for a benchmark. If you are looking for something quick, nasty and remotely useful then I would have to suggest: grep

        Comments
        1. By Jeroen Ruigrok () asmodai@tendra.org on http://www.tendra.org/

          Yes,
          you are quite right. This was just something I did a long while ago to get a feel for the comparison. But yes, you are definately right. I'll try to pick some more applications/tools which I find are quite interesting to benchmark.

          I'll make sure to paste them on the tendra.org site, so please keep an eye on that.

  4. By Anonymous Coward () on

    The license isn't the biggest issue. I don't think anyone minds a GPL licensed compiler that works for the project. The issue with GCC is that it is too slow with the 3.0, 3.1, 3.2 releases. Support for the old platforms is getting worse with each release.

    GCC - slow, and getting slower, primary target
    is linux/i386 although it has a healthy range
    of support for virtually every processor

    Tendra - only supports 80386, m68k, alpha, mips,
    early PPC, and sparc platforms. Sparc64, macppc, hppa, vax, and m88k processor targets are not supported at all!

    Comments
    1. By Anonymous Coward () on

      "The license isn't the biggest issue."

      it might not, but it does hold a substantial magnitude.

      Comments
      1. By Anonymous Coward () on

        No, the GPL is not a problem of a "substantial magnitude" for GCC in the OpenBSD project. What the fuck is that supposed to mean? The GPL isn't a problem at all with GCC. See how OpenBSD incorporates this compiler without complaining? Don't waste your time making comments you know nothing about. The problem is the speed of GCC and the lack of support in TenDRA. If GCC did not have this problem, there would be no reason to consider a less-featured BSD licensed compiler.

        Comments
        1. By Anonymous Coward () on

          "No, the GPL is not a problem of a "substantial magnitude" for GCC in the OpenBSD project."

          which is why http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/ continues to get smaller?

          "What the fuck is that supposed to mean?"

          that it is a problem? not too difficult to figure out methinks. however, with your troglodyte response, it might be difficult to see the obvious.

          "The GPL isn't a problem at all with GCC."

          see my first statement.

          "See how OpenBSD incorporates this compiler without complaining?"

          search for gnu at http://www.openbsd.org/policy.html
          I fail to see GNU held in high regard.

          In addition, the misc@ archives beg to differ with you regarding the gpl: http://marc.theaimsgroup.com/?l=openbsd-misc&w=2&r=1&s=gpl&q=b

          "Don't waste your time making comments you know nothing about."

          some how you think you can dictate how I spend my time? that's new. so much for your parents creating an *individual* out of you, and teaching you to think for yourself. you must be a product of american society.

          " The problem is the speed of GCC and the lack of support in TenDRA."

          who is denying that? relevance is a nice facet. consider it.

          " If GCC did not have this problem, there would be no reason to consider a less-featured BSD licensed compiler."

          see my fourth statement.

          Comments
          1. By Gimlet () on

            "some how you think you can dictate how I spend my time? that's new. so much for your parents creating an *individual* out of you, and teaching you to think for yourself. you must be a product of american society."

            Going a little out of our way to be insulting, aren't we? I'm sure whatever society you're from must be oh so proud. So much for your teachers and parents teaching you any manners.

            On the subject of teachers, looks like yours failed to introduce you to the amazing concept of capitalizing the first word of every sentence. Take a peek at http://www.shared-visions.com/explore/english/capital.html

            Comments
            1. By Anonymous Coward () on

              "So much for your teachers and parents teaching you any manners."

              pointing out you have tried to infringe on how I spend my time is the result of having no manners? so be it. you certainly must be used to having marketing tell you what to buy. as a result, telling you where to spend your money. oh, well.

              it is a shame you did not address the significant points of my argument. so much for proving me wrong, or accepting the truth of being incorrect.

              "On the subject of teachers, looks like yours failed to introduce you to the amazing concept of capitalizing the first word of every sentence."

              capitalization is not foreign to me. I simply choose not to use it everywhere. to begin every sentence with a capital letter when you have a . (question mark, exclamation, so on)to indicate the end of a sentence, only to be told something is going to begin by capitalizing *EVERY* letter of every new sentence, is a waste; a waste of redundancy. why should I tell you I am going to start a sentence TWICE? go pay double on future purchases and see how quickly you tire of spending so much money by paying twice.

              however, the key(heh, possible pun in there) reason I do not capitalize everything is to keep from using *shift* so often when I type. that is too many *shifts*. most "who, what, where, and whens" do get capitalized to produce the required attention from the reader. contractions are the devil too. :)

          2. By Anonymous Coward () on

            Why does the GNU cvs section get smaller ? Because BSD lovers enjoy getting rid of GPL'ed software, naturally.

            "that it is a problem? not too difficult to figure out methinks. however, with your troglodyte response, it might be difficult to see the obvious."

            Whatever. "substantial magnitude" does not make sense in the English language. Maybe in yours, it does. I understand "substantial" and "magnitude" but together they mean nothing. You are a poor writer. Obviously, you are trying to say that GPL'ed software is an issue. But, with the compiler, having a nice BSD licensed compiler is nothing but a novelty. It isn't necessary for any reason. And there are plenty of reasons not to do it now.

            "`The GPL isn't a problem at all with GCC.'
            see my first statement"

            What, your first meaningless jumble of bullshit ?

            "search for gnu at http://www.openbsd.org/policy.html
            I fail to see GNU held in high regard."

            That doesn't make the TenDRA compiler suitable to replace GCC. Whatever you see about GNU doesn't help anything.

            "In addition, the misc@ archives beg to differ with you regarding the gpl: http://marc.theaimsgroup.com/?l=openbsd-misc&w=2&r=1&s=gpl&q=b"

            You are a fucking idiot if you think this supports your dumbass arguments. You just posted a thread where people are trying to find the GPL'd version of a Java SSH client as opposed to the newer non-commercial-use-only license.

            "`Don't waste your time making comments you know nothing about.'
            some how you think you can dictate how I spend my time? that's new. so much for your parents creating an *individual* out of you, and teaching you to think for yourself. you must be a product of american society."

            Sorry, just trying to offer some advice. You are obviously too stupid to understand reality. Sounds like you are the person who is worried about their individualism, as well. I'm pretty damn comfortable with myself and my nature.

            " `The problem is the speed of GCC and the lack of support in TenDRA.'
            who is denying that? relevance is a nice facet. consider it."

            This is entirely relevant. In case you are a complete idiot, i'll explain it again. The main problem with switching OpenBSD to GCC 3.x has nothing to do with the license. It is the speed of the 3.x series that is the problem. Theo has explained this very clearly on the mailing lists.

            "`If GCC did not have this problem, there would be no reason to consider a less-featured BSD licensed compiler.'
            see my fourth statement."

            Since all of your statements are rife with ignorance of what's actually going on with the OpenBSD PROJECT in REALITY, I'm going to consider any reference to your previous statements to be an admission of your complete ignorance of this subject matter and completely inability to argue this thread.

        2. By Anonymous Coward () on

          Is speed really an issue? What could the GCC guys have done to make stuff run more slowly? I'm skeptical because of the very nature of the project. Can you really compare old gcc compiles to new gcc compiles and show that it takes longer these days? Serious question, I don't know.

          Comments
          1. By Jon Martin () jmartin@ugrad.cs.ualberta.ca on mailto:jmartin@ugrad.cs.ualberta.ca

            Yes, compile speed is an issue. The GCC guys are trying to match commercial compilers in terms of the speed of the generated code. Optimizing code takes time, the more optimization you do the slower the compile. This is all fine and good for a final compile, but when you are a developer and compiling often the time lost to useless optimization adds up. What is needed is a compiler that compiles fast and generates _correct_ unoptimized code.
            --
            Serve Gonk.

            Comments
            1. By Anonymous Coward () on

              Well, it seems like that should be no problem. I mean, simply not doing extra stuff should be fairly easy for the gcc guys to implement. I hope. I say this with no experience in designing or writing compilers.

              Comments
              1. By Anonymous Coward () on

                You already can turn off optimization in gcc: -O0. But it's still very slow. I'm not sure if this is so much the fault of the compiler per se as the entire tool chain. Particularly "ar" seems to be extremely slow, and "ld" too.

              2. By Anonymous Coward () on

                >not doing extra stuff should be fairly easy for the gcc guys to implement

                This is the same GNU project that has fifteen million options for /bin/ls. Hell, they even have options for `Hello, world!' and /bin/true.

              3. By Anonymous Coward () on

                >not doing extra stuff should be fairly easy for the gcc guys to implement

                This is the same GNU project that has fifteen million options for /bin/ls. Even /bin/true and `Hello, world!' have options. I don't think they know the meaning of `feature creep'--it just comes naturally to them.

        3. By Anonymous Coward () on

          > The GPL isn't a problem at all with GCC.

          Yes, it is. It's a philosophical problem for people who, like me, revile the GPL. While you may not want to mingle your politics and your software, I can't help it.

          If you think that the real attraction of TenDRA is from problems with GCC, you could always prove your case by making GCC unquestionably better than TenDRA.

    2. By Anonymous Coward () on

      I don't think the platform issue is a big deal. We already have some different userland apps depending on what platform you're running, as well as the whole ELF/COFF thing. It really wouldn't be a big deal to use gcc for certain platforms until tendra covers those extra platforms. And if you look at the compilation procedure of tendra it may in fact be easier to port to other platforms than gcc was.

      Comments
      1. By Anonymous Coward () on

        > And if you look at the compilation procedure of tendra it may in fact be easier to port to other platforms than gcc was.

        Definitely easier.

        As a side note about different platforms: some, if not all of the powerpc/aix bits and pieces will have to be removed, since they have a different license from the rest of the sources (stupid "no fee" clause...).

        Comments
        1. By Jeroen Ruigrok () asmodai@tendra.org on http://www.tendra.org/

          I still have so much to document though and only so many hours in a day. But then again, progress is coming along nicely.

          Yeah, we need to check and verify every single file just to make sure we haven't missed a header, which could possibly screw us over. Thanks for reminding me. (Good example of just why I am setting up the bugtracker to keep track of stuff like this.)

      2. By Roo () on

        TenDRA was designed to implement ANDF - Architecturally Neutral Distribution Format. I got to see some of that work back in the early 90s. :)

        For the record the RSRE/DRA/DERA have done a hell of a lot of not very well publicised cool stuff. :)

        -Roo

    3. By Jeroen Ruigrok () asmodai@tendra.org on http://www.tendra.org/

      Allow me to comment a bit, since I think I have some right to it. ;)

      The license was an issue for me, I personally don't like the whole idea of signing over copyright (copyleft?) to the FSF before contributing. This stiffles open source development in my idea. Furthermore, I'll blandly admit the GPL and FSF ideas are not ideas which I would choose myself for projects, however, I do contribute to projects with the GPL and such.

      Yes, I also think that GCC is going into a direction, which I think is not the best direction. That said, I am not sure in how much TenDRA will be the best compiler for people. The ideas which lie at the basis of TenDRA are fundamentally different than what, for example, GCC has.

      Right now the TenDRA Project managed, thanks to a lot of kind people, to acquire compilation space and resources on a wide variety of operating systems and architectures, thus allowing us to test changes quickly. Especially the OpenBSD crowd was very forthcoming with this.

      TenDRA _does_ support the HPPA architecture, currently only on HP-UX, but this should be easily ported to OpenBSD.

      The basic focus of TenDRA lies in a lot of standards compliance and verification. Right now one of our lead developers, Amos Haven, is working on ACL2 proving of TDF (read: (X)ANDF).

      Optimisations are very nice, but I'd rather be a bit more conservative in that area and make sure the resulting code is stable.

      Hope this clarifies a bit, at least, my stance in the TenDRA Project.

      Comments
      1. By Anonymous Coward () on

        Awesome to hear a response from a contributing member. I think there is a -lot- of interest from the OpenBSD community, so hopefully the two projects will one day get to the point where they will intermingle more.

        I'm sure the other BSD's would also be keeping an eye out, as most BSD users I've met -do- actually care about the license the code is under, and to that end, most find GPL to leave a really bad taste in ones mouth.

        I -really- really hope that these two projects can cooperate at some point, even if not any time soon (especially after all the Propolice work, it would be a bit of a challenge to reimplement that again no doubt).

        Comments
        1. By Jeroen Ruigrok () asmodai@tendra.org on http://www.tendra.org/

          Actually, the reason why we already have code working/installing (without the wrapping stuff) on OpenBSD is because people from the community gave us logins/shells to test/compile on, as well as people who contributed patches and code.

          So already there's a synergy at work. :)

    4. By netchan () deadly@netchan.cotse.net on mailto:deadly@netchan.cotse.net

      Removing Obsolete Target Systems In GCC 3.4

      http://kerneltrap.org/node.php?id=605

  5. By Anonymous Coward () on

    Screw how well it works, license zealotry is where it's at!

    Comments
    1. By Anonymous Coward () on

      First of all, i think the license IS an important issue. Part of the OpenBSD charter is to have the complete system available for whatever purpose - including close-sourcing it and making your own version. Yes, you can compile closed-source software with gcc, but can you enhance the compiler for your proprietary platform and then distribute it without source to your clients? No. GNU vs BSD isn't just an academic dispute, it's a practical difference.

      Secondly, part of making software "secure" using Theo's sense of the word is by not becoming too reliant on the non-standard behavior of a certain program, particularly when you have no jurisdiction over which patches do and don't go into the main tree of that program. Ideally the OpenBSD code should compile with more than just the GNU compiler and toolchain, because that way it doesn't rely on bizarre GNU behavior to get things done, and it means if gcc breaks something you can immediately "failover" to the new compiler until gcc is fixed.

      Comments
      1. By Anonymous Coward () on

        You're not fooling anyone, chief.

        Comments
        1. By Anonymous Coward () on

          Nor are you. Fool.

  6. By Andrey () on

    > Has anyone tried to get this to run under OpenBSD? Apparently it compiles under FreeBSD/x86...

    It now compiles under OpenBSD-i386 too. The install taret is not complete yet and the shell wrapper script does not exist, but preliminary version with instructions was posted by Amos Heaven on tendra-dev list a week or two ago:

    http://lists.tendra.org/tendra-dev/20030223/msg00003.html

    Comments
    1. By Troll () on

      Why "shell wrapper" ??? Is TenDRA intened to be standards incompliant???

      Comments
      1. By Jeroen Ruigrok () asmodai@tendra.org on http://www.tendra.org/

        Well,

        the wrapper is basically a small shellscript which calls the executable with the right environment settings for the compiler and such. That's how the old versions of TenDRA did it and right now we've basically only fixed some bugs and made the whole build system easier to work with. We're taking this into small chunks ahead. Remember, we have over four years of dormancy to catch up with.

        TenDRA is by nature a checker of API's, so yes, standards compliance is its forte. And no, it is not intended to be incompliant. I'd welcome any notification of incompliancy on the TenDRA mailinglists.

  7. By Anonymous Coward () on

    I have applications that crash due to bugs in gcc and g++ if I use any other version than the "gcc-3_3-branch". Given how old this compiler collection is, it would be a cold day in hell before I tried any newer compiler that was "open source" and expected it to work at least as well.

    Sooner or later someone needs to pull their finger out and upgrade gcc from 2.95 to something that understands C99 and will compile modern C/C++ code into a working application.

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]