在交叉编译Kubernetes时出错

时间:2016-07-01 08:01:43

标签: go arm kubernetes cgo

我一直在尝试交叉编译运行./hack/build-cross.sh的K8。我在为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

知道可能导致此错误的原因是什么?我的系统上有error.h:

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

不确定究竟是什么问题,有人可以帮助我吗?

我正在使用以下手臂套装:

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。

0 个答案:

没有答案