android - centos 中的 PJSIP ndk 配置问题

标签 android c linux android-ndk pjsip

我正在尝试将 pjSip 用于我的 android 应用程序并遵循 pjsip 说明。我的系统配置是centos 7.4 64位。 我已经下载了最新的 ndk 和 pjsip 代码。 但是当我运行命令时,我遇到了以下错误。 我注意到的另一件事,confige.log aslo showing cc1: 警告: 命令行选项 '-frtti' 对 C++/ObjC++ 有效,但对 C 无效

[root@localhost pjproject-2.7.1]# ./configure-android

configure-android: APP_PLATFORM not specified, using android-27
configure-android: TARGET_ABI not specified, using armeabi
configure-android: calling ./configure with env vars:
 CC = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
 CXX = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
 CFLAGS =  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include
 CXXFLAGS =  -shared --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti
 LDFLAGS =  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -L/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/
 LIBS = -lgnustl_static  -lc -lgcc
 AR = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
 RANLIB = /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib
 TARGET_HOST = arm-linux-androideabi
 TARGET_ABI = armeabi
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for arm-linux-androideabi-gcc... /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc accepts -g... yes
checking for /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to accept ISO C89... unsupported
checking whether we are using the GNU C++ compiler... yes
checking whether /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ accepts -g... yes
checking for arm-linux-androideabi-ranlib... /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib
checking for arm-linux-androideabi-ar... /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar
checking for pthread_create in -lpthread... no
checking for puts in -lwsock32... no
checking for puts in -lws2_32... no
checking for puts in -lole32... no
checking for puts in -lwinmm... no
checking for puts in -lsocket... no
checking for puts in -lrt... no
checking for sin in -lm... yes
checking for uuid_generate in -luuid... no
checking for uuid_generate in -luuid... (cached) no
checking for library containing gethostbyname... none required
Setting PJ_M_NAME to arm
checking memory alignment... 4 bytes (default)
checking how to run the C preprocessor... /lib/cpp
aconfigure: error: in `/root/ROOTSIPFOLDER/pjproject-2.7.1':
aconfigure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

Below is my configue.log result.



    aconfigure:2916: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.9.x/lto-wrapper
Target: arm-linux-androideabi
.......................................
aconfigure:3269: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -c -g  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
aconfigure:3269: $? = 0
aconfigure:3279: result: yes
aconfigure:3296: checking for /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc option to accept ISO C89
aconfigure:3359: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc  -c  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
conftest.c:10:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
aconfigure:3359: $? = 1
aconfigure: failed program was:
 /* confdefs.h */
 #define PACKAGE_NAME "pjproject"
 #define PACKAGE_TARNAME "pjproject"
 #define PACKAGE_VERSION "2.x"
 #define PACKAGE_STRING "pjproject 2.x"
 #define PACKAGE_BUGREPORT ""
 #define PACKAGE_URL ""
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
 struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
 static char *e (p, i)
      char **p;
      int i;
 {
  return p[i];
 }
 static char *f (char * (*g) (char **, int), char **p, ...)
 {
  char *s;
   va_list v;
   va_start (v,p);
   s = g (p, va_arg (v,int));
   va_end (v);
  return s;
 }

arm-linux-androideabi-gcc: error: unrecognized command line option '-std'
aconfigure:3359: $? = 1
aconfigure: failed program was:
 /* confdefs.h */
 #define PACKAGE_NAME "pjproject"
 #define PACKAGE_TARNAME "pjproject"
 #define PACKAGE_VERSION "2.x"
 #define PACKAGE_STRING "pjproject 2.x"
 #define PACKAGE_BUGREPORT ""
 #define PACKAGE_URL ""
/* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
 struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
 static char *e (p, i)
      char **p;
      int i;
{
   return p[i];
 }Satic char *f (char * (*g) (char **, int), char **p, ...)
 {
   char *s;
   va_list v;
   va_start (v,p);
   s = g (p, va_arg (v,int));
   va_end (v);
   return s;
 }
* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
    function prototypes and stuff, but not '\xHH' hex character constants.
    These don't provoke an error unfortunately, instead are silently treated
    as 'x'.  The following induces an error, until -std is added to get
    proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
    array size at least.  It's necessary to write '\x00'==0 to get something
    that's true only with -std.  */
 int osf4_cc_array ['\x00' == 0 ? 1 : -1];

 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
    inside strings and character constants.  */
 #define FOO(x) 'x'
 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];

 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
 int argc;
 char **argv;
 int
 main ()
 {
 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
   ;
   return 0;
 }
aconfigure:3359: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Ae -c  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
<command-line>:0:1: error: missing '(' after predicate
conftest.c:10:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
aconfigure:3359: $? = 1
aconfigure: failed program was:
 /* confdefs.h */
 #define PACKAGE_NAME "pjproject"
 #define PACKAGE_TARNAME "pjproject"
 #define PACKAGE_VERSION "2.x"
 #define PACKAGE_STRING "pjproject 2.x"
 #define PACKAGE_BUGREPORT ""
 #define PACKAGE_URL ""
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
 struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
 static char *e (p, i)
      char **p;
      int i;
 {
   return p[i];
 }
| static char *f (char * (*g) (char **, int), char **p, ...)
 {
   char *s;
   va_list v;
   va_start (v,p);
   s = g (p, va_arg (v,int));
   va_end (v);
   return s;
 }

/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
    function prototypes and stuff, but not '\xHH' hex character constants.
    These don't provoke an error unfortunately, instead are silently treated
    as 'x'.  The following induces an error, until -std is added to get
    proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
    array size at least.  It's necessary to write '\x00'==0 to get something
    that's true only with -std.  */
 int osf4_cc_array ['\x00' == 0 ? 1 : -1];

 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
    inside strings and character constants.  */
 #define FOO(x) 'x'
 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];

 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
 int argc;
 char **argv;
 int
 main ()
 {
 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
   ;
   return 0;
 }
aconfigure:3359: /root/ROOTSIPFOLDER/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -Aa -D_HPUX_SOURCE -c  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/root/ROOTSIPFOLDER/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c >&5
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C
<command-line>:0:1: error: missing '(' after predicate
conftest.c:10:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
aconfigure:3359: $? = 1
aconfigure: failed program was:
 /* confdefs.h */
 #define PACKAGE_NAME "pjproject"
 #define PACKAGE_TARNAME "pjproject"
 #define PACKAGE_VERSION "2.x"
#define PACKAGE_BUGREPORT ""
 #define PACKAGE_URL ""
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
 struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
 static char *e (p, i)
      char **p;
      int i;
 {
   return p[i];
 }
 static char *f (char * (*g) (char **, int), char **p, ...)
 {
   char *s;
   va_list v;
   va_start (v,p);
   s = g (p, va_arg (v,int));
   va_end (v);
   return s;
 }
|              Syntax error
aconfigure:4534: /lib/cpp  --sysroot=/root/ROOTSIPFOLDER/android-ndk-r16b/platforms/android-27/arch-arm -fexceptions -frtti conftest.c
cc1: warning: command line option '-frtti' is valid for C++/ObjC++ but not for C [enabled by default]
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/syslimits.h:7:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/limits.h:34,
                 from conftest.c:13:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/limits.h:168:61: error: no include path in which to search for limits.h
 #include_next <limits.h>  /* recurse down to the real one */
                                                             ^
aconfigure:4534: $? = 1
aconfigure: failed program was:
 /* confdefs.h */
  #define PACKAGE_NAME "pjproject"
 #define PACKAGE_TARNAME "pjproject"
#define PACKAGE_VERSION "2.x"
 #define PACKAGE_STRING "pjproject 2.x"
 #define PACKAGE_BUGREPORT ""
 #define PACKAGE_URL ""
#define HAVE_LIBM 1
 #define PJ_M_NAME "arm"
 #define PJ_POOL_ALIGNMENT 4
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
           Syntax error
aconfigure:4564: error: in `/root/ROOTSIPFOLDER/pjproject-2.7.1':
aconfigure:4566: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

