Search code examples
javamacosbazelzlibfilenotfoundexception

Dependency uses outdated URL


I'm trying to clone and build a GitHub repo using Bazel, but a dependency requires an old verson of zlib via an outdated URL. I've already spent a few hours trying to do things like messing with the /etc/hosts file and running a web server to get it to work. I've gotten zlib.net to point to localhost, then running a web server on localhost:80 with zlib at the correct path, but that's not working, since the request is timing out.

I've googled it and only about 3 remotely relevant results have popped up, none of which are helpful.

How do I get it to build?

This is the error:

Error in download_and_extract: java.io.IOException: Error downloading [https://zlib.net/zlib-1.2.11.tar.gz] to /private/var/tmp/_bazel_user/37df51594c7eac8a62dd677a22c5514b/external/zlib/temp16216011345324291299/zlib-1.2.11.tar.gz: GET returned 404 Not Found

Solution

  • It is timing out because the request uses HTTPS, which is port 443, not HTTP on port 80. You can use a similar approach to what you are doing (with the hosts file) but just run a HTTPS server on port 443.

    This can be achieved using tools such as ngrok and your current localhost web server.