2009-11-01 17:03:42     GMP linking

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-11-01 17:03:42     GMP linking

Sergio Decherchi (ITALY)

Message: 81981   




I am new at uClinux and I am trying to cross-compile and link the following simple program (prova.c):


#include <stdio.h>

#include <gmp.h>


int main()


mpz_t a;


printf("\nHello Blackfin!\n");

return 0;



The host system is Suse 10.0, the toolchain is bfin-gcc-3.4-3.i386.rpm and, because I am using a rev 0.1 ezkit 537, the used distro is uClinux-dist-2005R3.tar.bz2 compiled disabling the instruction cache.


the used compiling string is:

"bfin-uclinux-gcc -L /home/sedekfx/Documents/blackfin/uClinux-dist/lib/libgmp/

-I /home/sedekfx/Documents/blackfin/uClinux-dist/lib/libgmp/ -Wl,-elf2flt prova.c -o prova" where in the "/home/sedekfx/Documents/blackfin/uClinux-dist/lib/libgmp/" directory there is the compiled libgmp.a lib. This lib was compiled by the make process of uClinux selecting the building process in the make menuconfig procedure.


Then I get the following error:


prova.elf2flt(.text+0x102): In function `_main':

/usr/src/packages/BUILD/bfin-gcc-3.4/../binutils/binutils-2.15/gcc/libgcc2.c: undefined reference to `___gmpz_init'

collect2: ld returned 1 exit status


how to properly link to gmp lib?


Many Thanks in advance




2009-11-01 21:54:22     Re: GMP linking

Mike Frysinger (UNITED STATES)

Message: 81983   


your software is crazy out of date.  if you upgrade to 2009R1, things should work fine.  i just looked at gmp in 2009R1 and it seems to work fine.