[uClinux-dev] address error

John D. Charlton j.d.charlton at ieee.org
Fri Nov 2 21:30:10 EST 2001


On Thursday 01 November 2001 18:42, you wrote:
>
> You need to link against libm to get floating point versions of these
> functions.  Do that and you will have working FP, be sure to put $(LIBM)
> into the link line berfore $(LDLIBS) or libc,
>
> Cheers,
> Davidm

I added the libm.a to the ld line, and the ld errors went away.  Also floats 
seem to work, but printf is not yet working with floats and I am getting 
compile errors with math.h and trig functions.  Here is the test program and 
output followed by the build.  I appreciate any help you can provide.

--John

#include <stdio.h>

int main(int argc, char *argv[])
{
  int a, b, c, d;
  double x = 8.88, y = 0.56;

  a = (int) 10.0 * x;
  b = 10;
  c = a % b;
  d = a - ((a/b) * b);
  printf("c = %d, d = %d\n", c, d);

  printf("x = %f, y = %f, x*y = %f\n", x, y, x*y);
}

###################### output
# ./testFP
c = 8, d = 8
x = , y = , x*y = 
# 

###################### build
cd /home/dimm/test1/test/
make -k
m68k-elf-gcc -m68000 -v -O1 -g -fomit-frame-pointer -DCONFIG_LINEO   -Dlinux 
-D__linux__ -Dunix -D__uClinux__ -DEMBED -fno-builtin -DFLOATS -msep-data -I. 
-I /opt/uClinux/linux-2.4.x/include -I /opt/uClinux/lib/libc/include -o 
testFP testFP.c -Wl,-elf2flt /opt/uClinux/lib/libm/libm.a 
/opt/uClinux/lib/libc/libc.a
Reading specs from /usr/local/lib/gcc-lib/m68k-elf/2.95.3/specs
gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from 
http://fiddes.net/coldfire/)(-msep-data patches)
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/cpp0 -lang-c -v -I. -I 
/opt/uClinux/linux-2.4.x/include -I /opt/uClinux/lib/libc/include 
-D__GNUC__=2 -D__GNUC_MINOR__=95 -Dmc68000 -D__embedded__ -D__mc68000__ 
-D__embedded__ -D__mc68000 -Asystem(embedded) -Amachine(mc68000) 
-D__OPTIMIZE__ -g -D__PIC__ -D__pic__ -DCONFIG_LINEO -Dlinux -D__linux__ 
-Dunix -D__uClinux__ -DEMBED -DFLOATS testFP.c /tmp/ccOmZCjB.i
GNU CPP version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from 
http://fiddes.net/coldfire/)(-msep-data patches) (68k, MIT syntax)
#include "..." search starts here:
#include <...> search starts here:
 .
 /opt/uClinux/linux-2.4.x/include
 /opt/uClinux/lib/libc/include
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/include
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/../../../../m68k-elf/sys-include
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/../../../../m68k-elf/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/../../../../include/g++-3
End of omitted list.
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/cc1 /tmp/ccOmZCjB.i -quiet -dumpbase 
testFP.c -m68000 -msep-data -g -O1 -version -fomit-frame-pointer -fno-builtin 
-o /tmp/ccmkodg9.s
GNU C version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from 
http://fiddes.net/coldfire/)(-msep-data patches) (m68k-elf) compiled by GNU C 
version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
 /usr/local/m68k-elf/bin/as -m68000 --pcrel -o /tmp/cc0Mvf9H.o /tmp/ccmkodg9.s
 /usr/local/lib/gcc-lib/m68k-elf/2.95.3/collect2 -o testFP 
/usr/local/m68k-elf/lib/m68000/msep-data/crt0.o 
-L/usr/local/lib/gcc-lib/m68k-elf/2.95.3/m68000/msep-data 
-L/usr/local/lib/gcc-lib/m68k-elf/2.95.3 
-L/usr/local/m68k-elf/lib/m68000/msep-data -L/usr/local/m68k-elf/lib 
/tmp/cc0Mvf9H.o -elf2flt /opt/uClinux/lib/libm/libm.a 
/opt/uClinux/lib/libc/libc.a -lgcc -lgcc


This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list