rules_go: bazel build failed on ppc64le

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

If asking a question or requesting a feature, also tell us about the underlying problem you’re trying to solve.

If possible, provide a minimal example to reproduce the problem:

Environment info

  • Operating System:
root@cit1046:~/go/src/istio.io/pilot# uname -a
Linux cit1046.rtp.raleigh.ibm.com 4.4.0-79-generic #100-Ubuntu SMP Wed May 17 19:56:58 UTC 2017 ppc64le ppc64le ppc64le GNU/Linux

BTW: I build bazel 0.5.4 myself for ppc64le.

  • Bazel version (output of bazel info release):
root@cit1046:~/go/src/istio.io/pilot# bazel version
Build label: 0.5.4- (@non-git)
Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Sep 26 04:10:02 2017 (1506399002)
Build timestamp: 1506399002
Build timestamp as int: 1506399002
  • If bazel info release returns “development version” or “(@non-git)”, please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):

Have you found anything relevant by searching the web?

(e.g. StackOverflow answers, GitHub issues, email threads on the bazel-discuss Google group)

Anything else, information or logs or outputs that would be helpful?

(If they are large, please upload as attachment or provide link).

  1. Get the istio pilot code.
git clone git@github.com:istio/pilot.git
  1. Build the source code with make setup
$ make setup
....
WARNING: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:196:9: pkg_tar: renaming non-dict `files` attribute to `srcs`.
ERROR: /root/go/src/istio.io/pilot/test/client/BUILD:3:1: no such package '@com_github_gorilla_websocket//': no such package '@io_bazel_rules_go_repository_tools//': failed to build gazelle: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: uE@p@8: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 2: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: @$: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: ELF: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: �: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: �: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: �{�{k�: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: �: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: L: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: �: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: G�{�: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: cannot open 0B�0BN
                                                   BHB�HBN�
                                                          Q���o@E�@ENH
                                                                      ^���o�E��ENP: No such file
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: -R: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 2: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go:F�FN�
                                     ��FNm4@H�@HN: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: JN: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 2: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: ���: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 4: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go:O�M��MN�: not found
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 4: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/exc��Nm���Nk: not foundamd64/bin/go: Y�����Np
/root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: 1: /root/.cache/bazel/_bazel_root/1745129434edd1c4aecf285cdde2d234/external/go1_8_3_linux_amd64/bin/go: Syntax error: Unterminated quoted string
 and referenced by '//test/client:go_default_library'.
ERROR: Analysis of target '//test/client:client' failed; build aborted.
INFO: Elapsed time: 55.074s
Makefile:19: recipe for target 'setup' failed
make: *** [setup] Error 1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 37 (27 by maintainers)

Commits related to this issue

Most upvoted comments

@clnperez I think “at that PR” was referring to #1145, which has since been merged. So nevermind that.

I was able to build a “hello” world binary using your WORKSPACE file.

hello.go

package main

func main() {
}

BUILD.bazel

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_prefix")

go_prefix("example.com/repo")

go_binary(
    name = "hello",
    srcs = ["hello.go"],
)
$ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_ppc64le //:hello
____Loading complete.  Analyzing...
____Loading package: @io_bazel_rules_go//go/private
____Loading package: @go_sdk//
____Loading package: @io_bazel_rules_go//go/platform
____Found 1 target...
____Building...
bazel: Entering directory `/usr/local/google/home/jayconrod/.cache/bazel/_bazel_jayconrod/533bcca7b8c77451fbaf7e2a9f7692b3/execroot/__main__/'
bazel: Leaving directory `/usr/local/google/home/jayconrod/.cache/bazel/_bazel_jayconrod/533bcca7b8c77451fbaf7e2a9f7692b3/execroot/__main__/'
____Building complete.
Target //:hello up-to-date:
  bazel-bin/hello
____Elapsed time: 17.100s, Critical Path: 3.25s

This was with Bazel 0.10.0 (latest version at this time). I also tried this with rules_go at head, and that worked, too.

Couple notes:

  • The command line you pasted didn’t include a target. I think that was the cause of the error.
  • --experimental_platforms can now be replaced with --platforms.
  • I used go_prefix in my build file, since this was with an older version of rules_go. However, that’s not needed with newer versions.

@clnperez The instructions I posted earlier today were for a ppc64le host and ppc64le target. The instructions I posted earlier with the --experimental_platforms flag were for a ppc64le target from a host platform that can be auto-detected (linux, darwin, or windows on amd64, or linux on s390x).

The cross compilation instructions will work for pure Go builds. You shouldn’t need to set --cpu for that. However, if you have cgo code or if you depend on C/C++ libraries, you will also need a C/C++ toolchain that can target ppc64le, and you’ll need to write a CROSSTOOL file and point to it with --crosstool_top.

I don’t believe there is anything like that which currently works with Bazel, and I don’t think rules_go will work at the moment in that configuration. We are working on improving it, but that’s the state of things.