码迷,mamicode.com
首页 > 其他好文 > 详细

pbcpbc-0.5.12 使用arm编译器编译 过程中出现extend_printf.c中错误,需要替换extend_printf.c文件

时间:2015-03-01 19:47:36      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

下面是国外网站搜索结果

Zhi Guan  3/27/12

Hi,


I build pbc on Mac OS X 10.7 with Android NDK r7b. There are two problem:


1) ./configure --host=arm-linux-androideabi  Stopped, when change the ./config.sub ./config.guess, it passed.
2) ./make will stopped with the following message


libtool: compile:  /Users/guanzhi/Code/android/ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-gcc --sysroot=/Users/guanzhi/Code/android/ndk-r7b/platforms/android-9/arch-arm -DHAVE_CONFIG_H -I. -Iinclude -Wall -W -Wfloat-equal -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wredundant-decls -Wendif-labels -Wshadow -pipe -ffast-math -U__STRICT_ANSI__ -std=gnu99 -g -O2 -MT libpbc_la-extend_printf.lo -MD -MP -MF .deps/libpbc_la-extend_printf.Tpo -c misc/extend_printf.c  -fPIC -DPIC -o .libs/libpbc_la-extend_printf.o
misc/extend_printf.c: In function ‘do_print‘:
misc/extend_printf.c:75: error: incompatible type for argument 3 of ‘fstrcb‘
misc/extend_printf.c:75: note: expected ‘va_list‘ but argument is of type ‘void *‘
 
I commit this line and pass the make process and get the pbc command line tool, which can be
adb push
to my Nexus S (2.3.6) and work.


I am not sure if this will happen on Android NDK with other version or on other OS.


Thanks.


Zhi Guan

 辉 赵  4/5/12

Hi,
I build pbc on Ubuntu also with Android NDK r7b.The same problem
apprears:
I pass the ./configure --host=arm-linux-androideabi process.But when
executing the make
command ,error appears as follow

libtool: compile:  /home/zhaohui/android-ndk-r7b//toolchains/arm-linux-
androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
gcc-4.4.3 --sysroot=/home/zhaohui/android-ndk-r7b//platforms/android-8/
arch-arm -DHAVE_CONFIG_H -I. -Iinclude -I /home/zhaohui/install/

include -Wall -W -Wfloat-equal -Wpointer-arith -Wcast-align -Wstrict-
prototypes -Wredundant-decls -Wendif-labels -Wshadow -pipe -ffast-math
-U__STRICT_ANSI__ -std=gnu99 -g -O2 -MT libpbc_la-extend_printf.lo -MD

-MP -MF .deps/libpbc_la-extend_printf.Tpo -c misc/extend_printf.c -o
libpbc_la-extend_printf.o

misc/extend_printf.c: In function ‘do_print‘:
misc/extend_printf.c:75: error: incompatible type for argument 3 of
‘fstrcb‘
misc/extend_printf.c:75: note: expected ‘va_list‘ but argument is of
type ‘void *‘

make[2]: *** [libpbc_la-extend_printf.lo] Error 1
make[2]: Leaving directory `/home/zhaohui/pbc-0.5.12‘
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zhaohui/pbc-0.5.12‘
make: *** [all] Error 2

I do not know how to solve the probem. If you have a good method,
please tell me. Waiting for your response.
Thanks in advance.

Hui Zhao

 Ben Lynn  4/9/12

Can you try replacing extend_printf.c with the one I‘ve attached? Please let me know if it works.


-Ben


- show quoted text -
- show quoted text -

--
You received this message because you are subscribed to the Google Groups "PBC Library Developers‘ List" group.
To post to this group, send email to pbc-...@googlegroups.com.
To unsubscribe from this group, send email to pbc-devel+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pbc-devel?hl=en.

 


Attachments (1)

extend_printf.c
1 KB   View   Download

2 messages have been deleted.
 辉 赵  4/9/12


Hi Ben:
   I have replaced the extend_printf.c file and tried it agein.
But I feel so sorry that errors occur as follow:

misc/extend_printf.c:5:20: error: printf.h: No such file or directory
misc/extend_printf.c:16: warning: ‘struct printf_info‘ declared
inside
parameter list
misc/extend_printf.c:16: warning: its scope is only this definition
or
declaration, which is probably not what you want
misc/extend_printf.c:22: warning: ‘struct printf_info‘ declared
inside
parameter list
misc/extend_printf.c: In function ‘arginfocb‘:
misc/extend_printf.c:25: error: ‘PA_POINTER‘ undeclared (first use in
this function)
misc/extend_printf.c:25: error: (Each undeclared identifier is
reported only once
misc/extend_printf.c:25: error: for each function it appears in.)
misc/extend_printf.c: In function ‘element_vfprintf‘:
misc/extend_printf.c:32: warning: implicit declaration of function
‘register_printf_specifier‘

make[2]: *** [libpbc_la-extend_printf.lo] Error 1
make[2]: Leaving directory `/home/zhaohui/pbc-0.5.12‘
make[1]: *** [all-recursive] Error 1


  Obviously,there is not the printf.h file.So I copied the printf.h
