Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle build failed on win7 #1575

Closed
xiguapi2015 opened this issue Jan 15, 2018 · 42 comments
Closed

gradle build failed on win7 #1575

xiguapi2015 opened this issue Jan 15, 2018 · 42 comments

Comments

@xiguapi2015
Copy link

Environment

Win7 64bit

What did you do?
I get source and set environment ANDROID_HOME,ANDROID_NDK_HOME ,GOROOT_BOOTSTRAP ,then do "git submodule update --init --recursive".
last,I use "gradle build -stacktrace" then found it fialed as follows:

FAILURE: Build failed with an exception.

  • What went wrong:
    The specified build file 'E:\work\myproject\workspace\jsq\code\sample_new\shadowsocks-android\uild' does not exist.

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is:
    java.lang.IllegalArgumentException: The specified build file 'E:\work\myproject\workspace\jsq\code\sample_new\shadowsocks-android\uild' does not exist.
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34.........
    I wan't known what's my problem,thank you very much.

@Mygod
Copy link
Contributor

Mygod commented Jan 16, 2018

Please refer to @imReker's #1570.

@imReker
Copy link
Contributor

imReker commented Jan 16, 2018

Try CD to src/overture/ and run make.bat 19 in cmd.
To build jni library on Windows, you fisrt need Windows 10 and build Overture with bundled Go.
Or download prebuild Go binary mentioned by Mygod.

@xiguapi2015
Copy link
Author

@imReker thank you,must be win10,is win7 ok?

@imReker
Copy link
Contributor

imReker commented Jan 16, 2018

It should be OK with the precompiled binary

@xiguapi2015
Copy link
Author

@thank you very much ,let me have try

@imReker
Copy link
Contributor

imReker commented Jan 16, 2018

Wait. I noticed that your error is:
shadowsocks-android\uild does not exist

Did you correctly setup your gradle environment?

@xiguapi2015
Copy link
Author

xiguapi2015 commented Jan 16, 2018

@imReker I think gradle envirment is ok,This error occurred at the beginning of the trial,then i make cmd "gradle clean",then "gradle build -stacktrace " the follows happened:

Configure project :core
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
at org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(CompileOptions.java:273)
at org.gradle.api.tasks.compile.CompileOptions_Decorated.setBootClasspath(Unknown Source)
at com.android.build.gradle.tasks.factory.JavaCompileConfigAction.execute(JavaCompileConfigAction.java:77)
at com.android.build.gradle.tasks.factory.JavaCompileConfigAction.execute(JavaCompileConfigAction.java:31)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:148).......

    > Configure project :mobile

Warning: No match found for [DefaultTaskExecutionRequest{args=[build],projectPath='null'}]
Configuration 'compile' in project ':mobile' is deprecated. Use 'implementation' instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)

Task :core:goBuild FAILED
'src' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':core:goBuild'.

Process 'command 'cmd.exe'' finished with non-zero exit value 1

@xiguapi2015
Copy link
Author

@imReker I set GOROOT_BOOTSTRAP with "D:\GreenSoft\Go" is this ok?

@imReker
Copy link
Contributor

imReker commented Jan 16, 2018

Task :core:goBuild FAILED
'src' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

Task goBuild is defined in core/build.gradle, it will execute core/src/overture/make.bat.
You get this error because your current working dir is not in core, so cmd can't find src.
It's strange because there is no problem build within Android Studio.
Try modify the path from src/overture/make.bat to core/src/overture/make.bat

@xiguapi2015
Copy link
Author

@imReker I still match mistake, is it means must I first "CD to src/overture/ and run make.bat 19 in cmd" ,and then build the project?

@imReker
Copy link
Contributor

imReker commented Jan 16, 2018

Yes, try make.bat first. If success, modify the path from src/overture/make.bat to core/src/overture/make.bat in build.gralde, then gradle build

@xiguapi2015
Copy link
Author

I find it failed with errors:
"Make standalone toolchain for ARM arch"
usage: make_standalone_toolchain.py [-h] --arch
{arm,arm64,mips,mips64,x86,x86_64}
[--api API]
[--stl {gnustl,libc++,stlport}] [--force]
[-v]
[--package-dir PACKAGE_DIR | --install-dir INSTALL_DIR]
make_standalone_toolchain.py: error: argument --api: expected one argument
"Make standalone toolchain for X86 arch"
usage: make_standalone_toolchain.py [-h] --arch
{arm,arm64,mips,mips64,x86,x86_64}
[--api API]
[--stl {gnustl,libc++,stlport}] [--force]
[-v]
[--package-dir PACKAGE_DIR | --install-dir INSTALL_DIR]
make_standalone_toolchain.py: error: argument --api: expected one argument
"Build the custom go"

Building Go bootstrap tool.

cmd/dist

go tool dist: cannot invoke C compiler "gcc": exec: "gcc": executable file not found in %PATH%

Go needs a system C compiler for use with cgo.
To set a C compiler, set CC=the-compiler.
To disable cgo, set CGO_ENABLED=0.

"Get dependences for overture"
go tool: no such tool "compile"
"Cross compile overture for arm"
go tool: no such tool "compile"
系统找不到指定的路径。
"Cross compile overture for arm64"
go tool: no such tool "compile"
E:\work\myproject\workspace\jsq\code\sample_new\shadowsocks-android\core\src\overture.deps\android-toolchain-21-arm64\bin\aarc
"Cross compile overture for x86"
go tool: no such tool "compile"
系统找不到指定的路径。
"Successfully build overture"

