Go error while cross compiling Kubernetes - go

I have been trying to cross-compile K8s running ./hack/build-cross.sh. I am getting this error, while building targets for arm64:
Go version: go version go1.6.2 linux/amd64
+++ [0701 13:27:22] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
+++ [0701 13:27:22] Building go targets for linux/arm64:
cmd/kube-dns
cmd/kube-proxy
cmd/kube-apiserver
cmd/kube-controller-manager
cmd/kubelet
cmd/kubemark
cmd/hyperkube
federation/cmd/federation-apiserver
federation/cmd/federation-controller-manager
plugin/cmd/kube-scheduler
# runtime/cgo
/usr/local/go/src/runtime/cgo/cgo.go:54:19: fatal error: errno.h: No such file or directory
compilation terminated.
!!! Error in /home/peeyush/work/kubernetes/hack/lib/golang.sh:500
'go install "${goflags[#]:+${goflags[#]}}" -ldflags "${goldflags}" "${nonstatics[#]:+${nonstatics[#]}}"' exited with status 2
Call stack:
1: /home/peeyush/work/kubernetes/hack/lib/golang.sh:500 kube::golang::build_binaries_for_platform(...)
2: /home/peeyush/work/kubernetes/hack/lib/golang.sh:669 kube::golang::build_binaries(...)
3: ./hack/build-cross.sh:28 main(...)
Exiting with status 1
!!! Error in /home/peeyush/work/kubernetes/hack/lib/golang.sh:586
'( kube::golang::setup_env; echo "Go version: $(go version)"; local host_platform; host_platform=$(kube::golang::host_platform); local goflags goldflags; eval "goflags=(${KUBE_GOFLAGS:-})"; goldflags="${KUBE_GOLDFLAGS:-} $(kube::version::ldflags)"; local use_go_build; local -a targets=(); local arg; for arg in "$#";
do
if [[ "${arg}" == "--use_go_build" ]]; then
use_go_build=true;
else
if [[ "${arg}" == -* ]]; then
goflags+=("${arg}");
else
targets+=("${arg}");
fi;
fi;
done; if [[ ${#targets[#]} -eq 0 ]]; then
targets=("${KUBE_ALL_TARGETS[#]}");
fi; local -a platforms=("${KUBE_BUILD_PLATFORMS[#]:+${KUBE_BUILD_PLATFORMS[#]}}"); if [[ ${#platforms[#]} -eq 0 ]]; then
platforms=("${host_platform}");
fi; local binaries; binaries=($(kube::golang::binaries_from_targets "${targets[#]}")); local parallel=false; if [[ ${#platforms[#]} -gt 1 ]]; then
local gigs; gigs=$(kube::golang::get_physmem); if [[ ${gigs} -ge ${KUBE_PARALLEL_BUILD_MEMORY} ]]; then
kube::log::status "Multiple platforms requested and available ${gigs}G >= threshold ${KUBE_PARALLEL_BUILD_MEMORY}G, building platforms in parallel"; parallel=true;
else
kube::log::status "Multiple platforms requested, but available ${gigs}G < threshold ${KUBE_PARALLEL_BUILD_MEMORY}G, building platforms in serial"; parallel=false;
fi;
fi; kube::golang::build_kube_toolchain; if [[ "${parallel}" == "true" ]]; then
kube::log::status "Building go targets for ${platforms[#]} in parallel (output will appear in a burst when complete):" "${targets[#]}"; local platform; for platform in "${platforms[#]}";
do
( kube::golang::set_platform_envs "${platform}"; kube::log::status "${platform}: go build started"; kube::golang::build_binaries_for_platform ${platform} ${use_go_build:-}; kube::log::status "${platform}: go build finished" ) &> "/tmp//${platform//\//_}.build" &
done; local fails=0; for job in $(jobs -p);
do
wait ${job} || let "fails+=1";
done; for platform in "${platforms[#]}";
do
cat "/tmp//${platform//\//_}.build";
done; exit ${fails};
else
for platform in "${platforms[#]}";
do
kube::log::status "Building go targets for ${platform}:" "${targets[#]}"; kube::golang::set_platform_envs "${platform}"; kube::golang::build_binaries_for_platform ${platform} ${use_go_build:-};
done;
fi )' exited with status 1
Call stack:
1: /home/peeyush/work/kubernetes/hack/lib/golang.sh:586 kube::golang::build_binaries(...)
2: ./hack/build-cross.sh:28 main(...)
Exiting with status 1
Any idea what could be causing this error? error.h is there on my system:
find / -name "errno.h"
/usr/arm-none-eabi/include/sys/errno.h
/usr/arm-none-eabi/include/errno.h
/usr/src/kernels/4.1.13-100.fc21.x86_64+debug/include/uapi/asm-generic/errno.h
/usr/src/kernels/4.1.13-100.fc21.x86_64+debug/include/uapi/linux/errno.h
/usr/src/kernels/4.1.13-100.fc21.x86_64+debug/include/linux/errno.h
/usr/src/kernels/4.1.13-100.fc21.x86_64+debug/arch/x86/include/uapi/asm/errno.h
/usr/include/asm/errno.h
/usr/include/sys/errno.h
/usr/include/bits/errno.h
/usr/include/errno.h
/usr/include/asm-generic/errno.h
/usr/include/linux/errno.h
Not sure what exactly is the issue, can anyone please help me with it?
I am using following arm packages:
rpm -aq | grep arm
arm-none-eabi-gcc-cs-c++-5.2.0-2.fc21.x86_64
gcc-arm-linux-gnu-4.9.2-5.fc21.x86_64
arm-none-eabi-newlib-2.2.0_1-6.fc21.noarch
binutils-arm-linux-gnu-2.25-4.fc21.x86_64
arm-none-eabi-binutils-cs-2014.05.28-3.fc21.x86_64
gucharmap-3.14.2-1.fc21.x86_64
arm-none-eabi-gcc-cs-5.2.0-2.fc21.x86_64
hdparm-9.48-1.fc21.x86_64
TIA.

Related

How can I declare global variables and have a main loop like i can have in C?

I know there is GNU make utility or Cmake(what I use usually). But I am learning dash/posix shell and I want to write a simple script to compile and build my solution. This is what I have so far.
#!/bin/sh
#THIS BUILD SOLUTION SHOULD WORK ANY PROGRAMMING SOLUTION AS LONG AS IT CONFORMS THE SAME FOLDER STRUCTURE
#THIS BUILD SOLUTION WILL ONLY WORK IN ANY POSIX CONFORMING SHELL
#THIS SOLUTION IS IDEAL FOR VERY SMALL PROGRAMS
PROGRAM_NAME="count_vowels"
SOURCE_DIR="src"
files_timestamp="files_timestamp.txt"
compile() {
for file in $SOURCE_DIR/*.c; do
files="${files:=$files} $file"
done
gcc -ggdb3 -std=c17 $files -Wall -o $1 && echo "An executable $1 has been created" || echo "Failed to complie!!!"
unset file files
return 0
}
compile_with_msg() {
CURRENT_MOD_TIME="$( stat -c %Z $SOURCE_DIR $SOURCE_DIR/headers $SOURCE_DIR/*.c $SOURCE_DIR/headers/*.h )"
echo "$CURRENT_MOD_TIME" > $files_timestamp
echo "Timestamps of files attempting to complie: \n$CURRENT_MOD_TIME\n"
echo "Compiling and linking files..."
compile $PROGRAM_NAME
return 0
}
compile_with_msg_changes(){
echo "Changes in source files detected"
rm $PROGRAM_NAME $files_timestamp && echo "Deleted existing $PROGRAM_NAME executable"
compile_with_msg
return 0
}
build() {
[ ! -d $SOURCE_DIR ] && echo "Cannot find the source directory\nPlease open the build scipt in an editor and check if the source directory information is correct" && return 2
if [ ! -f $PROGRAM_NAME ]; then
[ -f $files_timestamp ] && rm $files_timestamp && echo "Error: $PROGRAM_NAME does not exist but $files_timestamp from last compilation exists\nRemoved $files_timestamp" && return 1
compile_with_msg
else
[ ! -f $files_timestamp ] && rm "$PROGRAM_NAME" && echo "Error: $files_timestamp not found\nDeleted $PROGRAM_NAME" && return 1
CURRENT_MOD_TIME="$( stat -c %Z $SOURCE_DIR $SOURCE_DIR/headers $SOURCE_DIR/*.c $SOURCE_DIR/headers/*.h )"
LAST_MOD_TIME="$( cat $files_timestamp )"
[ "$CURRENT_MOD_TIME" = "$LAST_MOD_TIME" ] && echo "$PROGRAM_NAME is up to date" || compile_with_msg_changes
fi
return 0
}
main() {
err_check=1
while [ "$err_check" -eq 1 ]; do
build
err_check=$?
done
return 0
}
main
Problem is I do not know how I can set a global variable and main fucntion in dash shell.
LAST_MOD_TIME has to be global for it to work and not get updated outside the scope of the build fucntion which is my main function.
Update: this code worked for me. thanks

How to convert systemv startup scripts to systemd services?

Advice on converting SysVinit file to Systemd services will be helpful.
Currently, I am using a systemv init script which will be executed after every boot on my STM32MP1 based Avenger96 board. Now I have to switch to Systemd from SysVinit. But I am not sure how to convert the init file to relevant systemd files. I am using Yocto with Ubuntu20.04 as build system. If someone help me to get started would be really great. Below is the init script and image recipe which establishes symlink to the init script.
custom-script.sh which is installed in etc/init.d/ directory of the rootfs.
#!/bin/sh
DAEMON="swupdate"
PIDFILE="/var/run/$DAEMON.pid"
PART_STATUS=$(sgdisk -A 4:get:2 /dev/mmcblk0)
if test "${PART_STATUS}" = "4:2:1" ; then
ROOTFS=rootfs-2
else
ROOTFS=rootfs-1
fi
if test -f /update-ok ; then
SURICATTA_ARGS="-c 2"
rm -f /update-ok
fi
start() {
printf 'Starting %s: ' "$DAEMON"
# shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -b -q -m -S -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
-- -f /etc/swupdate/swupdate.cfg -L -e rootfs,${ROOTFS} -u "${SURICATTA_ARGS}"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf 'Stopping %s: ' "$DAEMON"
start-stop-daemon -K -q -p "$PIDFILE"
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
Image recipe which creates init.d dir and installs above script and also establishes symlink to rc4.d dir.
custom-image.bb
.
.
inherit update-rc.d
SRC_URI = "file://custom-script.sh \
"
S = "${WORKDIR}"
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME = "custom-script.sh"
INITSCRIPT_PARAMS = "start 99 2 3 4 5 . "
do_install_append() {
install -d ${D}${sysconfdir}/rc4.d
install -d 644 ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/custom-script.sh ${D}${sysconfdir}/init.d
ln -sf ../init.d/custom-script.sh ${D}${sysconfdir}/rc4.d/S99custom-script.sh
ln -sf ../init.d/custom-script.sh ${D}${sysconfdir}/rc4.d/K99custom-script.sh
}
FILES_${PN} += "${sysconfdir}/init.d"
Now I am trying to do the same functionality of custom-script.sh with systemd. Is it possible to make use of systemd-sysv-generator in this case?
Also, will the dir init.d completely removed once we switch to "systemd"? What will happen to other files which are present in etc/init.d?
Can anyone please help me get started?
Your help will be much appreciated.
Thanks in advance.
P.S: Please let me know if any info is missing here.
/etc/init.d will not get deleted by using systemd
Have you checked /etc/systemd and /usr/lib/systemd on your Ubuntu machine for examples of systemd scripts. Along the manual pages of systemd, you should have enough examples to convert your sysv init script to systemd.

graceful stop inotifywait pipeline inside a bash script

I am using a docker to watch and sync data in a folder with inotify and aws-cli but when I try to kill the docker with SIGTERM it exit with code 143 but I want to get a zero exit code. And if i kill the inotify process inside the docker it do return a zero code.
So how can I kill the entrypoint.sh with TERM signal and return a 0 code?
The docker is here. I put the bash script below:
#!/usr/bin/env bash
# S3Sync Entry Point
# Bash strict mode
set -euo pipefail
IFS=$'\n\t'
# VARs
S3PATH=${S3PATH:-}
SYNCDIR="${SYNCDIR:-/sync}"
CRON_TIME="${CRON_TIME:-10 * * * *}"
INITIAL_DOWNLOAD="${INITIAL_DOWNLOAD:-true}"
# Log message
log(){
echo "[$(date "+%Y-%m-%dT%H:%M:%S%z") - $(hostname)] ${*}"
}
# Sync files
sync_files(){
local src="${1:-}"
local dst="${2:-}"
mkdir -p "$dst" # Make sure directory exists
log "Sync '${src}' to '${dst}'"
if ! aws s3 sync --no-progress --delete --exact-timestamps "$src" "$dst"; then
log "Could not sync '${src}' to '${dst}'" >&2; exit 1
fi
}
# Download files
download_files(){
sync_files "$S3PATH" "$SYNCDIR"
}
# Upload files
upload_files(){
sync_files "$SYNCDIR" "$S3PATH"
}
# Run initial download
initial_download(){
if [[ "$INITIAL_DOWNLOAD" == 'true' ]]; then
if [[ -d "$SYNCDIR" ]]; then
# directory exists
if [[ $(ls -A "$SYNCDIR" 2>/dev/null) ]]; then
# directory is not empty
log "${SYNCDIR} is not empty; skipping initial download"
else
# directory is empty
download_files
fi
else
# directory does not exist
download_files
fi
elif [[ "$INITIAL_DOWNLOAD" == 'force' ]]; then
download_files
fi
}
# Watch directory using inotify
watch_directory(){
initial_download # Run initial download
log "Watching directory '${SYNCDIR}' for changes"
inotifywait \
--event create \
--event delete \
--event modify \
--event move \
--format "%e %w%f" \
--monitor \
--quiet \
--recursive \
"$SYNCDIR" |
while read -r changed
do
log "$changed"
upload_files
done
}
# Install cron job
run_cron(){
local action="${1:-upload}"
# Run initial download
initial_download
log "Setup the cron job (${CRON_TIME})"
echo "${CRON_TIME} /entrypoint.sh ${action}" > /etc/crontabs/root
exec crond -f -l 6
}
# Main function
main(){
if [[ ! "$S3PATH" =~ s3:// ]]; then
log 'No S3PATH specified' >&2; exit 1
fi
mkdir -p "$SYNCDIR" # Make sure directory exists
# Parse command line arguments
cmd="${1:-download}"
case "$cmd" in
download)
download_files
;;
upload)
upload_files
;;
sync)
watch_directory
;;
periodic_upload)
run_cron upload
;;
periodic_download)
run_cron download
;;
*)
log "Unknown command: ${cmd}"; exit 1
;;
esac
}
main "$#"
Trying trap like this but failed:
trap "exit" INT TERM
trap "kill 0" EXIT
Answered by the contributor of the docker image.
https://github.com/vladgh/docker_base_images/issues/62
This image uses Tini, which does not make any assumptions about the meaning of the signal it receives and simply forwards it to its child.
In order for your traps to work you need to add the -g flag to Tini in the Dockerfile (krallin/tini#process-group-killing):
ENTRYPOINT ["/sbin/tini", "-g", "--", "/entrypoint.sh"]
An only then you can set a trap at the top of the entrypoint.sh:
trap "exit 0" INT TERM EXIT

Shell if else fi syntax error while actual syntax seems correct

So I have a shell script that contains a big if/fi block, and it was working fine until I decided to place an else case for this big if/fi block. Now I am getting this error:
/root/VVPN/Scripts/scriptPrincipal.sh: line 201: syntax error near unexpected token `else'
/root/VVPN/Scripts/scriptPrincipal.sh: line 201: `else'
I went through 8~10 stackoverflow posts where people had exactly the same error, except that all of them were simple syntax errors like a missing space after the [ of the if statement, or a : instead of a ; before the then keyword, or an else intended for an if that was already closed with a fi, etc... (you get the idea :p).
However I've checked my code for all these errors over and over and everything seems to be correct when it comes to if/else/fi syntax. I even showed the code to some colleagues and they too couldn't find the reason for this error.
Here's the code:
if [ ${CP} != "continue" ]
then
echo 'Downloading the necessary files from the server...'
# If folder F*** doesn't exist in /root/VVPN/Numbers
if [ ! -d ${N} ]
then
# Create folders F***, and F***/Results
mkdir ${N}
mkdir ${N}/Results
cd ${N}
# Get real number to factorize from server (e.g: wget server.com:8000/route/to/F1067/F1067)
ROUTE="VVPN/Numbers/${N}/${N}"
REAL_NUM_FILENAME=${N}
while true
do
wget --retry-connrefused --tries=inf -q ${SERVER}/${ROUTE} -O ${REAL_NUM_FILENAME} --continue
if [ $? -eq 0 ]; then
break
fi
sleep 1
done
# Get ECM-Program tuned for this number from server (e.g: wget server.com:8000/route/to/F1067/ecm)
ROUTE="VVPN/Numbers/${N}/ecm"
PROGRAM_NAME='ecm'
while true
do
wget --retry-connrefused --tries=inf -q ${SERVER}/${ROUTE} -O ${PROGRAM_NAME} --continue
if [ $? = 0 ]; then
break
fi
sleep 1
done
else
# The folder already exists, now we have to check whether the number has ",c" label or not
cd ${N}
fi
# Give the permission to execute program
chmod +x ecm
# Make 6 directories, one for each SPE
for i in {1..6}
do
mkdir "SPE${i}"
cp ecm "SPE${i}/"
done
# if there is no checkpoints:
if [ $CP = $N ]
then
# Get currentSigma for this number from server (e.g : wget server.com:8000/rout/to/F1067/currentSigma.txt)
ROUTE="VVPN/Numbers/${N}/currentSigma"
REAL_FILE_NAME='sigma'
while true
do
wget --retry-connrefused --tries=inf -q ${SERVER}/${ROUTE} -O ${REAL_FILE_NAME} --continue
if [ $? = 0 ]; then
break
fi
sleep 1
done
else
#The number has a ",c" label (= w/ checkpoint)
# Get i (server sigma) and C (current job counter) from the server (e.g: wget server.com:8000/route/to/F1067/icy)
ROUTE="icy?number=${N}"
SIGMA_C_Y='icy'
while true
do
wget --retry-connrefused --tries=inf -q ${SERVER}/${ROUTE} -O ${SIGMA_C_Y} --continue
if [ $? = 0 ]; then
break
fi
sleep 1
done
i=$(cat ${SIGMA_C_Y} | cut -d "," -f1)
C=$(cat ${SIGMA_C_Y} | cut -d "," -f2)
Y=$(cat ${SIGMA_C_Y} | cut -d "," -f3)
echo $i > sigma
echo $C > /root/VVPN/Scripts/C
# Get the checkpoints from the server
ROUTE="VVPN/Numbers/${N}/CP/${i},${C},${Y}"
for speNum in {1..6}
do
SPE="SPE${speNum}"
touch $SPE/again
for bigX in {0..3}
do
CHECKPOINT="pointsCurve${bigX}.${Y}"
while true
do
wget --retry-connrefused --tries=inf -q ${SERVER}/${ROUTE}/${SPE}/${CHECKPOINT} -O ${CHECKPOINT} --continue
if [ $? = 0 ]; then
mv $CHECKPOINT $SPE
break
fi
sleep 1
done
done
done
fi
cd ..
else
echo "Found ${N}'s folder on this PS3"
fi
So the else mentioned in the error (at line 201) is actually the last else in the code. The script works fine without this else and the echo that comes right after.
Any help would be much appreciated :)
Could you change if [ $CP = $N ] as below;
if [ "$CP" == "$N" ]
This is not if else problem; For example; if you run the following code, output is same. So You should focus other commands inside if statement.
CP="continue1"
if [ ${CP} != "continue" ]
then
while #this is wrong
echo ok
echo ok
echo ok
else
fi
./test.sh: line 8: syntax error near unexpected token `else'
./test.sh: line 8: `else'

Kubernetes install on local Mesos clusters

I have set up a Mesos cluster on my Mac using Vagrant (Ubuntu instances) and now I am trying to install Kubernetes following the instructions on the link below
Kubernetes
But I keep getting a *** [all] Error 1 when I run make. Looking at the output I see several errors but I am not sure what I am missing. I have ran make using sudo but nothing seems to work. Below is the output:
vagrant#master1:~/kubernetes$ make
hack/build-go.sh
+++ [0731 15:52:26] Building go targets for linux/amd64:
cmd/kube-proxy
cmd/kube-apiserver
cmd/kube-controller-manager
cmd/kubelet
cmd/hyperkube
cmd/kubernetes
cmd/linkcheck
plugin/cmd/kube-scheduler
cmd/kubectl
cmd/integration
cmd/gendocs
cmd/genman
cmd/mungedocs
cmd/genbashcomp
cmd/genconversion
cmd/gendeepcopy
examples/k8petstore/web-server
github.com/onsi/ginkgo/ginkgo
test/e2e/e2e.test
+++ [0731 15:52:26] +++ Warning: stdlib pkg with cgo flag not found.
+++ [0731 15:52:26] +++ Warning: stdlib pkg cannot be rebuilt since /usr/lib/go/pkg is not writable by vagrant
+++ [0731 15:52:26] +++ Warning: Make /usr/lib/go/pkg writable for vagrant for a one-time stdlib install, Or
+++ [0731 15:52:26] +++ Warning: Rebuild stdlib using the command 'CGO_ENABLED=0 go install -a -installsuffix cgo std'
+++ [0731 15:52:26] +++ Falling back to go build, which is slower
# github.com/prometheus/client_golang/model
Godeps/_workspace/src/github.com/prometheus/client_golang/model/signature.go:32: undefined: sync.Pool
# github.com/GoogleCloudPlatform/kubernetes/pkg/probe/http
_output/local/go/src/github.com/GoogleCloudPlatform/kubernetes/pkg/probe/http/http.go:47: unknown http.Client field 'Timeout' in struct literal
# github.com/ugorji/go/codec
Godeps/_workspace/src/github.com/ugorji/go/codec/encode.go:533: undefined: sync.Pool
Godeps/_workspace/src/github.com/ugorji/go/codec/encode.go:1219: undefined: sync.Pool
# github.com/mesos/mesos-go/detector
Godeps/_workspace/src/github.com/mesos/mesos-go/detector/standalone.go:73: unknown http.Client field 'Timeout' in struct literal
go build github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/swagger: signal: killed
# github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/pools
Godeps/_workspace/src/github.com/fsouza/go-dockerclient/vendor/github.com/docker/docker/pkg/pools/pools.go:30: undefined: sync.Pool
!!! Error in /home/vagrant/kubernetes/hack/lib/golang.sh:371
'CGO_ENABLED=0 go build -o "${outfile}" "${goflags[#]:+${goflags[#]}}" -ldflags "${version_ldflags}" "${binary}"' exited with status 2
Call stack:
1: /home/vagrant/kubernetes/hack/lib/golang.sh:371 kube::golang::build_binaries_for_platform(...)
2: /home/vagrant/kubernetes/hack/lib/golang.sh:527 kube::golang::build_binaries(...)
3: hack/build-go.sh:26 main(...)
Exiting with status 1
!!! Error in /home/vagrant/kubernetes/hack/lib/golang.sh:445
'( kube::golang::setup_env; local version_ldflags; version_ldflags=$(kube::version::ldflags); local host_platform; host_platform=$(kube::golang::host_platform); local goflags; eval "goflags=(${KUBE_GOFLAGS:-})"; local use_go_build; local -a targets=(); local arg; for arg in "$#";
do
if [[ "${arg}" == "--use_go_build" ]]; then
use_go_build=true;
else
if [[ "${arg}" == -* ]]; then
goflags+=("${arg}");
else
targets+=("${arg}");
fi;
fi;
done; if [[ ${#targets[#]} -eq 0 ]]; then
targets=("${KUBE_ALL_TARGETS[#]}");
fi; local -a platforms=("${KUBE_BUILD_PLATFORMS[#]:+${KUBE_BUILD_PLATFORMS[#]}}"); if [[ ${#platforms[#]} -eq 0 ]]; then
platforms=("${host_platform}");
fi; local binaries; binaries=($(kube::golang::binaries_from_targets "${targets[#]}")); local parallel=false; if [[ ${#platforms[#]} -gt 1 ]]; then
local gigs; gigs=$(kube::golang::get_physmem); if [[ ${gigs} -ge ${KUBE_PARALLEL_BUILD_MEMORY} ]]; then
kube::log::status "Multiple platforms requested and available ${gigs}G >= threshold ${KUBE_PARALLEL_BUILD_MEMORY}G, building platforms in parallel"; parallel=true;
else
kube::log::status "Multiple platforms requested, but available ${gigs}G < threshold ${KUBE_PARALLEL_BUILD_MEMORY}G, building platforms in serial"; parallel=false;
fi;
fi; if [[ "${parallel}" == "true" ]]; then
kube::log::status "Building go targets for ${platforms[#]} in parallel (output will appear in a burst when complete):" "${targets[#]}"; local platform; for platform in "${platforms[#]}";
do
( kube::golang::set_platform_envs "${platform}"; kube::log::status "${platform}: go build started"; kube::golang::build_binaries_for_platform ${platform} ${use_go_build:-}; kube::log::status "${platform}: go build finished" ) &> "/tmp//${platform//\//_}.build" &
done; local fails=0; for job in $(jobs -p);
do
wait ${job} || let "fails+=1";
done; for platform in "${platforms[#]}";
do
cat "/tmp//${platform//\//_}.build";
done; exit ${fails};
else
for platform in "${platforms[#]}";
do
kube::log::status "Building go targets for ${platform}:" "${targets[#]}"; kube::golang::set_platform_envs "${platform}"; kube::golang::build_binaries_for_platform ${platform} ${use_go_build:-};
done;
fi )' exited with status 1
Call stack:
1: /home/vagrant/kubernetes/hack/lib/golang.sh:445 kube::golang::build_binaries(...)
2: hack/build-go.sh:26 main(...)
Exiting with status 1
make: *** [all] Error 1
It seems like you have an older version of Go installed in the Ubuntu guest. Update Go to 1.4.2 and try again.

Resources