Closed kasivs closed 6 years ago
You can cross-compile (compile on Linux, generate a Windows binary) using:
GOOS=windows go build
the error we found is at Go get, which does not make sense to me
[INFO] --- mvn-golang-wrapper:2.1.5:get (get-StackExchange-wmi) @ adm-agent-core --- [DEBUG] Configuring mojo com.igormaznitsa:mvn-golang-wrapper:2.1.5:get from plugin realm ClassRealm[extension>com.igormaznitsa:mvn-golang-wrapper:2.1.5, parent: sun.misc.Launcher$AppClassLoader@3d4eac69] [DEBUG] Configuring mojo 'com.igormaznitsa:mvn-golang-wrapper:2.1.5:get' with basic configurator --> [DEBUG] (f) autofixGitCache = true [DEBUG] (f) branch = ea383cf3ba6ec950874b8486cd72356d007c768f [DEBUG] (f) disableCvsAutosearch = false [DEBUG] (f) disableSdkLoad = false [DEBUG] (f) enforceGoPathToEnd = false [DEBUG] (f) exec = go [DEBUG] (f) execSubpath = bin [DEBUG] (f) goBin = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target [DEBUG] (f) goPath = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target/gopath [DEBUG] (f) goVersion = 1.8.1 [DEBUG] (f) hideBanner = true [DEBUG] (f) ignoreErrorExitCode = false [DEBUG] (f) keepSdkArchive = false [DEBUG] (f) keepUnarchFolderIfError = false [DEBUG] (f) packages = [github.com/StackExchange/wmi] [DEBUG] (f) project = MavenProject: com.emc.dpsg.ecdm.adm:adm-agent-core:2.0.0-1-SNAPSHOT @ /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/pom.xml [DEBUG] (f) reportsFolder = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target/reports [DEBUG] (f) sdkSite = http://storage.googleapis.com/golang/ [DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@1a68e026 [DEBUG] (f) skip = false [DEBUG] (f) sources = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/src [DEBUG] (f) storeFolder = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/.external-resources [DEBUG] (f) useEnvVars = true [DEBUG] (f) useMavenProxy = false [DEBUG] (f) verbose = true [DEBUG] -- end configuration -- [INFO] (!) Get initial version of package repository before CVS operations [DEBUG] Initing console out and console err buffers [INFO] Detected predefined SDK root folder : /opt/go/go-1.8.1 [INFO] Executable file detected : /opt/go/go-1.8.1/bin/go [INFO] Prepared command line : bin/go get github.com/StackExchange/wmi [INFO] GoLang project sources folder : /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/src [INFO] [INFO] ....Environment vars.... [INFO] $GOROOT = /opt/go/go-1.8.1 [INFO] $GOPATH = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target/gopath:/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core [INFO] $GOBIN = /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target [INFO] $PATH = /opt/tools/maven/maven/bin:/usr/lib64/ruby/gems/2.1.0/gems/sass-3.4.23/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/go/go-1.8.1/bin:/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target [INFO] ........................ [DEBUG] Executing [/opt/go/go-1.8.1/bin/go, get, github.com/StackExchange/wmi] in /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/src with environment {GOROOT=/opt/go/go-1.8.1, GOPATH=/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target/gopath:/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core, GOBIN=/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target, PATH=/opt/tools/maven/maven/bin:/usr/lib64/ruby/gems/2.1.0/gems/sass-3.4.23/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/go/go-1.8.1/bin:/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target}. [DEBUG] Started java.lang.UNIXProcess@17f9b4cc [DEBUG] java.lang.UNIXProcess@17f9b4cc stopped with exit code 1 [ERROR] [ERROR] ---------Exec.Err--------- [ERROR] package github.com/StackExchange/wmi: no buildable Go source files in /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target/gopath/src/github.com/StackExchange/wmi [ERROR]
I'm not sure of the exact problem, but I think the env variable GOOS isn't getting set to "windows" (without the quotes). Can you double-check?
manage to get GOOS into command line, fail with diff error
[DEBUG] Executing [/opt/go/go-1.8.1/bin/go, get, github.com/StackExchange/wmi] in /space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/src with environment {GOROOT=/opt/go/go-1.8.1, GOPATH=/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target/gopath:/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core, GOBIN=/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target, GOOS=windows, GOARCH=amd64, PATH=/opt/tools/maven/maven/bin:/usr/lib64/ruby/gems/2.1.0/gems/sass-3.4.23/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/go/go-1.8.1/bin:/space/jenkins/skysandbox/workspace/ecdm-sandboxes/45/ecdm-sandbox/adm/adm-agent-core/target}. [DEBUG] Started java.lang.UNIXProcess@5375453b
[DEBUG] java.lang.UNIXProcess@5375453b stopped with exit code 1 [ERROR] [ERROR] ---------Exec.Err--------- [ERROR] go install runtime/internal/sys: mkdir /opt/go/go-1.8.1/pkg/windows_amd64: permission denied
not sure why Go try to create a dir under my Go installation
Progress!
I'm not sure why it would try to write to that directory either.
Some things I noticed that may or may not be relevant:
CC: @gbrayut / @kylebrandt
The go toolchain has to build the std library for the platform you are targeting. It writes those package binaries to $GOROOT/pkg.
You can do this ahead of time with env GOOS=windows GOARCH=amd64 go install -v std
once on the build agent.
@kavis, i can scale it down to a pom file
@captncraig it works
Thanks to all helping out
IT fails to build in linux. Can it be made buildable in linux as our jenkins environment is a linux environment? Although we understand its runnable only in windows. But it should be buildable in linux. Because the build environment cannot be always windows.