适用于iOS的Libupnp - Armv7,Arm64

时间:2015-10-29 09:24:11

标签: ios upnp armv7 arm64

我有解决iOS版libupnp的问题。

i386和x86_64的合作非常好。

无法为armv7,arm64传递configre。 iPhoneOS没有inttypes.h。

有人可以帮帮我吗?

配置LOG:

./build-libupnp.sh 
Using libupnp-1.6.6.tar.bz2
Building ibupnp for iPhoneOS 8.4 armv7s
Please stand by...
patching file upnp/src/genlib/net/http/httpreadwrite.c
patching file upnp/src/api/upnpapi.c
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for armv7-apple-darwin-strip... no
checking for strip... strip
checking build system type... i386-apple-darwin15.0.0
checking host system type... armv7-apple-darwin
checking for --enable-debug... no
checking for --enable-client... yes
checking for --enable-device... yes
checking for --enable-webserver... yes
checking for --enable-tools... no
checking for --enable-samples... no
checking for documentation directory... ${datarootdir}/doc/libupnp-1.6.6
checking for armv7-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /Applications/Xcode.app/Contents/Developer/usr/bin/gcc accepts -g... yes
checking for /Applications/Xcode.app/Contents/Developer/usr/bin/gcc option to accept ISO C89... unsupported
checking for style of include used by make... GNU
checking dependency style of /Applications/Xcode.app/Contents/Developer/usr/bin/gcc... gcc3
checking whether /Applications/Xcode.app/Contents/Developer/usr/bin/gcc and cc understand -c and -o together... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ld used by /Applications/Xcode.app/Contents/Developer/usr/bin/gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking dlfcn.h usability... no
checking dlfcn.h presence... yes
configure: WARNING: dlfcn.h: present but cannot be compiled
configure: WARNING: dlfcn.h:     check for missing prerequisite headers?
configure: WARNING: dlfcn.h: see the Autoconf documentation
configure: WARNING: dlfcn.h:     section "Present But Cannot Be Compiled"
configure: WARNING: dlfcn.h: proceeding with the preprocessor's result
configure: WARNING: dlfcn.h: in the future, the compiler will take precedence
configure: WARNING:     ## --------------------------------------------- ##
configure: WARNING:     ## Report this to mroberto@users.sourceforge.net ##
configure: WARNING:     ## --------------------------------------------- ##
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... yes
checking whether /Applications/Xcode.app/Contents/Developer/usr/bin/g++ accepts -g... yes
checking dependency style of /Applications/Xcode.app/Contents/Developer/usr/bin/g++... gcc3
checking how to run the C++ preprocessor... /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -E
checking for armv7-apple-darwin-g77... no
checking for armv7-apple-darwin-f77... no
checking for armv7-apple-darwin-xlf... no
checking for armv7-apple-darwin-frt... no
checking for armv7-apple-darwin-pgf77... no
checking for armv7-apple-darwin-cf77... no
checking for armv7-apple-darwin-fort77... no
checking for armv7-apple-darwin-fl32... no
checking for armv7-apple-darwin-af77... no
checking for armv7-apple-darwin-f90... no
checking for armv7-apple-darwin-xlf90... no
checking for armv7-apple-darwin-pgf90... no
checking for armv7-apple-darwin-pghpf... no
checking for armv7-apple-darwin-epcf90... no
checking for armv7-apple-darwin-gfortran... no
checking for armv7-apple-darwin-g95... no
checking for armv7-apple-darwin-f95... no
checking for armv7-apple-darwin-fort... no
checking for armv7-apple-darwin-xlf95... no
checking for armv7-apple-darwin-ifort... no
checking for armv7-apple-darwin-ifc... no
checking for armv7-apple-darwin-efc... no
checking for armv7-apple-darwin-pgf95... no
checking for armv7-apple-darwin-lf95... no
checking for armv7-apple-darwin-ftn... no
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 196608
checking command to parse /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm output from /Applications/Xcode.app/Contents/Developer/usr/bin/gcc object... ok
checking for objdir... .libs
checking for armv7-apple-darwin-ar... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
checking for armv7-apple-darwin-ranlib... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib
checking for armv7-apple-darwin-strip... strip
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc supports -fno-rtti -fno-exceptions... yes
checking for /Applications/Xcode.app/Contents/Developer/usr/bin/gcc option to produce PIC... -fno-common
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc PIC flag -fno-common works... yes
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/gcc supports -c -o file.o... yes
checking whether the /Applications/Xcode.app/Contents/Developer/usr/bin/gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by /Applications/Xcode.app/Contents/Developer/usr/bin/g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the /Applications/Xcode.app/Contents/Developer/usr/bin/g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for /Applications/Xcode.app/Contents/Developer/usr/bin/g++ option to produce PIC... -fno-common
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/g++ PIC flag -fno-common works... yes
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/g++ static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/usr/bin/g++ supports -c -o file.o... yes
checking whether the /Applications/Xcode.app/Contents/Developer/usr/bin/g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin dyld
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... (cached) yes
checking for egrep... (cached) /usr/bin/grep -E
--------------------- Default compilation flags -------------------------------
host is armv7-apple-darwin
host_os is darwin
Using non-specific system compiler settings
checking CFLAGS for gcc -Os... -Os
checking CFLAGS for maximum warnings... -Wall
-------------------------------------------------------------------------------
checking for size_t... no
checking for off_t... no
checking for ANSI C header files... (cached) no
checking arpa/inet.h usability... no
checking arpa/inet.h presence... yes
configure: WARNING: arpa/inet.h: present but cannot be compiled
configure: WARNING: arpa/inet.h:     check for missing prerequisite headers?
configure: WARNING: arpa/inet.h: see the Autoconf documentation
configure: WARNING: arpa/inet.h:     section "Present But Cannot Be Compiled"
configure: WARNING: arpa/inet.h: proceeding with the preprocessor's result
configure: WARNING: arpa/inet.h: in the future, the compiler will take precedence
configure: WARNING:     ## --------------------------------------------- ##
configure: WARNING:     ## Report this to mroberto@users.sourceforge.net ##
configure: WARNING:     ## --------------------------------------------- ##
checking for arpa/inet.h... yes
checking fcntl.h usability... no
checking fcntl.h presence... yes
configure: WARNING: fcntl.h: present but cannot be compiled
configure: WARNING: fcntl.h:     check for missing prerequisite headers?
configure: WARNING: fcntl.h: see the Autoconf documentation
configure: WARNING: fcntl.h:     section "Present But Cannot Be Compiled"
configure: WARNING: fcntl.h: proceeding with the preprocessor's result
configure: WARNING: fcntl.h: in the future, the compiler will take precedence
configure: WARNING:     ## --------------------------------------------- ##
configure: WARNING:     ## Report this to mroberto@users.sourceforge.net ##
configure: WARNING:     ## --------------------------------------------- ##
checking for fcntl.h... yes
checking for inttypes.h... (cached) no
configure: error: required header file missing