under /usr/include/printf.h to $NDK/android_armeabi/sysroot(my
own sysroot) and  then tried it again. A lot of errors occured,
...
/home/zhaohui/install/include/gmp.h:1270: error: expected ‘)‘ before
‘signed‘
/home/zhaohui/install/include/gmp.h:1273: error: expected ‘)‘ before
‘const‘
/home/zhaohui/install/include/gmp.h:1276: error: expected ‘)‘ before
‘unsigned‘
/home/zhaohui/install/include/gmp.h:1279: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1282: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1285: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1291: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1294: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1297: error: expected ‘)‘ before
‘unsigned‘
/home/zhaohui/install/include/gmp.h:1299: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1302: warning: parameter names
(without types) in function declaration
/home/zhaohui/install/include/gmp.h:1305: error: expected ‘)‘ before
‘...‘ token
/home/zhaohui/install/include/gmp.h:1308: warning: parameter names
(without types) in function declaration
...

I‘m new to PBC and Android NDK . I need your help.
Thanks so much.
-Hui Zhao


 Ben Lynn  4/10/12

I thought that might happen. Can you try the version attached to this file?


-Ben


- show quoted text -
- show quoted text -


--
You received this message because you are subscribed to the Google Groups "PBC Library Developers‘ List" group.
To post to this group, send email to pbc-...@googlegroups.com.
To unsubscribe from this group, send email to pbc-devel+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pbc-devel?hl=en.

 


Attachments (1)

extend_printf.c
4 KB   View   Download

 辉 赵  4/10/12

 

Hi
       Thanks! I have succeeded to install PBC with Android NDK.
I am curious about the reason why I failed the first time. Then
I compared the original extend_printf.c with the one you gave
me.I found that you have changed the type ‘va_list‘ to ‘void*‘ in
the  parameters of  function  ‘format_cb‘. Now I know the meaning
of the error

 misc/extend_printf.c:75: error: incompatible type for argument 3 of
‘fstrcb‘
misc/extend_printf.c:75: note: expected ‘va_list‘ but argument is of
type ‘void *‘


      But I still have a question.Why must change if want success.
I succeeded to install PBC on my  Ubuntu system without any change.
Could you tell me the reason or recommend some references for me.
      Thanks for giving me so much help.

--Hui Zhao


 Ben Lynn  4/12/12

 

     But I still have a question.Why must change if want success.
I succeeded to install PBC on my  Ubuntu system without any change.
Could you tell me the reason or recommend some references for me.
     Thanks for giving me so much help.

 


It‘s an old bug; I wrote that file in a hurry. I never cared much about the quality of the printf extensions because I only used them for logging statements. Ideally I‘d like to use reigster_printf_specifier() but that only seems to be available on certain platforms.


I‘m guessing my bug didn‘t matter on Ubuntu because va_list just happens to be a void *.


-Ben

This message has been deleted.
 辉 赵  4/12/12

Hi
  I want to use the two libraries to make a code.So I
