将Trickle移植到android

将Trickle移植到android,第1张

概述我想在 android上移植Trickle( https://github.com/mariusaeriksen/trickle). 到目前为止我想到的是,我需要使用NDK独立工具链交叉编译此应用程序所依赖的各个库,主要是“libevent”. 从这篇文章中获得了一些帮助 – http://warpedtimes.wordpress.com/2010/02/03/building-open-sou 我想在 android上移植Trickle( https://github.com/mariusaeriksen/trickle).

到目前为止我想到的是,我需要使用NDK独立工具链交叉编译此应用程序所依赖的各个库,主要是“libevent”.

从这篇文章中获得了一些帮助 –
http://warpedtimes.wordpress.com/2010/02/03/building-open-source-libraries-with-android-ndk/

我已经设法用以下’build_androID.sh’脚本交叉编译libevent:

export ANDROID_ROOT=/home/narayan/installations/androID-ndk-r9dexport PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/binexport PATH=$PATH:$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/include#Since it complains about crtbegin and crtendln -s $ANDROID_ROOT/platforms/androID-19/arch-arm/usr/lib/crtbegin_so.oln -s $ANDROID_ROOT/platforms/androID-19/arch-arm/usr/lib/crtend_so.o./configure \--host=arm-linux-androIDeabi \CC=$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-  androIDeabi-gcc \LD=$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld \AR=$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ar \RANliB=$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ranlib \CPPFLAGS="-I$ANDROID_ROOT/platforms/androID-19/arch-arm/usr/include/" \CFLAGS="-nostdlib" \LDFLAGS="-Wl,-rpath-link=$ANDROID_ROOT/platforms/androID-19/arch-arm/usr/lib/ -L$ANDROID_ROOT/platforms/androID-19/arch-arm/usr/lib/" \liBS="-lc -lgcc -L$ANDROID_ROOT/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/lib/gcc/arm-linux-androIDeabi/4.8"

现在,当我为涓流应用程序执行相同 *** 作时,我在上面的涓流项目目录中运行与上面相同的脚本时出现以下错误 –

checking build system type... x86_64-unkNown-linux-gnuchecking host system type... arm-unkNown-linux-androIDeabichecking target system type... arm-unkNown-linux-androIDeabichecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking whether make sets $(MAKE)... yeschecking for working aclocal-1.4... missingchecking for working autoconf... missingchecking for working automake-1.4... missingchecking for working autoheader... missingchecking for working makeinfo... missingchecking for arm-linux-androIDeabi-gcc... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... yeschecking for suffix of executables... checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc accepts -g... yeschecking for /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc option to accept ANSI C... none neededchecking for a sed that does not truncate output... /bin/sedchecking for egrep... grep -Echecking for ld used by /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ldchecking if the linker (/home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld) is GNU ld... yeschecking for /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld option to reload object files... -rchecking for BSD-compatible nm... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-nm -Bchecking whether ln -s works... yeschecking how to recognise dependent librarIEs... pass_allchecking how to run the C preprocessor... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking dlfcn.h usability... yeschecking dlfcn.h presence... yeschecking for dlfcn.h... yeschecking for arm-linux-androIDeabi-g++... arm-linux-androIDeabi-g++checking whether we are using the GNU C++ compiler... yeschecking whether arm-linux-androIDeabi-g++ accepts -g... yeschecking how to run the C++ preprocessor... arm-linux-androIDeabi-g++ -Echecking for arm-linux-androIDeabi-g77... nochecking for arm-linux-androIDeabi-f77... nochecking for arm-linux-androIDeabi-xlf... nochecking for arm-linux-androIDeabi-frt... nochecking for arm-linux-androIDeabi-pgf77... nochecking for arm-linux-androIDeabi-fort77... nochecking for arm-linux-androIDeabi-fl32... nochecking for arm-linux-androIDeabi-af77... nochecking for arm-linux-androIDeabi-f90... nochecking for arm-linux-androIDeabi-xlf90... nochecking for arm-linux-androIDeabi-pgf90... nochecking for arm-linux-androIDeabi-epcf90... nochecking for arm-linux-androIDeabi-f95... nochecking for arm-linux-androIDeabi-fort... nochecking for arm-linux-androIDeabi-xlf95... nochecking for arm-linux-androIDeabi-ifc... nochecking for arm-linux-androIDeabi-efc... nochecking for arm-linux-androIDeabi-pgf95... nochecking for arm-linux-androIDeabi-lf95... nochecking for arm-linux-androIDeabi-gfortran... nochecking for g77... nochecking for f77... nochecking for xlf... nochecking for frt... nochecking for pgf77... nochecking for fort77... nochecking for fl32... nochecking for af77... nochecking for f90... nochecking for xlf90... nochecking for pgf90... nochecking for epcf90... nochecking for f95... nochecking for fort... nochecking for xlf95... nochecking for ifc... nochecking for efc... nochecking for pgf95... nochecking for lf95... nochecking for gfortran... nochecking whether we are using the GNU Fortran 77 compiler... nochecking whether  accepts -g... nochecking the maximum length of command line arguments... 32768checking command to parse /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-nm -B output from /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc object... okchecking for objdir... .libschecking for arm-linux-androIDeabi-ar... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-archecking for arm-linux-androIDeabi-ranlib... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ranlibchecking for arm-linux-androIDeabi-strip... arm-linux-androIDeabi-stripchecking if /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc static flag  works... yeschecking if /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc supports -fno-rtti -fno-exceptions... nochecking for /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc option to produce PIC... -fPICchecking if /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc PIC flag -fPIC works... yeschecking if /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc supports -c -o file.o... yeschecking whether the /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc linker (/home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld) supports shared librarIEs... yeschecking whether -lc should be explicitly linked in... nochecking dynamic linker characteristics... GNU/linux ld.sochecking how to hardcode library paths into programs... immediatechecking whether stripPing librarIEs is possible... yeschecking if libtool supports shared librarIEs... yeschecking whether to build shared librarIEs... yeschecking whether to build static librarIEs... yesconfigure: creating libtoolappending configuration tag "CXX" to libtoolchecking for ld used by arm-linux-androIDeabi-g++... /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ldchecking if the linker (/home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld) is GNU ld... yeschecking whether the arm-linux-androIDeabi-g++ linker (/home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld) supports     shared librarIEs... yeschecking for arm-linux-androIDeabi-g++ option to produce PIC... -fPICchecking if arm-linux-androIDeabi-g++ PIC flag -fPIC works... yeschecking if arm-linux-androIDeabi-g++ supports -c -o file.o... yeschecking whether the arm-linux-androIDeabi-g++ linker (/home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ld) supports   shared librarIEs... yeschecking dynamic linker characteristics... GNU/linux ld.sochecking how to hardcode library paths into programs... immediatechecking whether stripPing librarIEs is possible... yesappending configuration tag "F77" to libtoolchecking whether make sets $(MAKE)... (cached) yeschecking for arm-linux-androIDeabi-ranlib... (cached) /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-ranlibchecking for a BSD-compatible install... /usr/bin/install -cchecking for socket in -lsocket... nochecking for gethostbyname in -lnsl... nochecking for dlopen in -ldl... yeschecking for err in -lc... yeschecking for ANSI C header files... (cached) yeschecking for sys/wait.h that is POSIX.1 compatible... yeschecking if libc defines __progname... yeschecking sys/ioctl.h usability... yeschecking sys/ioctl.h presence... yeschecking for sys/ioctl.h... yeschecking sys/time.h usability... yeschecking sys/time.h presence... yeschecking for sys/time.h... yeschecking err.h usability... yeschecking err.h presence... yeschecking for err.h... yeschecking time.h usability... yeschecking time.h presence... yeschecking for time.h... yeschecking for unistd.h... (cached) yeschecking for stdint.h... (cached) yeschecking netinet/in.h usability... yeschecking netinet/in.h presence... yeschecking for netinet/in.h... yeschecking asm/poll.h usability... yeschecking asm/poll.h presence... yeschecking for asm/poll.h... yeschecking for an ANSI C-conforming const... yeschecking for pID_t... yeschecking for size_t... yeschecking whether time.h and sys/time.h may both be included... yeschecking for u_int64_t... yeschecking for u_int32_t... yeschecking for u_int16_t... yeschecking for u_int8_t... yeschecking for in_addr_t... nochecking whether /home/narayan/installations/androID-ndk-r9d/toolchains/arm-linux-androIDeabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androIDeabi-gcc needs -Traditional... nochecking return type of signal handlers... voIDchecking for socket... yeschecking for strlcat... yeschecking for strlcpy... yeschecking for daemon... yeschecking for setenv... yeschecking for strsep... yeschecking for sendfile... yeschecking for libevent... yeschecking if underscores are needed for symbols... nochecking if we can access libc without dlopen... nochecking if we can access libc with libc.so... nochecking if we can access libc with /usr/lib/libc.so*... noconfigure: error: Couldn't figure out how to access libc

configure.in中的相应行是 –

AC_MSG_CHECKING(if we can access libc without dlopen)AC_TRY_RUN(#include <dlfcn.h>#include <stdio.h>intmain(int argc,char **argv){    voID *dh;    dh = (voID *)-1L;    if (dlsym(dh,"printf") != NulL || dlsym(dh,"_printf") != NulL)        exit(0);    exit(1);},[AC_MSG_RESulT(yes)    AC_define(NODLOPEN)    HAVEMETHOD=yes],AC_MSG_RESulT(no),AC_MSG_RESulT(no))if test "$HAVEMETHOD" = "no"; then    dnl ugly,ugly Hack              liBCGUESS=`echo /lib/libc.so.*`    USRliBCGUESS=`echo /usr/lib/libc.so*`    if test "$USRliBCGUESS" = "/usr/lib/libc.so.*"; then       USRliBCGUESS=""    fi    if test "$liBCGUESS" = "/lib/libc.so.*"; then       liBCGUESS=""    fi    for TESTliB in libc.so `echo $USRliBCGUESS` `echo $liBCGUESS`    do        AC_MSG_CHECKING(if we can access libc with $TESTliB)        AC_TRY_RUN(        #include <dlfcn.h>        #include <stdio.h>        int        main(int argc,char **argv)        {            voID *dh;            if (dlopen("$TESTliB",RTLD_LAZY) != NulL)                   exit(0);            exit(1);        },[AC_MSG_RESulT(yes)            AC_define_UNQUOTED(DLOPENliBC,"$TESTliB")        HAVEMETHOD=yes],AC_MSG_RESulT(no))    if test "$HAVEMETHOD" = "yes"; then       break    fi    donefiif test "$HAVEMETHOD" = "no"; then   AC_MSG_ERROR(Couldn't figure out how to access libc)fi

我已经尝试过官方的NDK文档,但无法获得太多帮助.

所以我有几个问题: –

>如何解决上述错误?
>如何告诉编译器链接我之前为androID交叉编译的共享库(libevent),以便为androID生成最终的可执行命令行应用程序.

而且这甚至可以在AndroID上移植涓流?

如果我能得到一些帮助或至少链接到一些可以帮助我解决这个问题的文章,我会很高兴.

谢谢 :)

@R_502_6120@ 对于1.,您至少需要调整configure.in来修改“丑陋,丑陋的黑客”(如源代码中所述)部分:
liBCGUESS=`echo /lib/libc.so.*`

liBCGUESS="/path/to/ndk/platforms/androID-${ANDROID_API_LEVEL}/arch-${TARGET_ARCH}/usr/lib/libc.so"

您应该使用与您要支持的最小值相对应的API级别,而不是使用androID-19.

此外,如果您想更好地支持更多的AndroID设备,您应该调整脚本的其余部分,以便它可以轻松地为其他体系结构交叉编译您的lib(现在NDK支持arm,mips,x86).

对于2.,您可以将–with-libevent = / path / to / libevent_library / parameter添加到./configure的调用中.在这种情况下,在/ path / to / libevent_library中,你应该有./lib/libevent.so和./include/event.h

总结

以上是内存溢出为你收集整理的将Trickle移植到android全部内容,希望文章能够帮你解决将Trickle移植到android所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1138807.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-31
下一篇2022-05-31

发表评论

登录后才能评论

评论列表(0条)

    保存