compile gdc

Thomas Kuehne thomas-dloop at kuehne.cn
Mon Mar 6 13:26:10 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Manfred Hansen schrieb am 2006-03-06:
> Hello,
>
> i try to compile on Debian AMD64 the gdc.
> That is my configure:
> ./gcc-4.0.2/configure --enable-languages=c,d,c++
> --prefix=/usr/local/gcc-4.02 --enable-shared
>
> The Error Message:

[snip]

> Maybe someone have an idea.
> Yes i know that gdc didn't run under AMD64 but i try it although.

gdc-0.17 runs on AMD64 - but only as a 32bit application.

Below the steps I used to get GDC running on Gentoo / AMD64.

1) install some emulation libs - might have different names under Debian
emul-linux-x86-baselibs
emul-linux-x86-compat
emul-linux-x86-glibc

hint: Now you can use DMD to generate 32bit applications, simply add "-L-m32"
to the command line.

2) extract the gcc-3.4 and gdc-0.17 sources

3) run ./gcc/d/setup-gcc.sh

4) configured with:
CFLAGS="-m32" CXXFLAGS="-m32" CPPFLAGS="-m32" ./configure
- --enable-languages=c,d --enable-threads --disable-multilib --disable-libiberty
- --prefix=/opt/gdc/gdc-0.17

Maybe you have to add CC=gcc32 and CXX=g++32.

5) run make in root dir <this will take some time>

6) make will fail with:
make: *** [configure-target-libiberty] Error 1

7) change to gcc/d/phobos and replace

GDC=$CC
GDC=`echo $CC | sed s/xgcc/gdc/`

with

GDC="gdc -m32"

8) run configure:
PATH=/<builddir>/gcc:$PATH CFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix=/opt/gdc/gdc-0.17

9) open the Makefile and copy the content from target_alias = ... to host_alias = ...

10) mkdir -p <content of target_alias>/gcc

11) run make in gcc/d/phobos
PATH=/<builddir>/gcc:$PATH make

12) open gcc/d/phobos/<target_alias>/gcc/config.d
and remove all lines containing "isfinit"

13) open gcc/d/phobos/std/math.d and replace the 
version(X86) with version(all) infront of int isfinite(real e)

14) run make in gcc/d/phobos (yes again)
PATH=/<builddir>/gcc:$PATH make

15) run: "make install" in gcc

16) run: "make install" in gcc/d/phobos

17) go to the install prefix and open bin/gdmd

replace
my @cmd = ($gdc, @out, '-c', @all_sources_hack, $srcf, '-o', $outf );
with
my @cmd = ($gdc, '-m32', @out, '-c', @all_sources_hack, $srcf, '-o', $outf );

and replace
my @cmd = ($gdc, @out, @dobjects, @objects, @link_out);
with
my @cmd = ("gcc", "-m32", @out, @dobjects, @objects, @link_out, "-lm", "-lpthread", "-lgphobos", "-L/<install prefix>/lib");

You have now a minimal functional GDC (32bit mode) installation on AMD64.
Either use gdmd or "gdc -m32" for compiling.

WARNING: many parts of GPhobos will not work properly

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFEDLaO3w+/yD4P9tIRAqySAJwNLRXId56EtV039cg2b+fUw+zX8QCdHZFk
Dp5BPFwB5vdcXBxJI/txa98=
=zx5C
-----END PGP SIGNATURE-----



More information about the D.gnu mailing list