Porting the library to Android
小宝
jxiaobao at gmail.com
Sat May 29 07:18:01 CEST 2010
well,I passed the step(make check),make install directly.
Get the libgmp.so and gmp.h files.
And I write a simple test program,
#include <gmp.h>
#include <stdio.h>
int main()
{
mpz_t t;
mpz_t r1,r2;
mpz_init(t);
mpz_init(r1);
mpz_init(r2);
mpz_init_set_ui(r1, 123);
mpz_init_set_str(r2, "123456789123456789000", 10);
mpz_add(t,r1,r2);
gmp_printf("%s is an mpz %Zd\n", "here", t);
mpz_clear(t);
mpz_clear(r1);
mpz_clear(r2);
return 0;
}
compile with arm-none-linux-gnueabi-gcc,like this,
arm-none-linux-gnueabi-gcc -static -o test test.c -I/usr/local/include -L/usr/local/lib -lgmp -lm
Next,push the test file to Android .
It runs successfully.
BUT,this libgmp.so can not use in Android NDK.
It seems that the cross-compiler arm-eabi-gcc in NDK must be used to compile the library.
But,it always get the "could not find a working compiler"error.
I feel very sorry.
------------------ Original ------------------
From: "Marc Glisse"<marc.glisse at inria.fr>;
Date: Fri, May 28, 2010 11:27 PM
To: "小宝"<jxiaobao at gmail.com>;
Cc: "gmp-discuss"<gmp-discuss at gmplib.org>;
Subject: Re: Porting the library to Android
Please write in English (export LC_MESSAGES=C) and trim extra quotes.
On Fri, 28 May 2010, 小宝 wrote:
> BUT ,when make check,get the error:
You are using a cross-compiler and make check tries to execute programs,
so unless you do something so that make knows how to execute programs on
the target instead of the host...
--
Marc Glisse
More information about the gmp-discuss
mailing list