--- a\device\rockchip\common\BoardConfig.mk +++ b\device\rockchip\common\BoardConfig.mk #for 3G/4G modem dongle support -BOARD_HAVE_DONGLE := false +BOARD_HAVE_DONGLE := true
Compile Error:
============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=11 TARGET_PRODUCT=rk3568_r TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_TYPE=release TARGET_ARCH=arm64 TARGET_ARCH_VARIANT=armv8-a TARGET_CPU_VARIANT=cortex-a55 TARGET_2ND_ARCH=arm TARGET_2ND_ARCH_VARIANT=armv8-2a TARGET_2ND_CPU_VARIANT=cortex-a55 HOST_ARCH=x86_64 HOST_2ND_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-5.4.0-91-generic-x86_64-Ubuntu-18.04.6-LTS HOST_CROSS_OS=windows HOST_CROSS_ARCH=x86 HOST_CROSS_2ND_ARCH=x86_64 HOST_BUILD_TYPE=release BUILD_ID=RQ3A.210705.001 OUT_DIR=out ============================================ [ 30% 283/935] target C++: usb_dongle <= external/usb_modeswitch/usb_dongle/Misc.cpp FAILED: out/target/product/rk3568_r/obj/EXECUTABLES/usb_dongle_intermediates/Misc.o /bin/bash -c "(prebuilts/clang/host/linux-x86/clang-r383902b1/bin/clang-tidy -warnings-as-errors=clang-analyzer-security*,cert-* -quiet -extra-arg-before=-fno-caret-diagnostics -extra-arg-before=-D__clang_analyzer__ -extra-arg-before=-Xclang -extra-arg-before=-analyzer-config -extra-arg-before=-Xclang -extra-arg-before=c++-temp-dtor-inlining=false -checks=-*,clang-diagnostic-unused-command-line-argument,google*,-google-build-using-namespace,-google-default-arguments,-google-explicit-constructor,-google-readability*,-google-runtime-int,-google-runtime-references,-*,clang-analyzer-security*,cert-*,-cert-err34-c,-cert-err58-cpp,-cert-env33-c external/usb_modeswitch/usb_dongle/Misc.cpp -- -I external/usb_modeswitch/usb_dongle -I out/target/product/rk3568_r/obj/EXECUTABLES/usb_dongle_intermediates -I out/target/product/rk3568_r/gen/EXECUTABLES/usb_dongle_intermediates -Isystem/core/libsysutils/include -Isystem/core/libsysutils/include -Iframeworks/native/libs/binder/include -Isystem/core/base/include -Isystem/core/libcutils/include_vndk -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include_vndk -Isystem/core/libsystem/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/frameworks/native/libs/binder/libbinder/android_vendor.30_arm64_armv8-a_cortex-a55_shared/gen/aidl -Isystem/core/libcutils/include_vndk -Isystem/core/libprocessgroup/include -Isystem/core/libcutils/include -Isystem/core/liblog/include_vndk -Iexternal/selinux/libselinux/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include_vndk -Isystem/core/libsystem/include -Isystem/core/libcutils/include_vndk -Isystem/core/libprocessgroup/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/libhwbinder/include -Isystem/libhwbinder/include -Iexternal/libcxx/include -Iexternal/libcxxabi/include -isystem out/soong/.intermediates/bionic/libc/libc.llndk/android_vendor.30_arm64_armv8-a_cortex-a55_shared/gen/include -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm64 -Iexternal/libcxxabi/include -isystem out/target/product/rk3568_r/obj/include -c -Werror=implicit-function-declaration -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang -ffunction-sections -fdata-sections -fno-short-enums -funwind-tables -fstack-protector-strong -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=format-security -nostdlibinc -march=armv8-a -mcpu=cortex-a55 -Bprebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next -fvisibility-inlines-hidden -std=gnu++17 -fno-rtti -Werror -Wall -Wno-missing-field-initializers -Wno-unused-variable -Wno-unused-parameter -Werror=format -DUSE_USB_MODE_SWITCH -D__ANDROID_VNDK__ -fPIE -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class -target aarch64-linux-android30 -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move ) && (PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-r383902b1/bin/clang++ -I external/usb_modeswitch/usb_dongle -I out/target/product/rk3568_r/obj/EXECUTABLES/usb_dongle_intermediates -I out/target/product/rk3568_r/gen/EXECUTABLES/usb_dongle_intermediates -Isystem/core/libsysutils/include -Isystem/core/libsysutils/include -Iframeworks/native/libs/binder/include -Isystem/core/base/include -Isystem/core/libcutils/include_vndk -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include_vndk -Isystem/core/libsystem/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/frameworks/native/libs/binder/libbinder/android_vendor.30_arm64_armv8-a_cortex-a55_shared/gen/aidl -Isystem/core/libcutils/include_vndk -Isystem/core/libprocessgroup/include -Isystem/core/libcutils/include -Isystem/core/liblog/include_vndk -Iexternal/selinux/libselinux/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include_vndk -Isystem/core/libsystem/include -Isystem/core/libcutils/include_vndk -Isystem/core/libprocessgroup/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/libhwbinder/include -Isystem/libhwbinder/include -Iexternal/libcxx/include -Iexternal/libcxxabi/include -isystem out/soong/.intermediates/bionic/libc/libc.llndk/android_vendor.30_arm64_armv8-a_cortex-a55_shared/gen/include -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm64 -Iexternal/libcxxabi/include -isystem out/target/product/rk3568_r/obj/include -c -Werror=implicit-function-declaration -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang -ffunction-sections -fdata-sections -fno-short-enums -funwind-tables -fstack-protector-strong -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=format-security -nostdlibinc -march=armv8-a -mcpu=cortex-a55 -Bprebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/aarch64-linux-android/bin -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next -fvisibility-inlines-hidden -std=gnu++17 -fno-rtti -Werror -Wall -Wno-missing-field-initializers -Wno-unused-variable -Wno-unused-parameter -Werror=format -DUSE_USB_MODE_SWITCH -D__ANDROID_VNDK__ -fPIE -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class -target aarch64-linux-android30 -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -Wno-deprecated-copy -Wno-range-loop-construct -Wno-misleading-indentation -Wno-zero-as-null-pointer-constant -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-string-compare -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-pessimizing-move -MD -MF out/target/product/rk3568_r/obj/EXECUTABLES/usb_dongle_intermediates/Misc.d -o out/target/product/rk3568_r/obj/EXECUTABLES/usb_dongle_intermediates/Misc.o external/usb_modeswitch/usb_dongle/Misc.cpp )" error: declaration uses identifier '_FORTIFY_SOURCE', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] error: declaration uses identifier '_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__ANDROID_VNDK__', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__clang_analyzer__', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__compiler_offsetof', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '_FORTIFY_SOURCE', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] error: declaration uses identifier '_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__ANDROID_VNDK__', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__clang_analyzer__', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__compiler_offsetof', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix .............. error: declaration uses identifier '_FORTIFY_SOURCE', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] error: declaration uses identifier '_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__ANDROID_VNDK__', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__clang_analyzer__', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__compiler_offsetof', which is a reserved identifier [cert-dcl37-c,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '_FORTIFY_SOURCE', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] error: declaration uses identifier '_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__ANDROID_VNDK__', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__clang_analyzer__', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix error: declaration uses identifier '__compiler_offsetof', which is a reserved identifier [cert-dcl51-cpp,-warnings-as-errors] note: this fix will not be applied because it overlaps with another fix 15:58:06 ninja failed with: exit status 1 #### failed to build some targets (01:38 (mm:ss)) ####
Solution:
Modify \external\usb_modeswitch\usb_dongle\Android.mk
LOCAL_PATH:= $(call my-dir) common_src_files := \ NetlinkManager.cpp \ NetlinkHandler.cpp \ MiscManager.cpp \ Misc.cpp \ G3Dev.cpp common_shared_libraries := \ libsysutils \ libbinder \ libcutils \ liblog \ libselinux \ libutils \ libbase \ libhwbinder common_cflags := -Werror -Wall -Wno-missing-field-initializers -Wno-unused-variable -Wno-unused-parameter - common_local_tidy_flags := -warnings-as-errors=clang-analyzer-security*,cert-* + #common_local_tidy_flags := -warnings-as-errors=clang-analyzer-security*,cert-* common_local_tidy_checks := -*,clang-analyzer-security*,cert-*,-cert-err34-c,-cert-err58-cpp common_local_tidy_checks += ,-cert-env33-c include $(CLEAR_VARS) LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_MODULE := usb_dongle LOCAL_PROPRIETARY_MODULE := true LOCAL_CLANG := true LOCAL_TIDY := true LOCAL_TIDY_FLAGS := $(common_local_tidy_flags) LOCAL_TIDY_CHECKS := $(common_local_tidy_checks) LOCAL_SRC_FILES := \ main.cpp \ $(common_src_files) LOCAL_INIT_RC := usb_dongle.rc LOCAL_CFLAGS := $(common_cflags) LOCAL_CFLAGS += -Werror=format LOCAL_CFLAGS += -DUSE_USB_MODE_SWITCH LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) include $(BUILD_EXECUTABLE)
Comment out common_local_tidy_flags. It will be OK!