Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot fetch Eigen with bazel: 406 Not Acceptable

When trying to download Eigen with

http_archive(
    name = "eigen",
    strip_prefix = "eigen-3.3.7",
    sha256 = "d56fbad95abf993f8af608484729e3d87ef611dd85b3380a8bad1d5cbc373a57",
    urls = [
        "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz"
    ],
    build_file = "//third_party:eigen.BUILD"
)

bazel fetch yields the error

WARNING: Download from https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 406 Not Acceptable
ERROR: An error occurred during the fetch of repository 'eigen':
   java.io.IOException: Error downloading [https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz]

I has been working for weeks so I am wondering if the problem comes from bazel or from the GitLab server?

like image 912
piarston Avatar asked Mar 26 '20 09:03

piarston


1 Answers

I have no real solution for your problem, but some fixes (tested with Bazel 2.2.0):

Fix 1: Make use of mirrors

Host eigen yourself

I use now my own webserver to host eigen:

http_archive(
    name = "eigen",
    build_file = "//:eigen.BUILD",
    sha256 = "d56fbad95abf993f8af608484729e3d87ef611dd85b3380a8bad1d5cbc373a57",
    strip_prefix = "eigen-3.3.7",
    url = "http://vertexwahn.de/artifacts/eigen-3.3.7.tar.gz",
)

You can also add both urls:

http_archive(
    name = "eigen",
    build_file = "//:eigen.BUILD",
    sha256 = "d56fbad95abf993f8af608484729e3d87ef611dd85b3380a8bad1d5cbc373a57",
    strip_prefix = "eigen-3.3.7",
    urls = [
        "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz",
        "http://vertexwahn.de/artifacts/eigen-3.3.7.tar.gz",
    ],
)

Fix 2: Hold a local copy

Make use of --distdir.

Put eigen-3.3.7.tar.gz in a directory on your machine and use --disdir.

bazel build --distdir=X:\Dropbox\artifacts //...

Summary

Since you want never to be blocked by a dumb webserver you should implement some strategies on how to continue working when something like this happens.

Nevertheless, it would be interesting to find out why this 406 happens. You can use also use a Network sniffer (e.g. Wireshark) to get probably more details we the get request fails. I tried to find out more using Wireshark, but its an https connection and everything is encrypted - too bad.

like image 52
Vertexwahn Avatar answered Oct 20 '22 05:10

Vertexwahn