这是我的构建脚本。

#!/bin/bash

    #  Automatic build script for libupnp 
    #  for iPhoneOS and iPhoneSimulator
    #
    ###########################################################################
    #  Change values here
    #libupnp
    VERSION="1.6.19"
###########################################################################
    #
    # Don't change anything here
    SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version`                                                          
    CURRENTPATH=`pwd`
    ARCHS="x86_64 i386 armv7s arm64"
    DEVELOPER=`xcode-select -print-path`

    ##########
    set -e
    if [ ! -e libupnp-${VERSION}.tar.bz2 ]; then
            echo "Downloading libupnp-${VERSION}.tar.bz2"
            curl -O http://pkgs.fedoraproject.org/repo/pkgs/libupnp/libupnp-1.6.6.tar.bz2/8918dcf7428cd119d0c8275765ff2833/libupnp-${VERSION}.tar.bz2
    else
        echo "Using libupnp-${VERSION}.tar.bz2"
    fi

    mkdir -p bin
    mkdir -p lib
    mkdir -p src

    for ARCH in ${ARCHS}
    do
        if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]];
        then
            PLATFORM="iPhoneSimulator"
        else
            PLATFORM="iPhoneOS"
        fi
        echo "Building libupnp for ${PLATFORM} ${SDKVERSION} ${ARCH}"
        echo "Please stand by..."
        rm -rf src/libupnp-${VERSION}
        tar zxf libupnp-${VERSION}.tar.bz2 -C src

        if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]] ; then
            export BUILD_DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
            export BUILD_SDKROOT="${BUILD_DEVROOT}/SDKs/${PLATFORM}${SDKVERSION}.sdk"
        else
            export BUILD_DEVROOT="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain"
            export BUILD_SDKROOT="${DEVELOPER}/Platforms/iPhoneOS.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
        fi

        export LD=${BUILD_DEVROOT}/usr/bin/ld
        export CC=${DEVELOPER}/usr/bin/gcc
        export CXX=${DEVELOPER}/usr/bin/g++
        if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]];
        then
            export AR=${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
            export AS=${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/as
            export NM=${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm
            export RANLIB=${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib
        else
            export AR=${BUILD_DEVROOT}/usr/bin/ar
            export AS=${BUILD_DEVROOT}/usr/bin/as
            export NM=${BUILD_DEVROOT}/usr/bin/nm
            export RANLIB=${DEVROOT}/usr/bin/ranlib
        fi
        export LDFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${BUILD_SDKROOT} -L${CURRENTPATH}/lib -miphoneos-version-min=7.0"
        export CFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${BUILD_SDKROOT} -I${CURRENTPATH}/include -I/usr/include  -miphoneos-version-min=7.0"
        export CXXFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${BUILD_SDKROOT} -I${CURRENTPATH}/include -miphoneos-version-min=7.0"

        mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"

        LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-libupnp-error-${VERSION}.log"

        HOST=${ARCH}
        if [ "${ARCH}" == "arm64" ];
        then
            HOST="aarch64"
        fi

        ./configure --host=${HOST}-apple-darwin --prefix="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" --disable-shared --enable-static --disable-assembly

        make
        make install
        cd ${CURRENTPATH}
        rm -rf src/libupnp-${VERSION}

    done

    echo "Build library..."
    lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/liblibupnp.a ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-x86_64.sdk/lib/liblibupnp.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/liblibupnp.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/liblibupnp.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-arm64.sdk/lib/liblibupnp.a  -output ${CURRENTPATH}/lib/liblibupnp.a
    mkdir -p ${CURRENTPATH}/include/libupnp
    cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/ ${CURRENTPATH}/include/libupnp/
    echo "Building done."

0 个答案:

没有答案