Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

bootstrap.sh misconfigures linker on Mavericks #1710

Closed
jhenahan opened this Issue · 6 comments

3 participants

@jhenahan

Using GHC 7.8-RC2: Gist

The issue is in the regex used to extract the name of the linker. In particular, when $link is interpolated in

echo 'main;' | ${CC} -v -x c - -o /dev/null -\#\#\# 2>&1 | grep ld | sed -e "s|\(.*$link\).*|\1|" -e 's/ //g' -e 's|"||'

the path gets cut off in unusual ways because it matches the text preceding the linker path up to /var/fold.

I'm not really sure of the best way to get around this. Maybe just trading out the regex for just asking for which $link.

@geoff-codes

@jhenahan Can you try out this patch for me? One step apply:

curl -Ls https://gist.github.com/anonymous/f09a505ea24924e608d6/raw | git apply -v
diff --git a/cabal-install/bootstrap.sh b/cabal-install/bootstrap.sh
index a03a777..a6aded5 100755
--- a/cabal-install/bootstrap.sh
+++ b/cabal-install/bootstrap.sh
@@ -29,2 +29,6 @@ DEFAULT_PREFIX="${HOME}/.cabal"

+# Try to respect $TMPDIR but override if needed - see #1710.
+[ -"$TMPDIR"- = -""- ] || echo "$TMPDIR" | grep -q ld &&
+  export TMPDIR="$(mktemp -d /tmp/cabal-$(date +%y-%m-%d-%H-%M-%S)-X)"
+
 # Check for a C compiler.
@@ -37,3 +41,4 @@ done
 # None found.
-[ ! -x `which "$CC"` ] &&
+# `command command -v` is ugly, but `which` is non-standard (see man 1 which).
+[ ! -x "$(command command -v "$CC")" ] &&
   die "C compiler not found (or could not be run).

If not, would you mind posting the output of sh -x bootstrap.sh (-x to echo silent commands)?

@jhenahan

One minor fix: you need at least three Xs in the template or mktemp chokes. Just adding another two on the end makes it work.

Now if I could just get the new Haddock to stop choking on <no location info>s I'd be golden! :laughing: Thanks for the quick fix.

@geoff-codes

Ugh. The issue you just pointed out - well it turns out mktemp [1] isn't standard at all.

What's your thought on:

export TMPDIR=/tmp/cabal-$(echo $(od -XN4 -An /dev/random)) && mkdir $TMPDIR

...?

@geoff-codes

Now if I could just get the new Haddock to stop choking on s I'd be golden! :laughing:

Yeah I know. Took me ~4 hours of rebuilds to finally build pandoc.
Definitely some, um, "growing pains" here.

Should be worth it though, I think —
I'm particularly looking forward to seeing what ghcjs can do.

@jhenahan

The TMPDIR version seems like it should work. Who'd have thought this'd be such a nuanced issue? Haha.

@geoff-codes geoff-codes referenced this issue from a commit in pullreq/cabal
@geoff-codes geoff-codes Fix for #1710. f5a44a9
@23Skidoo 23Skidoo closed this in #1711
@creswick

This fixed a symptom -- but it's still a problem. See #2542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.