Opened 3 years ago

Closed 3 years ago

#5408 closed bug (fixed)

ghc-7.2.1 build failed for PowerPC

Reported by: maeder Owned by: simonmar
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 7.2.1
Keywords: Cc: pho@…
Operating System: MacOS X Architecture: powerpc
Type of failure: Building GHC failed Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

"inplace/bin/ghc-stage1"   -H32m -O    -package-name ghc-prim-0.2.0.0 -hide-all-packages -i -ilibraries/ghc-prim/. -ilibraries/ghc-prim/dist-install/build -ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/dist-install/build -Ilibraries/ghc-prim/dist-install/build/autogen -Ilibraries/ghc-prim/.    -optP-include -optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h -package rts-1.0  -package-name ghc-prim -XHaskell98 -XCPP -XMagicHash -XForeignFunctionInterface -XUnliftedFFITypes -XUnboxedTuples -XEmptyDataDecls -XNoImplicitPrelude -O2 -no-user-package-conf -rtsopts     -odir libraries/ghc-prim/dist-install/build -hidir libraries/ghc-prim/dist-install/build -stubdir libraries/ghc-prim/dist-install/build -hisuf hi -osuf  o -hcsuf hc -c libraries/ghc-prim/./GHC/CString.hs -o libraries/ghc-prim/dist-install/build/GHC/CString.o

libraries/ghc-prim/GHC/CString.hs:19:16:
    Warning: -XNoGenerics is deprecated: it does nothing; look into -XDefaultSignatures and -XDeriveGeneric for generic programming support.

/tmp/ghc17429_0/ghc17429_0.s:730:0: Unknown pseudo-op: .ident

