From cd03b1409355781c6e098bd5befe717c872af5f4 Mon Sep 17 00:00:00 2001
From: Ian Denhardt <ian@zenhack.net>
Date: Tue, 4 Oct 2016 01:44:15 -0400
Subject: [PATCH] Fix musl-i686 CI failures.

* Override the compiler via CC; ./configure can't seem to detect it.
* Unset CROSS_COMPILE when running make. Per the comment, we otherwise
  end up invoking commands like i686-ar.
---
 ci/docker/i686-unknown-linux-musl/Dockerfile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ci/docker/i686-unknown-linux-musl/Dockerfile b/ci/docker/i686-unknown-linux-musl/Dockerfile
index e906ce35..b85a75c4 100644
--- a/ci/docker/i686-unknown-linux-musl/Dockerfile
+++ b/ci/docker/i686-unknown-linux-musl/Dockerfile
@@ -3,11 +3,19 @@ FROM ubuntu:16.10
 RUN apt-get update
 RUN apt-get install -y --no-install-recommends \
   gcc make libc6-dev git curl ca-certificates
+# Below we're cross-compiling musl for i686 using the system compiler on an
+# x86_64 system. This is an awkward thing to be doing and so we have to jump
+# through a couple hoops to get musl to be happy. In particular:
+#
+# * We specifically pass -m32 in CFLAGS and override CC when running ./configure,
+#   since otherwise the script will fail to find a compiler.
+# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
+#   will call the non-existent binary 'i686-ar'.
 RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
     tar xzf - && \
     cd musl-1.1.15 && \
-    CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
-    make install -j4 && \
+    CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
+    make CROSS_COMPILE= install -j4 && \
     cd .. && \
     rm -rf musl-1.1.15
 ENV PATH=$PATH:/musl-i686/bin:/rust/bin
-- 
GitLab