Home > Software engineering >  Build error while compiling twrp for moto g(40) fusion
Build error while compiling twrp for moto g(40) fusion

Time:02-01

I was compiling twrp for moto g40 fusion codenamed hanoip using kernel sources, but got this error /bin/bash: -c: line 0: unexpected EOF while looking for matchin`"'

/bin/bash: -c: line 1: syntax error: unexpected end of file

I got this error when

BOARD_USES_RECOVERY_AS_BOOT := true

But after changing the value to false everything was fine.

The problem here is that BOARD_USES_RECOVERY_AS_BOOT must be true for twrp to boot.

here is the build log when BOARD_USES_RECOVERY_AS_BOOT := true

20:48:30 You are building on a machine with 7.69GB of RAM
20:48:30 
20:48:30 The minimum required amount of free memory is around 16GB,
20:48:30 and even with that, some configurations may not work.
20:48:30 
20:48:30 If you run into segfaults or other errors, try reducing your
20:48:30 -j value.
20:48:30 ************************************************************
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=127
TARGET_PRODUCT=twrp_hanoip
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=cortex-a9
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-Ubuntu-20.04-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RQ1A.210205.004
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/motorola/hanoip
============================================
ninja: no work to do.
ninja: no work to do.
No need to regenerate ninja file
No need to regenerate ninja file
No need to regenerate ninja file
Starting ninja...
[  0% 1/3773] target  C  : recovery <= bootable/recovery/twrp.cpp
FAILED: out/target/product/hanoip/obj/EXECUTABLES/recovery_intermediates/twrp.o
/bin/bash -c "PWD=/proc/self/cwd  prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang   -I system/core/fs_mgr/libfs_avb/include -I system/core/fs_mgr/include_fstab -I system/core/fs_mgr/include -I system/core/fs_mgr/libdm/include -I system/core/fs_mgr/liblp/include -I system/gsid/include -I system/core/init -I system/extras/ext4_utils/include -I bionic -I system/extras -I system/core/adb -I system/core/libmodprobe/include -I system/core/libsparse -I external/zlib -I system/core/libziparchive/include -I external/freetype/include -I external/boringssl/include -I external/libcxx/include -I external/libselinux/include -I external/libpng -I bootable/recovery/gui/include -I bootable/recovery/recovery_ui/include -I bootable/recovery/otautil/include -I bootable/recovery/install/include -I bootable/recovery/fuse_sideload/include -I bootable/recovery/install/include -I bootable/recovery/twrpinstall/include -I bootable/recovery/recovery_utils/include -I bootable/recovery/libpixelflinger/include -I bootable/recovery/minuitwrp/include -I bootable/recovery/twinstall/include -I system/extras/ext4_utils -I external/boringssl/src/include -I bootable/recovery/crypto -I bootable/recovery/crypto/fscrypt -I system/vold -I bootable/recovery -I out/target/product/hanoip/obj/EXECUTABLES/recovery_intermediates -I out/target/product/hanoip/gen/EXECUTABLES/recovery_intermediates -I libnativehelper/include_jni -Isystem/core/fs_mgr/include -Isystem/core/fs_mgr/include -Isystem/core/fs_mgr/libfiemap/include -Isystem/core/logwrapper/include -Isystem/core/fs_mgr/libdm/include -Iexternal/e2fsprogs/lib/uuid -Iexternal/e2fsprogs/lib -Isystem/extras/libfscrypt/include -Isystem/core/fs_mgr/include_fstab -Isystem/core/fs_mgr/libfs_avb/include -Isystem/core/fs_mgr/liblp/include -Ihardware/libhardware/include -Isystem/media/audio/include -Isystem/core/libcutils/include -Isystem/core/libsystem/include -Isystem/bt/types -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhwbinder/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/system/libhidl/transport/manager/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.1/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.2/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/base/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/hardware/interfaces/boot/1.0/[email protected]_genc  _headers/gen -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhwbinder/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/system/libhidl/transport/manager/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.1/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.2/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/base/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/hardware/interfaces/boot/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/hardware/interfaces/boot/1.1/[email protected]_genc  _headers/gen -Iexternal/protobuf/src -Iexternal/protobuf/src -Isystem/core/fs_mgr/liblp/include -Isystem/core/fs_mgr/liblp/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhwbinder/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/system/libhidl/transport/manager/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.1/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.2/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/base/1.0/[email protected]_genc  _headers/gen -Iexternal/zlib -Iexternal/zlib -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include       -Ibootable/recovery/bootloader_message/include -Ibootable/recovery/bootloader_message/include   -Iexternal/libcxx/include -Iexternal/libcxxabi/include  -Iexternal/boringssl/src/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libziparchive/include -Isystem/core/libziparchive/include -Iexternal/googletest/googletest/include -Isystem/core/base/include -Iexternal/fmtlib/include -Iexternal/selinux/libselinux/include     -Isystem/core/libstats/socket/include  -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhwbinder/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/system/libhidl/transport/manager/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.1/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.2/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/base/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/frameworks/hardware/interfaces/stats/1.0/[email protected]_genc  _headers/gen -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhwbinder/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/system/libhidl/transport/manager/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.1/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.2/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/base/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/hardware/interfaces/authsecret/1.0/[email protected]_genc  _headers/gen -Isystem/libhidl/base/include -Isystem/libhidl/transport/include -Isystem/libhwbinder/include -Isystem/core/base/include -Iexternal/fmtlib/include -Isystem/core/libutils/include -Isystem/core/libbacktrace/include -Isystem/core/liblog/include -Isystem/core/libsystem/include -Isystem/core/libcutils/include -Isystem/core/libprocessgroup/include -Iout/soong/.intermediates/system/libhidl/transport/manager/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.1/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/manager/1.2/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/system/libhidl/transport/base/1.0/[email protected]_genc  _headers/gen -Iout/soong/.intermediates/hardware/interfaces/oemlock/1.0/[email protected]_genc  _headers/gen -Iexternal/libcxx/include -Iexternal/libcxxabi/include -D__LIBC_API__=10000 -Ibionic/libc/include -D__LIBM_API__=10000 -D__LIBM_API__=10000 -D__LIBDL_API__=10000 -Iexternal/avb -Ibootable/recovery/twrpinstall/include -Ibootable/recovery/recovery_ui/include  -Iexternal/libcap/libcap/include -Iout/soong/.intermediates/system/apex/apexd/sysprop/libcom.android.sysprop.apex/android_arm64_armv8-a_static/gen/sysprop/include -Iout/soong/.intermediates/system/core/init/sysprop/libcom.android.sysprop.init/android_arm64_armv8-a_static/gen/sysprop/include -Iexternal/protobuf/src -Iout/soong/.intermediates/system/core/init/libinit/android_arm64_armv8-a_static/gen/proto/system/core/init -Iout/soong/.intermediates/system/core/init/libinit/android_arm64_armv8-a_static/gen/proto -Isystem/core/fs_mgr/libsnapshot/include -Isystem/core/fs_mgr/libfiemap/include -Iexternal/e2fsprogs/lib/uuid -Iexternal/e2fsprogs/lib -Isystem/extras/ext4_utils/include -Isystem/core/fs_mgr/include_fstab -Iexternal/protobuf/src -Iout/soong/.intermediates/system/update_engine/update_metadata-protos/android_arm64_armv8-a_static/gen/proto -Iout/soong/.intermediates/system/core/fs_mgr/libsnapshot/libsnapshot_nobinder/android_arm64_armv8-a_static/gen/proto  -Isystem/core/libmodprobe/include -Iexternal/libcxxabi/include   -I system/core/include -I system/media/audio/include -I hardware/libhardware/include -I hardware/libhardware_legacy/include -I hardware/ril/include -I frameworks/native/include -I frameworks/native/opengl/include -isystem out/target/product/hanoip/obj/include -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm64 -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -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  -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 -Wall -Werror -DTW_DEVICE_VERSION='\"-0\"' -DPLATFORM_SDK_VERSION=30 -DRECOVERY_API_VERSION=3 -Wno-unused-parameter -Wno-unused-function -DAB_OTA_UPDATER=1 -DPRODUCT_USE_DYNAMIC_PARTITIONS=1 -DTW_GIT_REVISION='\"45a8d148\"' -DBOARD_USES_RECOVERY_AS_BOOT -DTW_HAS_MTP -DRECOVERY_SDCARD_ON_DATA -DCUSTOM_LUN_FILE=\\\"/config/usb_gadget/g1/functions/mass_storage.0/lun.%d/file\\\" -DTW_HAS_EDL_MODE -DTW_LOAD_VENDOR_MODULES=\"mpq-adapter.ko mpq-dmx-hw-plugin.ko qca_cld3_wlan.ko rdbg.ko exfat.ko mmi_sys_temp.ko sensors_class.ko utags.ko moto_f_usbnet.ko watchdogtest.ko mmi_info.ko mmi_annotate.ko tzlog_dump.ko watchdog_cpu_ctx.ko fpsensor_spi_tee.ko fpc1020_mmi.ko ilitek_v3_mmi.ko sx933x_sar.ko snd_smartpa_aw882xx.ko qpnp_adaptive_charge.ko \\\" -DTW_INCLUDE_CRYPTO -DUSE_FSCRYPT -Wno-macro-redefined -DTW_INCLUDE_FBE -DTW_INCLUDE_FBE_METADATA_DECRYPT -DTW_BRIGHTNESS_PATH=\"/sys/class/backlight/panel0-backlight/brightness\" -DTW_MAX_BRIGHTNESS=2047 -DTW_DEFAULT_BRIGHTNESS=1000fo -DTW_EXCLUDE_ENCRYPTED_BACKUPS -DQCOM_RTC_FIX -DHAVE_CAPABILITIES -DTW_USE_NEW_MINADBD -DTW_DEFAULT_LANGUAGE=en -fPIE -DANDROID_STRICT -target aarch64-linux-android10000   -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/hanoip/obj/EXECUTABLES/recovery_intermediates/twrp.d -o out/target/product/hanoip/obj/EXECUTABLES/recovery_intermediates/twrp.o bootable/recovery/twrp.cpp"
/bin/bash: -c: line 0: unexpected EOF while looking for matching `"'
/bin/bash: -c: line 1: syntax error: unexpected end of file
[  0% 2/3773] target  C  : recovery <= bootable/recovery/twrpTar.cpp
FAILED: out/target/product/hanoip/obj/EXECUTABLES/recovery_intermediates/twrpTar.o
/bin/bash: -c: line 0: unexpected EOF while looking for matching `"'
/bin/bash: -c: line 1: syntax error: unexpected end of file
ninja: build stopped: subcommand failed.
20:48:34 ninja failed with: exit status 1

[0;31m#### failed to build some targets (4 seconds) ####[00m

CodePudding user response:

Can't tell for sure, but (from past experience) this sounds like either a combination of:

Possible cause #1:

  • A script failing to properly wrap something like $PWD in double-quotes when accessing it.
  • The script being called from a directory with characters in it (such as a space or a quote) that needs to be quoted. Since you are using WSL, I often would suspect that you may have the project on a Windows drive.

OR

Possible cause #2:

  • A script failing to properly wrap $PATH in double-quotes when modifying it.
  • And, since you have this tagged WSL, the Windows path having characters in the path (like spaces) that always need quoting.
  • And, the interop feature of WSL that automatically appends the Windows path to the Linux path at startup so that you can run Windows commands (assuming the .exe is included) such as powershell.exe, Visual Studio Code, and (of course) many others.

In the first case, try building in a different directory, preferably something like ~/src.

In the second case ...

Usually I would recommend finding and fixing the quoting issue as the first step, but:

  1. These aren't your scripts
  2. You don't need to fix this on a permanent basic, just while you are building.

So in this case, I'd recommend trying the build with the Windows path propagation turned off (temporarily). To do this:

sudo -e /etc/wsl.conf

And add the following:

[interop]
appendWindowsPath=false

Save, exit the editor, and exit WSL.

From PowerShell, issue:

wsl --shutdown # or wsl --terminate <distro>

Then restart WSL.

echo $PATH to confirm that the Windows path has not been appended, then try the build again.

Regardless, I recommend setting the appendWindowsPath back to true (the default) when you are done for that functionality.

CodePudding user response:

This error usually occurs when using wsl. I didnt get this error on to virual-box or installing ubuntu. Its better to use acthual linux distro rather than using wsl or virtual-box for compiling twrp, kernel or any aosp

  •  Tags:  
  • Related