Thread: Compile GCC Branch

  1. #1
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034

    Compile GCC Branch

    How would I compile the GCC lambda branch? All I've got is the svn checkout. There's makefile's and such but I can't get any of them to run. I don't know anything about linux, or much about command-line compiling.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The lambda branch is compiled exactly like any other GCC source checkout. If there's a configure script, run
    Code:
    ./configure --help
    to see the options, then run configure again with the proper options, preferably from a different directory, e.g:
    Code:
    svn co <gcc-url> gcc-lambda-src
    mkdir gcc-lambda-obj
    cd gcc-lambda-obj
    ../gcc-lambda-src/configure <options>
    make
    sudo make install
    If you compile an experimental GCC branch, I recommend two things for configure:
    1) Disable GCJ and its libjava. It's huge and takes forever to compile.
    2) Give the GCC binaries a prefix or suffix. This allows you to put them into the PATH without conflicts with your system GCC.

    If there's no configure script, you need to run autoconf in the source directory, but I think GCC policy commits the generated files.

    To get all build dependencies for GCC, if you have Debian/Ubuntu, you can run something like
    Code:
    sudo apt-get builddep gcc
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Thanks for that CornedBee. sudo apt-get build-dep gcc was helpful. I was going through manually finding the dependencies.

    I keep running into this error though, after about 20 minutes of re-compiling.

    cp: cannot stat mm_malloc.h: No such file or directory
    chmod: cannot access include/mm_malloc.h: No such file or directory
    It's really annoying.

    That's using default configure: ../srcdir/configure. I also tried it with --disable-libgcj as you suggested.

    I can't find much help about mm_malloc on Google.
    Last edited by Dae; 08-31-2009 at 09:09 PM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    mm_malloc is a malloc with an additional alignment parameter, used for allocating buffers that will be used with vectorized code. It's part of the compiler suport library, which is why the build script wants to copy it around.
    The file is apparently called gmm_intrin.h in the source tree (in $SRCDIR/gcc/config/i386) and the build system should rename it and copy it to the target. I have no idea why this fails. The build system is just as big a disaster as the rest of GCC.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    I actually got it working Thanks for the help CornedBee, I appreciate it

    My final command list was as such.

    cd /home/daemn/
    sudo apt-get build-dep gcc
    svn co svn://gcc.gnu.org/svn/gcc/branches/cxx0x-lambdas-branch/ /home/daemn/srcdir/
    mk objdir
    cd objdir
    ../srcdir/configure --program-prefix=lambda --disable-libgcj --enable-languages=c++ --disable-werror
    make
    sudo make install
    I had to do a make distclean and it took a few hours, but phew.. I love lambda's. I also love properties - hope those make it into c++. Anything that helps with ease and usability (such as auto). The implementation of C++0x sure is slow going though.. but lots of good stuff in there. I'm a lot more stoked than before, having read a lot more of the docs and proposals waiting for this to build.

    I'll probably run into some roadblock. Just wait.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    How far along is the lambda branch, by the way? Is it actually usable?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by CornedBee View Post
    How far along is the lambda branch, by the way? Is it actually usable?
    I'll let you know once I finish converting my project over to Linux. See if it survives Asio server/client and some other stuff.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  8. #8
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Phew, that was intense. I ran into a whole series of issues. First of all, there seems to be a bug in GCC 4.4 and 4.5 (which the lambda-branch uses) in rvalue references (&&). So I disabled rvalue ref macro in Boost, and undefined the c++0x macro in the STD library (which brought forth an #error definition, which I casually deleted This obviously means I cannot use the new stuff like std::thread and std::chrono. That's fine, because I tried them and they didn't seem complete (ie. this_thread::sleep which is now sleep_for apparently and is macro blocked, and not using std::seconds using std::chrono, etc). Then I ran into issues with libmysqld 5.1, switching to 5.4 didn't fix it, 4.1 worked but sucked, and after some tweaking 5.4 magically works.

    Rvalue bug: http://www.mail-archive.com/gcc-bugs...msg264019.html

    The end result? I've deleted my PoS "callback" macro (which only worked with vc9), and have 5000 lines of lambda, roughly 40 lambda definitions, working with thousands of sockets per second (multiple asynchronous servers) and not a problem in sight yet. Works great!

    This is pretty much exactly what I wanted (for now), your standard c/c++ (pre-0x), boost, and auto / lambda. I'll expand my use of lambdas / variadic templates / initializers etc. later, and the rest when we get them. I'll be back if I run into any problems ^^ you can bet on it.
    Last edited by Dae; 09-04-2009 at 09:00 AM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  9. #9
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Fun! Maybe I should implement lambdas for Clang now.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  10. #10
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Haha, it shouldn't be too hard if you allow local structs as template arguments, then just change the syntax (which is surprising since I don't believe GCC allows local structs as template arguments yet).

    Edit: actually recursion is working, it just has to be passed by reference not value.. obviously. my bad.
    Code:
    std::function<void()> hello = [&hello]() { hello(); };
    I'm expanding my network code so we'll see how it'll handle some added complexity.
    Last edited by Dae; 09-05-2009 at 07:53 PM.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  11. #11
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    I didn't realize how restrictive that known bug from the official page would be:

    Although they can appear within templates, lambda functions may not be used with dependent types.
    So at the most I'll only be using them for usage code. I guess that's good, but I can wish library code was easier to read/understand/navigate for everyone (especially colleagues). Oh well.

    Rvalue references seem to be working for me, just not for parts of the STD/boost library (maybe an incompatibility issue - boost 1.4 only shows testing up to gcc 3.3 and some 3.4).
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc compiler for windows?
    By td4nos in forum C Programming
    Replies: 8
    Last Post: 07-19-2009, 02:28 PM
  2. gcc asm code syntax
    By Uberapa in forum C Programming
    Replies: 4
    Last Post: 06-15-2007, 01:16 AM
  3. gcc not for C++?
    By tin in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2004, 08:26 AM
  4. GCC bool undefined
    By Stack Overflow in forum Linux Programming
    Replies: 3
    Last Post: 07-06-2004, 12:54 PM
  5. Replies: 4
    Last Post: 11-14-2001, 10:28 AM