--- configure.ac.orig	2018-04-02 20:38:43.000000000 -0700
+++ configure.ac	2018-05-02 05:48:45.000000000 -0700
@@ -95,8 +95,8 @@
 then
     CARGO_TARGET_ARGS=""
     CARGO_RUSTC_ARGS="$CARGO_RUSTC_ARGS"
-    CARGO_TARGET_SUBDIR="$CARGO_TARGET_SUBDIR"
-    CARGO_TARGET_SUBDIR_ENV_VAR=
+    CARGO_TARGET_SUBDIR="$CARGO_BUILD_TARGET/$CARGO_TARGET_SUBDIR"
+    CARGO_TARGET_SUBDIR_ENV_VAR="CARGO_TARGET_SUBDIR=$CARGO_TARGET_SUBDIR"
 else
     CARGO_TARGET_ARGS="--target $RUST_HOST"
     CARGO_RUSTC_ARGS="$CARGO_RUSTC_ARGS -C linker=$CC"
