I can't post links, so {mirror url} = any of the mirror URLs

I'm trying to set up the toolchain for cross compiling as per wiki dot openwrt dot org /doc/howto/build .

$ make download
 make[1] tools/flock/compile
 make[2] -C tools/flock compile
 make[1] tools/download
 make[2] -C tools/gmp download
make tools/download: build failed. Please re-run make with -j1 V=s to see what's going on

Then

$ make -j1 V=s download
make[1]: Entering directory `/Volumes/OpenWrt/openwrt'
make[2]: Entering directory `/Volumes/OpenWrt/openwrt/tools/gmp'
mkdir -p /Volumes/OpenWrt/openwrt/dl
SHELL= flock /Volumes/OpenWrt/openwrt/tmp/.gmp-6.1.2.tar.xz.flock -c '      /Volumes/OpenWrt/openwrt/scripts/download.pl "/Volumes/OpenWrt/openwrt/dl" "gmp-6.1.2.tar.xz" "87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912" "" "@GNU/gmp/"    '
+ curl -f --connect-timeout 20 --retry 5 --location --insecure {mirror url}
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1900k  100 1900k    0     0   962k      0  0:00:01  0:00:01 --:--:--  961k
Hash of the downloaded file does not match (file: 1d8142cf9a7d4fe1b9f6f6cf076031a6ee236266042c7d519c7457a29632c53d, requested: 87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912) - deleting download.

This happens for every mirror of that file.  If I let the download continue, it starts happening on other files as well.  I've downloaded the file in question - gmp-6.1.2.tar.xz through Chrome, and its sha256 matches what

make download

is expecting.  However when I use curl, the file is 1 byte larger, and when I run cmp to compare the files:

$ curl -f --connect-timeout 20 --retry 5 --location --insecure {mirror url} > tools/gmp/gmp-6.1.2.tar.xz
$ cmp ~/Downloads/gmp-6.1.2.tar.xz tools/gmp/gmp-6.1.2.tar.xz
cmp: EOF on /Users/garth/Downloads/gmp-6.1.2.tar.xz after byte 1946336, in line 7629

If I try running just

make

it errors out as well, and running verbose shows me that it's failing with the same issue downloading sed.

I'm not sure how to proceed at this point, short of manually downloading every file via Chrome - but that seems like a non-starter.  Any ideas?

UPDATE: I found that if I use the --output switch on curl and specify a filename (rather than piping curl output to a file), the file ends up being the right size with the right checksum.  I tried changing this line in download.pl:

? (qw(curl -f --connect-timeout 20 --retry 5 --location --insecure), shellwords($ENV{CURL_OPTIONS} || ''), $url)

to

? (qw(curl -f --connect-timeout 20 --retry 5 --location --insecure --output), $filename, shellwords($ENV{CURL_OPTIONS} || ''), $url)

but it appears that there's a temporary file being generated (by "flock"?), so the file written via the --output switch isn't what's being checksumed.  So I'm still stuck.

(Last edited by garth on 22 Feb 2018, 14:35)