View previous topic :: View next topic |
Author |
Message |
microm
Joined: 07 Feb 2007 Posts: 2
|
Posted: Sun Feb 18, 2007 3:03 pm Post subject: Installing GDC, DSSS and Tango from source on gentoo |
|
|
Nov 9, 2007: I would like to point out that I now use DSSS to install GDC and Tango. I no longer use the lengthy process described in the original version of this post. DSSS is simpler and easier. You can find DSSS here http://dsource.org/projects/dsss. After you untar dsss, set your path and get the list of packages:
Code: |
# set the path in csh
setenv PATH ${PWD}/dsss-0.73-gdc-gnuWlinux-x86/bin:${PATH}
rehash
# set the path in sh
export PATH=${PWD}/dsss-0.73-gdc-gnuWlinux-x86/bin:${PATH}
# Get the list of packages
dsss net list
|
Then pick the gdc version you want. I wanted 4.1 (it worked on my 3.4 system) and install from the net using dsss:
Code: |
dsss net install gdc-gcc-4.1
dsss net install tango
|
If this does not work, see the dsss forum http://www.dsource.org/forums/viewforum.php?f=106.
March 10, 2007: Upgrading from gdc-0.22 to gdc-0.23: The same steps apply, but do not attempt to simply untar gdc-0.22 over gcc if you've already untared gdc-0.22 on gcc: it will not work.
This posting captures the process I used to install GDC, DSSS and tango from scratch on Feb 18 2007.
I expect the flow described in here to change with new releases, and I do not plan to keep this posting up to date for long: I am not the owner of the flow. I provide this only for reference in hope that it can help others.
References:
http://dgcc.sourceforge.net/gdc/install.html
http://gcc.gnu.org/install/configure.html
http://dsource.org/projects/dsss
http://dsource.org/projects/tango/wiki/UnixInstallGdc
1) Base system
My system is gentoo linux, with gcc 4.1.1 (c and c++ enabled). Type gcc -v and look for --enabled-languages=c,c++. If the GCC already installed on your system is the 3.3.x series, you can still build GDC with GCC 4.1.1 (see make bootstrap below).
2) System preparation:
Installing software directly in /usr or /usr/local is sometimes not convenient or not possible. If you do install under /usr, I suggest you run Code: | find /usr >before_gdc_0.22 | to capture the file system state before the install. This way you have a list of files you can remove if something goes wrong and need to start from scratch (or abandon).
In my case, I will be installing in a fresh directory called /tools. I will call this $prefix.
Code: |
prefix=/tools
cd $prefix
|
2) Get all needed software
Let's make a directory where we place the source code:
From a gcc mirror: gcc-4.1.1, gcc-core-4.1.1
From the D main page, navigate until you find: gdc-0.22
Tango (from trunk as the 0.95-beta1 release does not work with GDC 0.22):
Code: |
$ pwd
/tools/SRC
$ svn co http://svn.dsource.org/projects/tango/trunk tango_trunk
|
DSSS: Get release 0.51 from http://dsource.org/projects/dsss
Unzip and untar DSSS. Unzip other tarballs (do not untar them yet).
Check you have all necessary software:
Code: |
$ ls
dsss-0.51-gdc-gnuWlinux.tar gcc-core-4.1.1.tar gdc-0.22-src.tar
dsss-0.51-gdc-gnuWlinux gcc-4.1.1.tar tango_trunk
|
3) Build the GNU D Compiler (GDC):
Unpack GCC:
Code: |
$ tar xf gcc-4.1.1.tar
$ tar xf gcc-core-4.1.1.tar
|
This creates a directory called gcc-4.1.1 with the files untared.
Place gdc where it belongs, and set it up:
Code: |
$ pwd
/tools/SRC
$ cd gcc-4.1.1/gcc
$ tar xf ../../gdc-0.22.tar
$ cd ..
$ ./gcc/d/setup-gcc.sh
|
It should now say Code: | GDC setup complete. |
It is time to build GCC with the D language enabled. According to the GCC installation flow, you should not build GCC from within the source directory. Let's follow what the experts say:
Code: |
$ pwd
/tools/SRC/gcc-4.1.1
$ cd ..
$ mkdir gcc-obj
$ cd gcc-obj
$ ../gcc-4.1.1/configure --prefix=$prefix --enable-languages=c,d
|
I am only getting one weird message at this point, which I choose to ignore:
Code: |
*** This configuration is not supported in the following subdirectories:
target-libada gnattools target-libstdc++-v3 target-libgfortran
target-libffi target-boehm-gc target-zlib target-libjava zlib fastjar
target-libobjc
(Any other directories should still work fine.)
|
Now let's build the GNU D compiler:
Code: |
$ pwd
/tools/SRC/gcc-obj
# If you are building gdc with the SAME gcc version as installed on your
# system, use this command:
$ make && make install
# If you are building gdc with a NEWER gcc version than what's
# installed on your system, use this command:
$ make bootstrap && make install
|
At this point, it will take a long time to build C and D. Go do something else.
I am not building c++ as it is unnecessary to build it along with D. My distro (gentoo) already has GCC with C and C++ on the system. The only thing I made sure is to build GDC with the same version that's already on the system (in this case 4.1.1).
When done, try this:
Code: |
$ ls $prefix
bin include info lib libexec man shared SRC
$ gdc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.1/configure --prefix=/tools --enable-languages=c,d
Thread model: posix
gcc version 4.1.1 20060524 ( (gdc 0.22, using dmd 1.004))
|
If gdc is not found, you need to setup your path. Mine has /tools/bin among other things.
4) Building Tango
I'm building tango, the runtime library which replaces phobos, the one built-in with GDC. Tango has the Fiber component that I can use to develop a cooperative non-threading simulator library and applications.
The tango build instructions refer to three paths, the <tango base>, the <GDC install prefix> and the <gdc prefix>. So before anything, I setup a few variables:
Code: |
$ tango_base=/tools/SRC/tango_trunk
$ gdc_install_prefix=/tools
$ gdc_prefix=/tools
|
At this point, before installing tango, I want to be particularly careful and capture the state of the file system:
Code: |
$ cd $prefix
$ find . >before_tango
|
Ok, now follow the instructions at http://dsource.org/projects/tango/wiki/UnixInstallGdc
replacing <tango base>, <GDC install prefix> and <gdc prefix> with the variables we just defined. I am doing steps 3-5 by hand, I do not use ./install-gdc.sh because my directories are not quite traditional. The <GDC version> should be obvious (in this example it is 4.1.1).
Since GDC is already installed, I stop after performing step 6.
5) The undocumented tango steps
There are many tools you can use to compile your D programs, one of them is called DSSS. It takes care of a lot of things for you, so you should not need to write Makefiles for your D source code. But to use DSSS to compile your D programs, you need to use DSSS to build and install tango.
Remember earlier we downloaded DSSS? We'll use it now:
Code: |
$ cd $tango_base
$ $prefix/SRC/dsss/bin/dsss build
$ $prefix/SRC/dsss/bin/dsss install
|
This should complete without errors.
6) Trying it out
You should now be able to compile a D program that uses the tango library, and run it. Here is an example program you can use:
Code: |
import tango.io.Console;
void main() {
Cout ("hello, sweetheart \u263a").newline;
}
|
Compile it with DSSS:
Code: |
$ $prefix/SRC/dsss/bin/dsss build first_tango.d
$ ./first_tango
|
At this point, you should have a working installation. There are more examples for you to try under Code: | $tango_base/example | . The whole thing works with gdc-0.23 and tango as of March 10, 2007 as well.
Last edited by microm on Fri Nov 09, 2007 10:52 am; edited 2 times in total |
|
Back to top |
|
|
davidswe
Joined: 19 Feb 2007 Posts: 12
|
Posted: Mon Apr 09, 2007 3:07 am Post subject: |
|
|
This may also interest some:
http://bugs.gentoo.org/show_bug.cgi?id=48136
I will see if one of these solutions work on 64-bit Vida Linux when I get home.
BTW, why the hate for /usr/local? In my system it's filled with subdirectories but they are all empty...isn't it the perfect solution? As I've understood this is exactly what the directory was made for
Thanks for the tutorial, it's appreciated! |
|
Back to top |
|
|
microm
Joined: 07 Feb 2007 Posts: 2
|
Posted: Mon Apr 09, 2007 7:51 am Post subject: |
|
|
I have reworded my original post to say "inconvenient or not possible" rather than "I hate installing software under /usr". |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|