上面的错误没有在任何地方解决,我已经尝试了所有的事情
有建议。
我非常仔细地执行了每一步,现在不知道我哪里做错了。我在 centos 6.9 上尝试过同样的方法,但没有成功。最初我在带有 sygwin 的 Windows 上尝试了同样的操作,但我也无法运行。 我想知道我的机器有问题还是我做错了什么 抱歉,我无法格式化日志。希望我能在这里得到一些帮助。

最佳答案

看起来项目的构建脚本有一些过时的修订:https://github.com/pjsip/pjproject/blob/master/configure-android#L180 . header 在 r14 中移动到合并树(而不是每个 API 和每个架构),并且已弃用的 header 在 r16 中被删除。

您可能想尝试使用 standalone toolchain build 。您可能想首先尝试将其中一个与非 android 配置脚本一起使用(独立工具链旨在放入不支持 Android 本身的任意 autoconf 系统),但如果这不起作用,请尝试使用 configure -安卓。

关于android - centos 中的 PJSIP ndk 配置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48257719/

相关文章:

c# - Xamarin 表格和 map - 在 map 上获取坐标,创建路线?

android - 为什么我的 CheckedTextView 图标跳转到我的 GridView 中的不同元素?

arrays - 将 char[] 与逗号分开

c - 我的循环在某种程度上是错误的,通过在 while 循环中使用 Y/N 选项

c - C : Segmentation Fault 中的 Trie 实现

android - ListView 在 Scroll 上显示错误的项目

android - 运行项目时出现 FTPClient 错误

c - 套接字编程中的段错误

php - 在 ubuntu 上运行 html 和 php

linux - 从目录导航回来时 cd && ls bash 函数问题