Is it means My go envirnment is not correct? and my go env is like this:
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=E:\work\myproject\workspace\gopath
set GORACE=
set GOROOT=D:\GreenSoft\Go
set GOTOOLDIR=D:\GreenSoft\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=

@imReker
Copy link
Contributor

imReker commented Jan 16, 2018

Read carefully please.

Set correct environment var
Download prebuild Go binary in previous post and put them in correct place.
make.bat 19 in core/src/overture/

Android toolchain will be generated in overture/.deps
Overture will be compiled with android toolchain in overture/bin

qq 20180116152207

你再搞不懂我要骂人了

@xiguapi2015
Copy link
Author

@imReker ok I read previous post and try again thanks

@mindAndroid
Copy link

mindAndroid commented Jan 17, 2018

can you please help me to solve this, after trying those step . i have run ndk-build from cmd in winodws and i got this error.

make: *** No rule to make target jni/jni/patch/pcre/pcre_chartables.c', needed by obj/local/armeabi-v7a/objs/pcre/jni/patch/pcre/pcre_chartables.o'. Stop.

@imReker
Copy link
Contributor

imReker commented Jan 18, 2018

@mindAndroid Make sure you execute ndk-build in jni folder. There is no jni/jni folder.

@mindAndroid
Copy link

@imReker yes its works. thanks.

@xiguapi2015
Copy link
Author

@mindAndroid what's your sytem?win7 or win10?

@mindAndroid
Copy link

@xiguapi2015 Windows 10 and i just build it Ubuntu 16.4 too. in both OS its build success.

@xiguapi2015
Copy link
Author

@mindAndroid is gcc needed on windows? my win7 can't be sucess

@mindAndroid
Copy link

@xiguapi2015 may be you will found more issue with win7 so i recommended to install ubuntu 16.4 and build it

@xiguapi2015
Copy link
Author

@mindAndroid these is my steps
1.clone and update srouce.
2.download go bundle from https://github.com/shadowsocks/shadowsocks-android/files/1624782/bin.zip,
``put go.exe and gofromat.exe to "shadowsocks-android\core\src\overture\go\bin"
2.set envirnment variables:
ANDROID_HOME = android_sdk_root
ANDROID_NDK_HOME=android_ndk_root
GOROOT_BOOTSTRAP ="shadowsocks-android\core\src\overture\go"
3.git submodule update --init --recursive
4.cd shadowsocks-android\core\src\overture,and make.bat
5.gradle build or android studio build
Is my steps ok? thank you very much

@mindAndroid
Copy link

@xiguapi2015 when you run make.bat , is it show success message to you ? send me your id i ''ll send go build to you.

@xiguapi2015
Copy link
Author

my id is xiguapi2015
when I make.bat I received messages as follows:
make_standalone_toolchain.py: error: argument --api: expected one argument
"Build the custom go"

Building Go bootstrap tool.

cmd/dist
go tool: no such tool "compile"
"Get dependences for overture"
go tool: no such tool "compile"
'godep.exe' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

I think go build is not success

@mindAndroid
Copy link

@xiguapi2015 you shoud try precompiled binary as refer by @imReker's #1570. go build shoud be success before ndk-build

@imReker
Copy link
Contributor

imReker commented Jan 18, 2018

@xiguapi2015 It's self explained make_standalone_toolchain.py: error: argument --api: expected one argument, see source code of make.bat and find where the --api argument come from.
我跟你说了几遍是make.bat 19,不是make.bat

@mindAndroid
Copy link

try make.bat 19

@xiguapi2015
Copy link
Author

I tyr make.bat 19 and result also like this:
image

@imReker
Copy link
Contributor

imReker commented Jan 18, 2018

@xiguapi2015 Set GOROOT_BOOTSTRAP to your normal version of Windows Go, download it from official site

@xiguapi2015
Copy link
Author

@imReker is this means I need gcc?
image

@imReker
Copy link
Contributor

imReker commented Jan 18, 2018

@xiguapi2015 Yes, to build Go, you need GCC. See document of Go to make sure you have correct environment. I checked my environment again and found that precompiled bin I uploaded is not engouh to build all the things, there are lots of other depdency exe files.
如果你不想浪费时间的话,跳过overture编译吧,直接从release apk里解压一个现成的使用

@xiguapi2015
Copy link
Author

@imReker yes thanks I have a try

@xiguapi2015
Copy link
Author

@imReker I have build overture success ,then change build.gradle line 41 "src/overture/make.bat "to "core/src/overture/make.bat " and it also failed:

image

@imReker
Copy link
Contributor

imReker commented Jan 18, 2018

@xiguapi2015 My fault. Change Linux / to Windows style \\ in build.gradle, eg. src\\overture\\make.bat

@xiguapi2015
Copy link
Author

@imReker
I change / to \ then gradle build also mistake :
image

@xiguapi2015
Copy link
Author

I have build overture success.,Next step,I need only use gradle build or use Android studio to build?

@heiybb
Copy link

heiybb commented Jan 19, 2018

@xiguapi2015 Android Studio might bother you more, try to use Gradle first

@wangbo4020
Copy link

wangbo4020 commented Jan 19, 2018

在Windows下运行 src/overture/make.bat 运行目录不是在 src/overture,而是当前目录,所以后续编译会找不到文件。

@xiguapi2015
Copy link
Author

@wangbo4020 thus what we can do

@chon219
Copy link

chon219 commented Jan 23, 2018

@xiguapi2015 I've already fixed this script, pull the latest code and try again, thanks.

@xiguapi2015
Copy link
Author

@chon219 thankyou

@3792274
Copy link

3792274 commented Sep 26, 2018

arm-linux-androideabi-gcc.exe not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants