Difference between revisions of "GDC/Installation/Generic"
(bump versions) |
m (→Building) |
||
Line 71: | Line 71: | ||
--[enable|disable]-multilib # Allow building both 32-bit and 64-bit apps/libs. | --[enable|disable]-multilib # Allow building both 32-bit and 64-bit apps/libs. | ||
--[enable|disable]-shared # Build shared libraries. | --[enable|disable]-shared # Build shared libraries. | ||
+ | --with-multilib-list=mXX,mYY # Select multilibs, eg: --with-multilib-list=m32,m64,mx32 (AArch64 and x86-64 only) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 20:04, 21 June 2014
This page describes the generic installation process which should be valid for every system but does not include system specific details and tweaks. Please use the system specific installation guides for your system if available.
Prerequesites
The minimum system requirements you need to obtain and build GDC are:
- gcc and g++
- libmpc-dev
- libmpfr-dev
- libgmp3-dev
- autoconf and automake
- flex and bison
- patch
- git
For cross-compiling/multilib builds, you should also have installed:
- gcc-multilib
- (maybe g++-multilib)
Building
Run these commands in a terminal:
mkdir -p gdc/dev
git clone https://github.com/D-Programming-GDC/GDC.git gdc/dev
NOTE: Master branch contains GDC compatible with GCC 4.10.x. In order to build GDC against GCC 4.9.x pick gdc-4.9 branch, for GCC 4.8.x use gdc-4.8, for GCC 4.7.x use gdc-4.7:
git checkout gdc-4.9
To build the D1 Compiler:
cd gdc/dev
git checkout gdc-1.x
cd ../
Grab GCC sources from a mirror. You will need the full gcc archives. Unpack the archives in the gdc dir. This creates something like gdc/gcc-4.9.0. Run these commands:
cd gdc/dev
./setup-gcc.sh ../gcc-4.9.0
mkdir ../objdir
cd ../objdir
../gcc-4.9.0/configure --enable-languages=d --disable-bootstrap \
--prefix=/opt/gdc \
--with-bugurl="http://bugzilla.gdcproject.org" \
--enable-checking=yes
make -j2 2>&1 | tee build.log # insert your number of cores in the -j argument
make install
export PATH=$PATH:/opt/gdc/bin
If you want to compile a release version drop --disable-bootstrap and use --enable-checking=release. Other configure arguments you might want to use:
--[enable|disable]-nls # Native language support (NLS). Lets GDC output diagnostics in languages other than English.
--[enable|disable]-libgomp # Build GCC with OMP support. This is not used by GDC.
--[enable|disable]-libmudflap # Build GCC with Mudflap pointer debugging support. This is not used by GDC.
--[enable|disable]-libquadmath # Build GCC with 128-bit floating point support. This is not used by GDC.
--[enable|disable|-libssp # Build GCC with stack smashing protection.
--[enable|disable]-lto # Support link-time optimization.
--[enable|disable]-ld # Build the ld linker.
--[enable|disable]-gold # Build the gold linker.
--[enable|disable]-multilib # Allow building both 32-bit and 64-bit apps/libs.
--[enable|disable]-shared # Build shared libraries.
--with-multilib-list=mXX,mYY # Select multilibs, eg: --with-multilib-list=m32,m64,mx32 (AArch64 and x86-64 only)
If you get compile errors in Ubuntu (at least x64 version) configure it with multilib (and install gcc-multilib of course).
The make command will perform the build. make install will install the compiled GDC. Use make install-strip to automatically strip symbols from the huge executables.
Since prefix is set to /opt/gdc you will install GDC there so it will not mess up with the installed GCC. Go in /opt/gdc/bin to find the gdc executable. With this source structure it will be easy to do modifications of the sources. To do changes, just modify files in gdc/d directory, it will be visible by the GCC sources. The objdir directory is used for configuration so that the GCC sources remains unmodified.
After following the instructions you can do a quick test:
goshawk@jupiter:/$ gdc -v
Using built-in specs.
COLLECT_GCC=/opt/gdc/bin/gdc
COLLECT_LTO_WRAPPER=/opt/gdc/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.1/configure --enable-languages=d --disable-bootstrap --prefix=/opt/gdc --with-bugurl=http://gdcproject.org/bugzilla --enable-checking=yes
Thread model: posix
gcc version 4.8.1 (GCC)
As you can see your current shell session will start using the newly compiled GCC and GDC, overriding but not overwriting the system default.
Updating an existing build
If you have a setup as described above and want to build a newer gdc version you don't have to do all steps again:
cd gdc/dev
./setup-gcc.sh --update ../gcc-4.9.0
cd ../objdir
make -j2 2>&1 | tee build.log # insert your number of cores in the -j argument
make install