Table of Contents
Installing Tango with GDC on Unix operating systems
Tango for GDC on Unix operating systems can be installed in different manners. The first approach described is fully manual, for the other solutions, there are downloadable installers. Be aware that not all arches have ready made installers or binary downloads.
At the end, there are some instructions for those who want to compile and install GDC manually.
Manual Installation
1. Check out Tango from SVN.
To get the latest version of Tango do the following
svn co http://svn.dsource.org/projects/tango/trunk tango cd tango/lib
If you want to stick with a released version (for example 0.99.7) replace "trunk" with "tags/releases/0.99.7" in the previous command. "svn update" will perform an update.
2. Build Tango libraries
These scripts will build libgphobos.a and libgtango.a.
chmod a+x *.sh ./build-gdc.sh ./build-tango.sh gdc
For Mac OS X: Alternatively, if using Apple GCC you can build a Universal Binary with:
chmod a+x *.sh ./build-gdc-mac.sh ./build-tango.sh mac
3. Install Tango files
export GDC_TEMP="`gdc -print-file-name=libgcc.a`" export GDC_LIB_DIR="`dirname $GDC_TEMP`" cd .. sudo cp -f ./lib/libgphobos.a ./lib/libgtango.a $GDC_LIB_DIR/ sudo cp -Rf object.di std/ tango/ <GDC install prefix>/include/d/<GDC version>
<GDC install prefix> is most likely /usr, however it could be /usr/local, or any other path you (or your distro) chose at compile time.
On AMD64, use lib64/ instead of lib/ if available.
These actions will overwrite files from Phobos. If you want to keep them, rename them.
Alternative: Use the install script:
./install-gdc.sh --help
4. Test your installation
Here is a Hello World example with Tango in D:
module main; import tango.io.Stdout; void main() { Stdout("Hello World.").newline; }
Store it in a file called main.d and compile it:
gdc main.d -o main -fversion=Posix -fversion=Tango -lgtango ./main
Hello World.
Congratulations!
In case that gdc doesn't find the Tango libraries (libgphobos.a, libgtango.a) or Tango source files (object.di, std/, tango/), add the path explicitly:
gdc main.d -o main -fversion=Posix -fversion=Tango -lgtango -I<GDC install prefix>/include/d/<GDC version> -L$GDC_LIB_DIR
Alternative: Use DSSS
If you use DSSS (includes rebuild) you should change the default profile to use Tango:
cd /etc/rebuild echo "profile=gdc-posix-tango" > default
But you can also use "dsss -dc=gdc-posix-tango .." instead.
If you want to use DSSS to build&install Tango then you can do
cd tango dsss build dsss install
If you want to test it
dsss build -debug=UnitTest -w -g --test
Troubleshooting
If you encounter incorrect permissions on the installed Tango files (these commands requires bash / zsh):
cd <GDC install prefix>/include/d/<GDC version>/tango for dir in `find . -type d` ; do sudo chmod 755 $dir ; done for file in `find . -type f` ; do sudo chmod 644 $file ; done
When Tango fails to generate all files properly with GDC 0.24 due to a bug in gdmd (the wrapper script that emulates dmd) -- it does not build the header (.di) files. You can fix gdmd by setting "$header = 1" for the -Hf argument (approx line 190):
} elsif ( $arg =~ m/^-Hf(.*)$/ ) { $header = 1; $header_file = $1; } elseif ...
References
User Comments