Thread overview
compile gdc
Mar 06, 2006
Manfred Hansen
Mar 06, 2006
Thomas Kuehne
Mar 07, 2006
Manfred Hansen
March 06, 2006
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:

mv 'libgcc/32/tmp-libgcc.map' libgcc/32/libgcc.map
./xgcc -B./ -B/usr/local/gcc-4.02/x86_64-unknown-linux-gnu/bin/
-isystem /usr/local/gcc-4.02/x86_64-unknown-linux-gnu/include
-isystem /usr/local/gcc-4.02/x86_64-unknown-linux-gnu/sys-include
-L/home/hansen/D/build/gcc/../ld -O2  -DIN_GCC    -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1
-Wl,--version-script=libgcc/32/libgcc.map -o 32/libgcc_s.so.1.tmp  -m32
libgcc/32/_muldi3_s.o libgcc/32/_negdi2_s.o libgcc/32/_lshrdi3_s.o
libgcc/32/_ashldi3_s.o libgcc/32/_ashrdi3_s.o libgcc/32/_cmpdi2_s.o
libgcc/32/_ucmpdi2_s.o libgcc/32/_floatdidf_s.o libgcc/32/_floatdisf_s.o
libgcc/32/_fixunsdfsi_s.o libgcc/32/_fixunssfsi_s.o
libgcc/32/_fixunsdfdi_s.o libgcc/32/_fixdfdi_s.o libgcc/32/_fixunssfdi_s.o
libgcc/32/_fixsfdi_s.o libgcc/32/_fixxfdi_s.o libgcc/32/_fixunsxfdi_s.o
libgcc/32/_floatdixf_s.o libgcc/32/_fixunsxfsi_s.o libgcc/32/_fixtfdi_s.o
libgcc/32/_fixunstfdi_s.o libgcc/32/_floatditf_s.o
libgcc/32/_clear_cache_s.o libgcc/32/_enable_execute_stack_s.o
libgcc/32/_trampoline_s.o libgcc/32/__main_s.o libgcc/32/_absvsi2_s.o
libgcc/32/_absvdi2_s.o libgcc/32/_addvsi3_s.o libgcc/32/_addvdi3_s.o
libgcc/32/_subvsi3_s.o libgcc/32/_subvdi3_s.o libgcc/32/_mulvsi3_s.o
libgcc/32/_mulvdi3_s.o libgcc/32/_negvsi2_s.o libgcc/32/_negvdi2_s.o
libgcc/32/_ctors_s.o libgcc/32/_ffssi2_s.o libgcc/32/_ffsdi2_s.o
libgcc/32/_clz_s.o libgcc/32/_clzsi2_s.o libgcc/32/_clzdi2_s.o
libgcc/32/_ctzsi2_s.o libgcc/32/_ctzdi2_s.o libgcc/32/_popcount_tab_s.o
libgcc/32/_popcountsi2_s.o libgcc/32/_popcountdi2_s.o
libgcc/32/_paritysi2_s.o libgcc/32/_paritydi2_s.o libgcc/32/_powisf2_s.o
libgcc/32/_powidf2_s.o libgcc/32/_powixf2_s.o libgcc/32/_powitf2_s.o
libgcc/32/_mulsc3_s.o libgcc/32/_muldc3_s.o libgcc/32/_mulxc3_s.o
libgcc/32/_multc3_s.o libgcc/32/_divsc3_s.o libgcc/32/_divdc3_s.o
libgcc/32/_divxc3_s.o libgcc/32/_divtc3_s.o libgcc/32/_divdi3_s.o
libgcc/32/_moddi3_s.o libgcc/32/_udivdi3_s.o libgcc/32/_umoddi3_s.o
libgcc/32/_udiv_w_sdiv_s.o libgcc/32/_udivmoddi4_s.o
libgcc/32/unwind-dw2_s.o libgcc/32/unwind-dw2-fde-glibc_s.o
libgcc/32/unwind-sjlj_s.o libgcc/32/gthr-gnat_s.o libgcc/32/unwind-c_s.o
-lc && rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f
32/libgcc_s.so.1 32/libgcc_s.so.1.backup; else true; fi && mv
32/libgcc_s.so.1.tmp 32/libgcc_s.so.1 && ln -s libgcc_s.so.1 32/libgcc_s.so
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.so when searching
for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libc.a when searching for
-lc
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libc.so when searching
for -lc
/usr/bin/ld: skipping incompatible /usr/bin/../lib/libc.a when searching for
-lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[3]: *** [32/libgcc_s.so] Fehler 1
make[3]: Leaving directory `/home/hansen/D/build/gcc'
make[2]: *** [stmp-multilib] Fehler 2
make[2]: Leaving directory `/home/hansen/D/build/gcc'
make[1]: *** [stage1_build] Fehler 2
make[1]: Leaving directory `/home/hansen/D/build/gcc'
make: *** [bootstrap] Fehler 2

The libc.a and libc.so are in /usr/lib/ .

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

Manfred

March 06, 2006
Manfred Hansen wrote:

> 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

Can you cross-compile it to a 32-bit target,
like "i386-unknown-linux" instead of x86_64 ?

--anders
March 06, 2006
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


March 07, 2006
Thank you for your detaild instruction.


Manfred