/tmp/ghc17429_0/ghc17429_0.s:730:0:
    Rest of line ignored. 1st junk character valued 34 (").
make[1]: *** [libraries/ghc-prim/dist-install/build/GHC/CString.o] Error 1
make: *** [all] Error 2

Change History (15)

comment:1 Changed 3 years ago by PHO

  • Cc pho@… added

comment:2 Changed 3 years ago by maeder

  • Version changed from 7.1 to 7.2.1

The same problem is still in ghc-7.2.1.20111103. If PowerPC should no longer be supported then this should reported during configure! Or am I just missing some settings in build.mk?

comment:3 Changed 3 years ago by PHO

Hmm... PPC codegen has bitrotted again?
I'm sad if PPC support gets dropped but currently I have no time to take a look...

comment:4 Changed 3 years ago by igloo

  • Resolution set to wontfix
  • Status changed from new to closed

PowerPC isn't a tier 1 platform, so we rely on the community to fix any arch specific problems in the registerised build. Unregisterised builds should work, though.

Predicting platform-specific build problems in configure is tricky, because we aren't able to test them, so we just end up with lots of platforms that configure thinks don't work but actually do work, or vice-versa.

We're not going to fix this ourselves, and anyone likely to will run into it themselves, so I'm closing this ticket.

comment:5 Changed 3 years ago by PHO

  • Resolution wontfix deleted
  • Status changed from closed to new

I fixed the problem: https://github.com/phonohawk/ghc/commit/71e6a08b5bb216810e1b48ad9b8f08123be651d9

To pull my branch:

git fetch git://github.com/phonohawk/ghc.git patch-5408

Unfortunately, the stage2 compiler still doesn't build due to #2979.

comment:6 Changed 3 years ago by PHO

  • Blocked By 2979 added
  • Status changed from new to patch

comment:7 Changed 3 years ago by PHO

  • Blocked By 2979 removed

I rebased my previous patch and added a new one:
https://github.com/phonohawk/ghc/compare/master...patch-5408

To pull my branch for this issue:

git fetch git://github.com/phonohawk/ghc.git patch-5408

With these patches, the HEAD now produces fully working GHC even on powerpc-apple-darwin.

comment:8 follow-up: Changed 3 years ago by simonmar

Thanks for the patch. This hunk doesn't look right to me:

+ifeq "$(UseLibFFIForAdjustors)" "YES"
+# When we use libffi, foreign import wrappers will #include "ffi.h" so
+# we must tell the C preprocessor where it is.
+SRC_HC_OPTS += -Irts/dist/build
+SRC_CC_OPTS += -Irts/dist/build
+endif
+

(I couldn't add a comment in github, not sure why)

We should be finding ffi.h in the same way that we find Rts.h, whatever that is. If we have to do something magic in the build system to find ffi.h, won't that break when we install GHC?

Modifying SRC_HC_OPTS in the build system is usually not the right thing to do - it is for mk/build.mk to set, with a default in mk/config.mk. You'll notice that no other .mk file in the build system sets SRC_HC_OPTS or SRC_CC_OPTS.

comment:9 in reply to: ↑ 8 ; follow-up: Changed 3 years ago by PHO

Thank you for reviewing my patches.

Replying to simonmar:

We should be finding ffi.h in the same way that we find Rts.h, whatever that is.

I agree with you, but unlike Rts.h, libffi headers ffi.h and ffitarget.h are dynamically generated by libffi/build/configure so the correct fix would be to treat them in a similar way as we treat ghcautoconf.h and ghcplatform.h. That is, let libffi/ghc.mk copy them directly into includes, not into rts/dist/build. Do you think this is appropriate? If so, I'll rewrite my patch.

If we have to do something magic in the build system to find ffi.h, won't that break when we install GHC?

No. They used to be installed into $(ghcheaderdir) i.e. the same directory as Rts.h, until the said bitrot ocurred. So we don't need any magic in an installed GHC.

Modifying SRC_HC_OPTS in the build system is usually not the right thing to do - it is for mk/build.mk to set, with a default in mk/config.mk. You'll notice that no other .mk file in the build system sets SRC_HC_OPTS or SRC_CC_OPTS.

Yes... that's what I've concerned about.

comment:10 in reply to: ↑ 9 ; follow-up: Changed 3 years ago by simonmar

  • Difficulty set to Unknown

Replying to PHO:

Thank you for reviewing my patches.

Replying to simonmar:

We should be finding ffi.h in the same way that we find Rts.h, whatever that is.

I agree with you, but unlike Rts.h, libffi headers ffi.h and ffitarget.h are dynamically generated by libffi/build/configure so the correct fix would be to treat them in a similar way as we treat ghcautoconf.h and ghcplatform.h. That is, let libffi/ghc.mk copy them directly into includes, not into rts/dist/build. Do you think this is appropriate? If so, I'll rewrite my patch.

I think the right thing to do is to add TOP"/rts/dist/build" to include-dirs in rts/package.conf.in. We already have TOP"/includes/dist-ghcconstants/header" there, for a similar reason.

comment:11 in reply to: ↑ 10 Changed 3 years ago by PHO

Replying to simonmar:

I think the right thing to do is to add TOP"/rts/dist/build" to include-dirs in rts/package.conf.in. We already have TOP"/includes/dist-ghcconstants/header" there, for a similar reason.

That worked perfectly. Thanks!

Here's my rewritten/rebased branch:
https://github.com/phonohawk/ghc/compare/master...patch-5408

git fetch git://github.com/phonohawk/ghc.git patch-5408

comment:12 Changed 3 years ago by simonmar

  • Milestone set to 7.4.1
  • Owner set to simonmar

Thanks, I'll merge.

comment:13 Changed 3 years ago by marlowsd@…

commit f26546bbb339296d81272b0f8127119862a34b75

Merge: 606f6e1... 616b669...
Author: Simon Marlow <marlowsd@gmail.com>
Date:   Fri Dec 9 10:33:45 2011 +0000

    Merge remote branch 'phonohawk/patch-5408'
    
    * phonohawk/patch-5408:
      Resurrect UseLibFFIForAdjustors from bitrot.
      Detect cases where as(1) doesn't recognise .ident directive (#5408)

 aclocal.m4                        |   11 +++++++++++
 compiler/ghc.mk                   |    2 +-
 compiler/main/SysTools.lhs        |    2 ++
 compiler/nativeGen/AsmCodeGen.lhs |   11 +++++++----
 compiler/utils/Platform.hs        |    1 +
 ghc.mk                            |    8 +++++---
 libffi/ghc.mk                     |    8 ++++----
 rts/ghc.mk                        |    9 ++++++++-
 rts/package.conf.in               |    2 +-
 settings.in                       |    1 +
 10 files changed, 41 insertions(+), 14 deletions(-)

comment:14 Changed 3 years ago by pho@…

commit 3640d374f3501c0addb1be273ecc0f10f93be10d

Author: PHO <pho@cielonegro.org>
Date:   Wed Nov 30 17:46:27 2011 +0900

    Detect cases where as(1) doesn't recognise .ident directive (#5408)
    
    .ident directives are usually ignored by as(1), and in some cases (like Darwin/PPC) they even raise an error.

 aclocal.m4                        |   11 +++++++++++
 compiler/main/SysTools.lhs        |    2 ++
 compiler/nativeGen/AsmCodeGen.lhs |   11 +++++++----
 compiler/utils/Platform.hs        |    1 +
 settings.in                       |    1 +
 5 files changed, 22 insertions(+), 4 deletions(-)

comment:15 Changed 3 years ago by simonmar

  • Resolution set to fixed
  • Status changed from patch to closed
Note: See TracTickets for help on using tickets.