undefined references in libgphobos

Thomas Kuehne thomas-dloop at kuehne.cn
Fri Mar 31 07:28:36 PST 2006


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

Paul Bittmann schrieb am 2006-03-30:
> I compiled a crossgcc arm-toolchain with gdc included.
> But now, there is a problem, I can't fix.
> I tried to compile a simple Hello World programm with arm-linux-gdc, and
> it prints some errors. (See attached file). Where could these errors 
> come from?

> /crosscompile/arm-dev/bin/../lib/gcc/arm-linux/3.4.6/../../../../arm-linux/lib/libgphobos.a(config.o)(.text+0x4): In function `_D3gcc6config8isfiniteFeZi':
> arm-linux/gcc/config.d:152: undefined reference to `__isfinitel'

correct solution:
1) port d/phobos/std/math.d to your system by adding "version(arm)" and
arm specific implementations.

2) port d/phobos/config/* and d/phobos/*.in to Arm


dirty solution: 
1) open /crosscompile/ ... /include/d/3.4.5/arm-linux/gcc/config.d

2) check the signature type of "__isfinitel":
extern(C) int __isfinitel(real);

3) check the the Phobos documentation what that function is supposed to
do: "int isfinite(real e); Returns !=0 if e is finite."

4) implement __isfinitel for your system: Endian, size of real...

// slow sample
// have a look at http://www.digitalmars.com/d/float.html if the code is unclear
extern(C) int __isfinitel(real e){
	return (e !<>= 0.0) || (e > e.max) || (e < e.min);
}

5) append the compiled functions to libgphobos.a with "ar":
> gdc -c isfintel_sample.d -o isfintel_sample.o
> ar q libgphobos.a isfintel_sample.o

Thomas


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

iD8DBQFELVX43w+/yD4P9tIRAgr6AKCuIFYkX4+McyQb7H9itUKLajo4rQCfbiL/
NPHg7P7uwcr42oh2gSkAmR0=
=VGuA
-----END PGP SIGNATURE-----



More information about the D.gnu mailing list