copied the two libraries and h files to hello-jni project.
I just want to know whether I can use them.The content
of hello-jni.c as follow
---------------------------------------------------------------------------
---
...
jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
                                                  jobject thiz )
{
        pairing_t pairing;
        FILE * fp=fopen("/home/zhaohui/pbc-0.5.12/param/
a.param","r");
        char param[2048];
        size_t count = fread(param,1,1024,fp);
        if(!count)pbc_die("input error");
        pairing_init_set_buf(pairing,param,count);
    return (*env)->NewStringUTF(env, "Hello from JNI !");
}

....
---------------------------------------------------------------------------
------
I also rewrited Android.mk file.The content as follow
--------------------------------------------------------------------
LOCAL_PATH := $(call my-dir)

## prebuilt the static libs
include $(CLEAR_VARS)
LOCAL_MODULE := libgmp
LOCAL_SRC_FILES := libgmp.a
include $(PREBUILT_STATIC_LIBRARY)

## prebuilt the static libs
include $(CLEAR_VARS)
LOCAL_MODULE := libpbc
LOCAL_SRC_FILES := libpbc.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c
LOCAL_STATIC_LIBRARIES := libgmp libpbc
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
----------------------------------------------------------

Then I used the command
root@ubuntu:/home/zhaohui/android-ndk-r7b/samples/hello-jni# $NDK/ndk-
build
Errors occured :
---------------------------------------------------------------------------
----
...
/home/zhaohui/pbc-0.5.12/ecc/mpc.h:60: undefined reference to
`__gmpf_set‘
./obj/local/armeabi/libpbc.a(libpbc_la-mpc.o): In function
`mpc_clear‘:
/home/zhaohui/pbc-0.5.12/ecc/mpc.h:26: undefined reference to
`__gmpf_clear‘
/home/zhaohui/pbc-0.5.12/ecc/mpc.h:27: undefined reference to
`__gmpf_clear‘
./obj/local/armeabi/libpbc.a(libpbc_la-mpc.o): In function
`mpc_pow_ui‘:
/home/zhaohui/pbc-0.5.12/ecc/mpc.c:100: undefined reference to
`__gmpf_set_ui‘
/home/zhaohui/pbc-0.5.12/ecc/mpc.c:101: undefined reference to
`__gmpf_set_ui‘
./obj/local/armeabi/libpbc.a(libpbc_la-mpc.o): In function
`mpc_mul_2exp‘:
/home/zhaohui/pbc-0.5.12/ecc/mpc.c:28: undefined reference to
`__gmpf_mul_2exp‘
/home/zhaohui/pbc-0.5.12/ecc/mpc.c:29: undefined reference to
`__gmpf_mul_2exp‘
./obj/local/armeabi/libpbc.a(libpbc_la-mpc.o): In function
`mpc_init‘:
......
---------------------------------------------------------------------------
--------------------------------
All the errors about functions of libgmp.a library. It seems that it
can not find the libgmp.a library.I am sure that libpbc.a ,libgmp.a
and
all header files under  jni directory.
Please help me to solve the problem.


 辉 赵  4/13/12

Hi
   The problem has been solved.
Thanks again.

 ken  4/25/12

Hi Zhao,
How did you compile the PBC on android? Did you write an Android.mk?
Please help me, I also want to use it on Android.
Thank you :D

- show quoted text -

 Richard Ssembatya  4/26/12

Hello?

Am working on the project where data is encrypted at the server and then
decrypted on Android smart phone. I have a fully working application.
However, one of the challenge am facing now is how to measure the
computation performance at the server and mobile device. I want to
know the time it takes to encrypt (at the server) and decrypt (at the
mobile device).

Kindly help me on how to go about this....

Many thanks

Richie


 ken  4/26/12

Hi Richie,
How did you compile the pbc on Android? And how to write the pbc
Android.mk?
I also want to decrypt/encrypt files in Android, but don‘t know how to
do it with Android ndk.
Would you help me?
Thank you very much.

ken

- show quoted text -

 Homer Hsing  4/26/12

I think pbc_get_time may help you.


The function prototype is


    double pbc_get_time(void);


And the function is at:
     
     #include <pbc/pbc_test.h>


You may:


     t0 = pbc_get_time();
     //  some code
     t0 = pbc_get_time() - t0;
     // now $t0$ is the time cost of "some code"


    Cheers,
    Homer
- show quoted text -

 辉 赵  5/3/12


Hi Ken:
Here is my Android.mk.

--------------------------------------------------------
LOCAL_PATH := $(call my-dir)

## prebuilt the static libs
include $(CLEAR_VARS)

LOCAL_MODULE := libgmp
LOCAL_SRC_FILES := libgmp.a

include $(PREBUILT_STATIC_LIBRARY)

## prebuilt the static libs
include $(CLEAR_VARS)

LOCAL_MODULE := libpbc
LOCAL_SRC_FILES := libpbc.a

LOCAL_STATIC_LIBRARIES := libgmp

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c

LOCAL_WHOLE_STATIC_LIBRARIES:= libgmp libpbc

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)
-------------------------------------------------------


because of pbc depending on gmp,so it need to use
LOCAL_WHOLE_STATIC_LIBRARIES, or you will
meet the problem as I countered.


 ken  5/7/12

Hi Zhao,
Do I need to cross compile gmp for android?

- show quoted text -

 Steyn Geldenhuys  6/15/12

Hi

I also need to run pbc on Android. I got a precompiled version of GMP from https://github.com/Rupan/gmp and I compile pbc using the ndk toolchain.
As soon as I try to initialize a pairing the whole Android application just exits.

Have any of you encountered this problem? Do any of you have a suggestion? Should I rather compile GMP myself with the ndk toolchain?
- show quoted text -

 ndesmoul  6/15/12

Yes, and I have exactly the same problem. Unfortunatly I don‘t know any solution. If you find one I‘m interested.

I compiled GMP using the NDK standalone toolchain, and I know it works as I use it for another application. But no luck with PBC.

 

2012/6/15 Steyn Geldenhuys <djsgel...@gmail.com>

- show quoted text -
- show quoted text -
--

You received this message because you are subscribed to the Google Groups "PBC Library Developers‘ List" group.

To view this discussion on the web visit https://groups.google.com/d/msg/pbc-devel/-/5tJh5D_NVK8J.

To post to this group, send email to pbc-...@googlegroups.com.
To unsubscribe from this group, send email to pbc-devel+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pbc-devel?hl=en.

 

 Steyn Geldenhuys  6/19/12

Hi there!

I got PBC going on Android, but it only works on the emulator for some odd reason. The app just quits on the device. I will keep you posted on my progress. Have any of you encountered this problem?
- show quoted text -

 deba...@gmail.com  6/20/12

Please do an adb bugreport and post the results on android‘s open bug tracker.


Thanks,
Geremy Condra
- show quoted text -

 Steyn Geldenhuys  7/2/12

How did you compile GMP? I‘ve got PBC working, it works on the emulator but not on a real device. I think my GMP is not compiled correctly as the program seg faults at mpz_divexact(z, deg, fac).


On Friday, 15 June 2012 13:58:30 UTC+2, ndesmoul wrote:
- show quoted text -

 Paul Miller  7/2/12

 

On Tuesday, June 19, 2012 10:32:41 AM UTC-4, Steyn Geldenhuys wrote:

I got PBC going on Android, but it only works on the emulator for some odd reason. The app just quits on the device. I will keep you posted on my progress. Have any of you encountered this problem?

Not *that* odd.  I‘m pretty sure the emulator is intel and your phone is arm.  Arm is wrongendian and the binary header is going to be wrong.


 Steyn Geldenhuys  7/2/12

How would I go about fixing this?
- show quoted text -

 Paul Miller  7/2/12

If byte order is an issue, the only option is source diving and patching (likely original coder assumptions, aka bugs).

If the problem is just the binary headers and linking, ... well, ... welcome to the painful world of cross compilers.  Once you get the hang of it, it‘s not too bad, but it won‘t be easy at first.
- show quoted text -

 Steyn Geldenhuys  7/17/12

Ok so I‘ve finally managed to get everything working. GMP cross compiles fine, the problem was with PBC and Android‘s flavour of GCC.

Android‘s flavour of GCC does not support the uses of nested functions. I had to copy the function, in param.c, <code> const char* lookup(const char *key, void* tab) </code> out of the function <code> static int param_set_tab(pbc_param_t par, symtab_t tab) </code> and do some refactoring.

I stumbled on this patch for OSx on PBC 0.5.4 http://ds.informatik.rwth-aachen.de/members/bitsch/pbc-0.5.4-osx.patch/view that led me to patching the PBC code for Android.

I don‘t know if the patch in the link was ever submitted to PBC, but I will definitely bring it to Ben Lynn‘s attention.

I hope this helps some people out there.
- show quoted text -

 gaurav  7/18/12

Hi all
This is my first post...
I am working on signcryption schemes for wireless sensor network. Is it possible to simulate??


- show quoted text -
- show quoted text -
- show quoted text -
--

You received this message because you are subscribed to the Google Groups "PBC Library Developers‘ List" group.

To view this discussion on the web visit https://groups.google.com/d/msg/pbc-devel/-/DQNwO8OoS3IJ.

To post to this group, send email to pbc-...@googlegroups.com.
To unsubscribe from this group, send email to pbc-devel+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pbc-devel?hl=en.

 


--
Gaurav Sharma
09350620203


 venkata ramana kota  7/20/12

Simulate...

On Jul 18, 2012 2:06 PM, "Gaurav Sharma" <sharmaga...@gmail.com> wrote:

Hi all
This is my first post...
I am working on signcryption schemes for wireless sensor network. Is it possible to simulate??


On Tue, Jul 17, 2012 at 5:44 PM, Steyn Geldenhuys <djsgel...@gmail.com> wrote:

Ok so I‘ve finally managed to get everything working. GMP cross compiles fine, the problem was with PBC and Android‘s flavour of GCC.

Android‘s flavour of GCC does not support the uses of nested functions. I had to copy the function, in param.c, <code> const char* lookup(const char *key, void* tab) </code> out of the function <code> static int param_set_tab(pbc_param_t par, symtab_t tab) </code> and do some refactoring.

I stumbled on this patch for OSx on PBC 0.5.4 http://ds.informatik.rwth-aachen.de/members/bitsch/pbc-0.5.4-osx.patch/view that led me to patching the PBC code for Android.

I don‘t know if the patch in the link was ever submitted to PBC, but I will definitely bring it to Ben Lynn‘s attention.

I hope this helps some people out there.


On Monday, 2 July 2012 17:29:22 UTC+2, Paul Miller wrote:
If byte order is an issue, the only option is source diving and patching (likely original coder assumptions, aka bugs).

If the problem is just the binary headers and linking, ... well, ... welcome to the painful world of cross compilers.  Once you get the hang of it, it‘s not too bad, but it won‘t be easy at first.

 

On Monday, July 2, 2012 9:46:55 AM UTC-4, Steyn Geldenhuys wrote:
How would I go about fixing this?

On Monday, 2 July 2012 15:42:37 UTC+2, Paul Miller wrote:


On Tuesday, June 19, 2012 10:32:41 AM UTC-4, Steyn Geldenhuys wrote:

I got PBC going on Android, but it only works on the emulator for some odd reason. The app just quits on the device. I will keep you posted on my progress. Have any of you encountered this problem?

Not *that* odd.  I‘m pretty sure the emulator is intel and your phone is arm.  Arm is wrongendian and the binary header is going to be wrong.


--
You received this message because you are subscribed to the Google Groups "PBC Library Developers‘ List" group.

To view this discussion on the web visit https://groups.google.com/d/msg/pbc-devel/-/DQNwO8OoS3IJ.

To post to this group, send email to pbc-...@googlegroups.com.
To unsubscribe from this group, send email to pbc-devel+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pbc-devel?hl=en.

 


--
Gaurav Sharma
09350620203


--
You received this message because you are subscribed to the Google Groups "PBC Library Developers‘ List" group.
To post to this group, send email to pbc-...@googlegroups.com.
To unsubscribe from this group, send email to pbc-devel+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pbc-devel?hl=en.


 nemo...@gmail.com  11/14/12

This helped me and saved my time a lot.


A bit of clarification on Steyn Geidenhuys‘s posting: the problem happened on a real phone, not on an emulator or during compilation. Compilation worked fine with ndk n8, and I could make pbc work within emulator. However, as soon as I moved the app to real devices, calls to nested lookup() functions failed with SIGSEGV with faulting address being the function address of lookup function. Once I patched pbc with the OSX patch, it worked fine.


Sangman


On Tuesday, July 17, 2012 7:14:33 AM UTC-5, Steyn Geldenhuys wrote:
Ok so I‘ve finally managed to get everything working. GMP cross compiles fine, the problem was with PBC and Android‘s flavour of GCC.

Android‘s flavour of GCC does not support the uses of nested functions. I had to copy the function, in param.c, <code> const char* lookup(const char *key, void* tab) </code> out of the function <code> static int param_set_tab(pbc_param_t par, symtab_t tab) </code> and do some refactoring.

I stumbled on this patch for OSx on PBC 0.5.4 http://ds.informatik.rwth-aachen.de/members/bitsch/pbc-0.5.4-osx.patch/view that led me to patching the PBC code for Android.

I don‘t know if the patch in the link was ever submitted to PBC, but I will definitely bring it to Ben Lynn‘s attention.

I hope this helps some people out there.

On Monday, 2 July 2012 17:29:22 UTC+2, Paul Miller wrote:
If byte order is an issue, the only option is source diving and patching (likely original coder assumptions, aka bugs).

If the problem is just the binary headers and linking, ... well, ... welcome to the painful world of cross compilers.  Once you get the hang of it, it‘s not too bad, but it won‘t be easy at first.

 

On Monday, July 2, 2012 9:46:55 AM UTC-4, Steyn Geldenhuys wrote:
How would I go about fixing this?

On Monday, 2 July 2012 15:42:37 UTC+2, Paul Miller wrote:


On Tuesday, June 19, 2012 10:32:41 AM UTC-4, Steyn Geldenhuys wrote:

I got PBC going on Android, but it only works on the emulator for some odd reason. The app just quits on the device. I will keep you posted on my progress. Have any of you encountered this problem?

Not *that* odd.  I‘m pretty sure the emulator is intel and your phone is arm.  Arm is wrongendian and the binary header is going to be wrong.

 

pbcpbc-0.5.12 使用arm编译器编译 过程中出现extend_printf.c中错误,需要替换extend_printf.c文件

标签:

原文地址:http://blog.csdn.net/hepfei90/article/details/44004659

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!