Building and Compiling Tango Applications
Since the 0.96 release, a library version of Tango has been provided.
Using Tango as a library
tango.lib / libtango.a / libgtango.a can be added to your command line as any other library. The DMD downloads provides you with a sc.ini / dmd.conf that includes what is necessary to make this work seemlessly.
Using Tango with a dependency tracking tool
You can use a tool that is D dependency aware to build your Tango applications. It will compile and link the necessary Tango modules.
Examples for such tools are:
- DSSS which uses rebuild
- anttask from the descent project
- jake - featherweight DMD wrapper for Win32 - uses only DMD switches; generates a file called rsp, which can be used standalone as in dmd @rsp
If you have problems to compile and / or link your application, see if any of these points is of help.
- If you have used Phobos on the machine in the past, make sure the source is no longer in the path the compiler searches. Usually this is set up in sc.ini or dmd.conf when using DMD, or libgphobos.spec is using GDC.
- Make sure the Tango include directory is available to the compiler, usually by editing the path in the compiler config file. The directory that should be specified, is the one where object.di resides.
- The runtime part of Tango needs to be linked in to the application. Due to hard-coding in the compiler, this will need to be named phobos.lib, libphobos.a, libgphobos.a or libgphobos.so depending on compiler, OS and setup. It should replace the previously supplied Phobos library, to make sure it is the right one that is linked in.
- Using bud / build on Linux requires the -op compiler switch. This is absolutely needed, as not using it will create link problems and object file conflicts.
- Make sure the libs pthread, m and c are linked in to your application. Normally this means that the '-lpthread -lm -lc' options are in the linker command line.
- Make sure the '-version=Posix' option is passed to the compiler, see installation documentation. This is needed by the Tango library for various version statements.