original link : http://techqa.info/programming/question/28285850/Opensuse-13-1-build-envsetup-sh--syntax-error-near-unexpected-token------r--
Error:
bash: build/envsetup.sh: line 1: syntax error near unexpected token $'{\r'' 'ash: build/envsetup.sh: line 1:
function hmm() {
Solve:
The problem comes from Windows end-of-lines (EOL) so you'll have to convert all scripts to unix-style EOL through dos2unix
(run apt-get install dos2unix
on Ubuntu) and then convert your scripts:
dos2unix build/envsetup.sh sdk/bash_completion/adb.bash
Then all vendorsetup.sh
(that will prevent the "command not found" error you get):
find device/ -name vendorsetup.sh -exec dos2unix {} \;
And one last to run the choosecombo
script:
dos2unix build/core/find-jdk-tools-jar.sh
EDIT: In order to finish the overall compilation, the exhaustive conversion:
find . -name '*.sh' -exec dos2unix {} \;
find . -name '*.py' -exec dos2unix {} \;
find . -name '*.c' -exec dos2unix {} \;
find . -name '*.h' -exec dos2unix {} \;
find . -name '*.cpp' -exec dos2unix {} \;
find . -name '*.hpp' -exec dos2unix {} \;
find . -name '*.txt' -exec dos2unix {} \;
find . -name 'Config.in' -exec dos2unix {} \;
find . -name 'Config.src' -exec dos2unix {} \;
find . -name 'Makefile' -exec dos2unix {} \;
find . -name 'mkmakefile' -exec dos2unix {} \;
find . -name 'Kconfig*' -exec dos2unix {} \;
find . -name rmtypedefs -exec dos2unix {} \;
find . -name apicheck -exec dos2unix {} \;
find . -name seapp_contexts -exec dos2unix {} \;
dos2unix external/busybox/scripts/* external/busybox/applets/* kernel/scripts/* dalvik/dx/etc/* prebuilts/sdk/tools/*
The *.sh
for all shell scripts, and *.py
for all python scripts (used during make
compilation), as well as .c
and .cpp
file (obviously) and other files used by makefiles.
Of course you could go the over-overkill find . -type f -exec dos2unix -s -k -o {} \;
and let dos2unix
decide which files are text and which are binary.
There might be other. I'll edit this answer as I find new ones...
'Programming > android' 카테고리의 다른 글
hikey <waiting for any device> (1) | 2018.07.02 |
---|---|
Build Android-P preview3 on angler (1) | 2018.06.18 |
api doc error on Android 4.4.3 (kitkat) (1) | 2017.05.24 |
perl 5.18 switch module error (0) | 2015.03.20 |
android img upload(fastboot) (0) | 2014.09.29 |
Can't locate Switch.pm (0) | 2014.09.29 |
android-x86 build 도중 만난 errors (0) | 2014.07.13 |
android Kitkat 을 VMware에 설치해보자 (0) | 2014.07.13 |
format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive] (0) | 2013.12.19 |
linker.cpp error (0) | 2013.12.19 |