pristineio / webrtc-build-scripts

A set of build scripts useful for building WebRTC libraries for Android and iOS.
BSD 3-Clause "New" or "Revised" License
1.13k stars 447 forks source link

build_apprtc runs error #80

Open krime opened 9 years ago

krime commented 9 years ago
  1. First of all, thanks for the building scripts. After I've done setup all the environment (source build.sh, install dependencies, use jdk 1.8), I tried to build apprtc (arch=x64, debug=true). But I got errors after all:

    [28/2637] CC obj/chromium/src/third_party/boringssl/src/crypto/asn1/boringssl.a_d2i_fp.o
    FAILED: /home/sysu/webrtc-build-
    scripts/android/webrtc/src/third_party/android_tools/ndk//toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-gcc -MMD -MF obj/chromium/src/third_party/boringssl/src/crypto/asn1/boringssl.a_d2i_fp.o.d -DV8_DEPRECATION_WARNINGS -D_FILE_OFFSET_BITS=64 -DNO_TCMALLOC -DDISABLE_NACL -DCHROMIUM_BUILD -DCR_CLANG_REVISION=231690-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 -DUSE_PROPRIETARY_CODECS -DENABLE_BROWSER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DENABLE_AUTOFILL_DIALOG=1 -DCLD_VERSION=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_SUPERVISED_USERS=1 -DVIDEO_HOLE=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_NO_STATIC_INITIALIZER -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_OPENSSL_CERTS=1 -DANDROID -D__GNU_SOURCE=1 -DUSE_STLPORT=1 -D_STLP_USE_PTR_SPECIALIZATIONS=1 '-DCHROME_BUILD_ID=""' -DHAVE_SYS_UIO_H -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG -Igen -I../../chromium/src/third_party/boringssl/src/include -I../../chromium/src/third_party/boringssl/src/crypto -fstack-protector --param=ssp-buffer-size=4 -fno-strict-aliasing -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-unused-local-typedefs -Wno-format -m64 -march=x86-64 -ffunction-sections -funwind-tables -g -fstack-protector -fno-short-enums -finline-limit=64 -Wa,--noexecstack --sysroot=../../third_party/android_tools/ndk//platforms/android-21/arch-x86_64 -isystem../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport -Os -g -gdwarf-4 -fdata-sections -ffunction-sections -fomit-frame-pointer -funwind-tables   -c ../../chromium/src/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c -o obj/chromium/src/third_party/boringssl/src/crypto/asn1/boringssl.a_d2i_fp.o
    In file included from ../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport/limits.h:30:0,
                    from /usr/include/../include/limits.h:123,
                    *************** hundreds of same line **************
                    from ../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport/limits.h:30,
                    from /usr/include/limits.h:123,
                    from ../../chromium/src/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c:59:
    /usr/include/../include/limits.h:123:26: error: #include nested too deeply
    # include_next <limits.h>
                            ^
    usr/include/../include/limits.h:143:30: error: #include nested too deeply
    # include <bits/posix1_lim.h>
                                ^
    /usr/include/../include/limits.h:147:30: error: #include nested too deeply
    # include <bits/posix2_lim.h>
                                ^
    In file included from /usr/include/bits/posix1_lim.h:160:0,
                    from /usr/include/../include/limits.h:143,
                    from ../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport/limits.h:30,
                    from /usr/include/../include/limits.h:123,
                    *************** hundreds of same line **************
                    from ../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport/limits.h:30,
                    from /usr/include/../include/limits.h:123,
                    from ../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport/limits.h:30,
                    from /usr/include/limits.h:123,
                    from ../../chromium/src/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c:59:
    /usr/include/bits/local_lim.h:38:26: error: #include nested too deeply
    #include <linux/limits.h>
                            ^
    ../../chromium/src/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c: In function 'asn1_d2i_read_bio':
    ../../chromium/src/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c:235:16: error: 'INT_MAX' undeclared (first use in this function)
    if (want > INT_MAX /* BIO_read takes an int length */ ||
               ^
    ../../chromium/src/third_party/boringssl/src/crypto/asn1/a_d2i_fp.c:235:16: note: each undeclared identifier is reported only once for each function it appears in
    [28/2637] CC obj/chromium/src/third_party/libvpx/source/libvpx/vp9/encoder/x86/libvpx_intrinsics_avx2.vp9_dct_avx2.o
    ninja: build stopped: subcommand failed.
    Debug build for apprtc failed for revision 8726
  2. Seems like the -Werror turns on, so I remove it, and tried again, then I got:

    Running ninja
    ninja: Entering directory `out_android_x86_64/Debug'
    [208/2656] CC obj/chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu_features.cpu-features.o
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c: In function 'extract_cpuinfo_field':
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c:195:21: warning: incompatible implicit declaration of built-in function 'strlen'
    int  fieldlen = strlen(field);
                    ^
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c:204:11: warning: assignment makes pointer from integer without a cast
        p = memmem(p, bufend-p, field, fieldlen);
          ^
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c:216:10: warning: incompatible implicit declaration of built-in function 'memchr'
    p  = memchr(p, ':', bufend-p);
         ^
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c:232:5: warning: incompatible implicit declaration of built-in function 'memcpy'
    memcpy(result, p, len);
    ^
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c: In function 'has_list_item':
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c:246:19: warning: incompatible implicit declaration of built-in function 'strlen'
    int itemlen = strlen(item);
                  ^
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c: In function 'cpulist_parse':
    ../../chromium/src/third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c:378:13: warning: incompatible implicit declaration of built-in function 'memchr'
        q = memchr(p, ',', end-p);
            ^
    [383/2656] CC obj/chromium/src/third_party/libevent/libevent.select.o
    FAILED: /home/sysu/webrtc-build-scripts/android/webrtc/src/third_party/android_tools/ndk//toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-gcc -D__u32=int -MMD -MF obj/chromium/src/third_party/libevent/libevent.select.o.d -DV8_DEPRECATION_WARNINGS -D_FILE_OFFSET_BITS=64 -DNO_TCMALLOC -DDISABLE_NACL -DCHROMIUM_BUILD -DCR_CLANG_REVISION=231690-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_WEBRTC=1 -DUSE_PROPRIETARY_CODECS -DENABLE_BROWSER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DENABLE_AUTOFILL_DIALOG=1 -DCLD_VERSION=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_SUPERVISED_USERS=1 -DVIDEO_HOLE=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DHAVE_CONFIG_H -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DUSE_OPENSSL_CERTS=1 -DANDROID -D__GNU_SOURCE=1 -DUSE_STLPORT=1 -D_STLP_USE_PTR_SPECIALIZATIONS=1 '-DCHROME_BUILD_ID=""' -DHAVE_SYS_UIO_H -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ >ANNOTATIONS=1 -D_DEBUG -Igen -I../../chromium/src/third_party/libevent/android -fstack-protector --param=ssp-buffer-size=4 -fno-strict-aliasing -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-unused-local-typedefs -Wno-format -m64 -march=x86-64 -ffunction-sections -funwind-tables -g -fstack-protector -fno-short-enums -finline-limit=64 -Wa,--noexecstack --sysroot=../../third_party/android_tools/ndk//platforms/android-21/arch-x86_64 -I../../third_party/android_tools/ndk//sources/cxx-stl/stlport/stlport -Os -g -gdwarf-4 -fdata-sections -ffunction-sections -fomit-frame-pointer -funwind-tables   -c ../../chromium/src/third_party/libevent/select.c -o obj/chromium/src/third_party/libevent/libevent.select.o
    ../../chromium/src/third_party/libevent/select.c:67:23: error: conflicting types for 'fd_mask'
    typedef unsigned long fd_mask;
                         ^
    In file included from /usr/include/sys/types.h:219:0,
                    from ../../chromium/src/third_party/libevent/select.c:33:
    /usr/include/sys/select.h:82:19: note: previous declaration of 'fd_mask' was here
    typedef __fd_mask fd_mask;
                     ^
    [383/2656] CC obj/chromium/src/third_party/libvpx/source/libvpx/vp9/encoder/x86/libvpx_intrinsics_sse2.vp9_dct_sse2.o
    ninja: build stopped: subcommand failed.

Can anyone tells me what's the problem of my build? P.S. My compiler's gcc 4.8, OS is Ubuntu 14.10

Thanks.

aaalaniz commented 9 years ago

I don't think this would cause the error you are seeing, but I recommend using jdk1.7.

krime commented 9 years ago

I found the problem where it located. It seems like the build script didn't handle the Compilation Environment perfectly.
For my situation, I've got the System Environment Variables CPATH and LD_LIBRARY_PATH preset. They both point to the system compiler path, which cause the strange problems occurred above. In this time, I recommended patch the build script $WEBRTC_SCRIPT_GIT/android/build.sh with

@@ -224,7 +223,18 @@ execute_build() {
     ARCH_OUT="out_android_${ARCH}"
     REVISION_NUM=`get_webrtc_revision`
+}
+
+# Builds the apprtc demo
+execute_build() {
+    prepare_path
     echo "Build ${WEBRTC_TARGET} in $BUILD_TYPE (arch: ${WEBRTC_ARCH:-arm})"
+
+    export CPATH_OLD=$CPATH
+    export LD_LIBRARY_PATH_OLD=$LD_LIBRARY_PATH
+    unset CPATH
+    unset LD_LIBRARY_PATH
+
     exec_ninja "$ARCH_OUT/$BUILD_TYPE"
     # Verify the build actually worked
@@ -261,8 +271,10 @@ execute_build() {
     else
         echo "$BUILD_TYPE build for apprtc failed for revision $REVISION_NUM"
         exit 1
     fi
+    export CPATH=$CPATH_OLD
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_OLD
+    unset CPATH_OLD
+    unset LD_LIBRARY_PATH_OLD
}