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.
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
The lambda branch is compiled exactly like any other GCC source checkout. If there's a configure script, run
to see the options, then run configure again with the proper options, preferably from a different directory, e.g:Code:./configure --help
If you compile an experimental GCC branch, I recommend two things for configure: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
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
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.
It's really annoying.cp: cannot stat mm_malloc.h: No such file or directory
chmod: cannot access include/mm_malloc.h: No such file or directory
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
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
I actually got it working Thanks for the help CornedBee, I appreciate it
My final command list was as such.
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.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'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
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
Warning: Have doubt in anything I post.
GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101
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
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
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.
I'm expanding my network code so we'll see how it'll handle some added complexity.Code:std::function<void()> hello = [&hello]() { hello(); };
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
I didn't realize how restrictive that known bug from the official page would be:
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.Although they can appear within templates, lambda functions may not be used with dependent types.
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