Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1067 (closed defect: duplicate)

Opened 4 years ago

Last modified 4 years ago

Makefile causes x86_64 object files to be built in dmd-posix build of Tango.

Reported by: gamerChad Assigned to: larsivi
Priority: major Milestone: 0.99.7
Component: Packaging Version: 0.99.5 Jascha
Keywords: Cc:

Description

When building Tango 0.99.5 Jascha on 64-bit linux with DMD (1.027), a few .c files in Tango get compiled as 64bit object files, thus making them incompatible with the 32 bit code that forms the rest of Tango and the user's program. This results in these unfortunate linker errors that only appear when the user tries to make an executable:

gcc ./_main.o -o main -m32 -Xlinker --start-group -ltango-base-dmd -lDD-tango-io -lDD-tango-sys -lDD-tango-stdc -lDD-tango-sys-linux -lDD-tango-stdc -lDD-tango-io -lDD-tango-text -lDD-tango-io -Xlinker -L/usr/lib -Xlinker -L/usr/lib -ltango-base-dmd -lpthread -lm
collect2: ld terminated with signal 11 [Segmentation fault]
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../libtango-base-dmd.a(monitor.o)' is incompatible with i386 output
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../../x86_64-pc-linux-gnu/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/../../../libtango-base-dmd.a(critical.o)' is incompatible with i386 output
--- errorlevel 1 

The problem appears to be caused by the -m32 flag declared in ADD_CFLAGS never actually making it to some of the files in the make process. The offending code is in <tango src>/lib/dmd-posix.mak, at around line 46:

lib : $(ALL_OBJS)
	make -C $(DIR_CC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
	make -C $(DIR_RT) -fposix.mak lib
	make -C $(DIR_GC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"

I fixed it by adding ADD_CFLAGS="$(ADD_CFLAGS)" to the DIR_RT make invocation.

lib : $(ALL_OBJS)
	make -C $(DIR_CC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
	make -C $(DIR_RT) -fposix.mak lib ADD_CFLAGS="$(ADD_CFLAGS)"
	make -C $(DIR_GC) -fposix.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"

Change History

04/26/08 02:29:24 changed by gamerChad

  • priority changed from critical to major.

04/26/08 05:06:05 changed by Cyborg16

04/26/08 06:41:07 changed by larsivi

See #967 and the fix [3436]. Unless I'm much mistaken, this is already fixed.

04/27/08 03:30:06 changed by gamerChad

  • status changed from new to closed.
  • resolution set to duplicate.

You're both right. I missed that one, sorry for the dup.