Find the target gcc when cross-compiling

Authored by rwbarton on Sep 9 2014, 10:51 PM.



"./configure --target=TARGET" was broken; it would use the host gcc.
(So you had to explicitly specify "--with-gcc=TARGET-gcc" also,
as a workaround.)

This was broken by commit fc4856f9e811d9a23ae9212f43a09ddf5ef12b26
for Trac #8148. A comment claimed that FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL
was the same as FP_ARG_WITH_PATH_GNU_PROG except for not raising
an error when the program isn't found; but that wasn't true --
the former didn't prepend the target name when cross-compiling.

We actually need three versions of FP_ARG_WITH_PATH_GNU_PROG since
the LLVM tools are usually not prefixed with the target name even
when cross-compiling. So I generalized the logic in a single macro.

Test Plan

Built with "./configure --target=i386-unknown-linux"
and BuildFlavour=quick, successfully

Diff Detail

rGHC Glasgow Haskell Compiler
Lint Skipped
Unit Tests Skipped
rwbarton updated this revision to Diff 518.Sep 9 2014, 10:51 PM
rwbarton retitled this revision from to Find the target gcc when cross-compiling.
rwbarton updated this object.
rwbarton edited the test plan for this revision. (Show Details)

make test on the resulting compiler produced fewer than 100 failures, so I assume this is normal AMP-related fallout :)

Unexpected results from:
TEST="T1372 joao-circular cabal01 cabal03 T7891 tc124 cabal05 cabal06 ghcilink003 ghcilink006 plugins01 plugins03 plugins02 T8628 T8639_api T1735 T3500b T5751 T7702 T5321FD T5030 T4801 T6048 T5631 T783 T5642 T9020 T3064 parsing001 T1969 T5321Fun T5837 T3294 ImpSafeOnly08 safePkg01 ImpSafeOnly02 ImpSafeOnly10 ImpSafeOnly01 ImpSafeOnly06 ImpSafeOnly07 ImpSafeOnly04 ImpSafeOnly05 ImpSafeOnly09 T9203 recomp007 conc012 bug1465 cabal04 T3007 T7653 num009"

OVERALL SUMMARY for test run started at Tue Sep  9 23:36:36 2014 EDT
 0:39:03 spent to go through
    4073 total tests, which gave rise to
   15858 test cases, of which
    3407 were skipped

     300 had missing libraries
   11922 expected passes
     141 expected failures

      19 caused framework failures
       0 unexpected passes
      85 unexpected failures

Unexpected failures:
   ../../libraries/base/tests          T7653 [bad exit code] (ghci,threaded1,threaded2)
   ../../libraries/base/tests/Numeric  num009 [bad stdout] (normal,hpc,optasm,threaded1,threaded2,dyn,optllvm)
   ../../libraries/base/tests/Numeric  num009 [bad stdout or stderr] (ghci)
   cabal/cabal01                       cabal01 [bad exit code] (normal)
   cabal/cabal03                       cabal03 [bad exit code] (normal)
   cabal/cabal04                       cabal04 [bad exit code] (normal)
   cabal/cabal05                       cabal05 [bad exit code] (normal)
   cabal/cabal06                       cabal06 [bad exit code] (normal)
   concurrent/should_run               conc012 [bad exit code] (ghci)
   driver/T1372                        T1372 [bad exit code] (normal)
   driver/T3007                        T3007 [bad exit code] (normal)
   driver/recomp007                    recomp007 [bad exit code] (normal)
   ghc-api                             T8628 [bad stdout] (normal)
   ghc-api                             T8639_api [bad stdout] (normal)
   ghci/linking                        ghcilink003 [bad exit code] (normal)
   ghci/linking                        ghcilink006 [bad exit code] (normal)
   perf/compiler                       T1969 [stat not good enough] (normal)
   perf/compiler                       T3064 [stat not good enough] (normal)
   perf/compiler                       T3294 [stat not good enough] (normal)
   perf/compiler                       T4801 [stat not good enough] (normal)
   perf/compiler                       T5030 [stat not good enough] (normal)
   perf/compiler                       T5321FD [stat not good enough] (normal)
   perf/compiler                       T5321Fun [stat not good enough] (normal)
   perf/compiler                       T5631 [stat not good enough] (normal)
   perf/compiler                       T5642 [stat not good enough] (normal)
   perf/compiler                       T5837 [stat not good enough] (normal)
   perf/compiler                       T6048 [stat not good enough] (optasm)
   perf/compiler                       T783 [stat not good enough] (normal)
   perf/compiler                       T9020 [stat not good enough] (optasm)
   perf/compiler                       parsing001 [stat not good enough] (normal)
   perf/should_run                     T9203 [stat not good enough] (normal)
   plugins                             plugins01 [bad exit code] (normal)
   plugins                             plugins02 [stderr mismatch] (normal)
   plugins                             plugins03 [stderr mismatch] (normal)
   programs/joao-circular              joao-circular [exit code non-0] (hpc)
   safeHaskell/check/pkg01             ImpSafeOnly01 [exit code non-0] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly02 [exit code non-0] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly04 [exit code non-0] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly05 [stderr mismatch] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly06 [exit code non-0] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly07 [stderr mismatch] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly08 [stderr mismatch] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly09 [stderr mismatch] (normal)
   safeHaskell/check/pkg01             ImpSafeOnly10 [exit code non-0] (normal)
   safeHaskell/check/pkg01             safePkg01 [bad exit code] (normal)
   simplCore/should_compile            T7702 [stat too good] (normal,hpc,optasm,optllvm)
   typecheck/bug1465                   bug1465 [bad exit code] (normal)
   typecheck/should_compile            T7891 [exit code non-0] (hpc,optasm,optllvm)
   typecheck/should_compile            tc124 [exit code non-0] (hpc,optasm,optllvm)
   typecheck/should_run                T1735 [exit code non-0] (normal,hpc,optasm,threaded1,threaded2,dyn,optllvm)
   typecheck/should_run                T1735 [bad stdout or stderr] (ghci)
   typecheck/should_run                T3500b [exit code non-0] (hpc,optasm,threaded2,dyn,optllvm)
   typecheck/should_run                T5751 [exit code non-0] (normal,hpc,optasm,threaded1,threaded2,dyn,optllvm)
   typecheck/should_run                T5751 [bad stdout or stderr] (ghci)
ezyang accepted this revision.Sep 11 2014, 12:15 PM
ezyang added a reviewer: ezyang.

If it's been tested on OS X, LGTM.

Agreed, someone should do that; I don't have a Mac though.

austin accepted this revision.Sep 15 2014, 8:09 AM
austin edited edge metadata.

LGTM as well.

This revision is now accepted and ready to land.Sep 15 2014, 8:09 AM
austin closed this revision.Sep 16 2014, 7:58 AM
austin updated this revision to Diff 548.

Closed by commit rGHCcfd8c7ddcdae (authored by @rwbarton, committed by @austin).