Opened 3 years ago

Closed 3 years ago

#5033 closed bug (worksforme)

GHC 7.0.2 does not build on OS X 10.5.

Reported by: nominolo Owned by:
Priority: normal Milestone:
Component: Build System Version: 7.0.2
Keywords: Cc: pho@…
Operating System: MacOS X Architecture: x86
Type of failure: Building GHC failed Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Since the binary release of 7.0.2 for OS X doesn't work on 10.5, I tried building it from source, which fails with this:

"inplace/bin/ghc-stage1" -optc-I/Users/nominolo/code/ghc/7.0.2/libraries/integer-gmp/gmp -optc-Ilibraries/integer-gmp/. -optc-I"/Users/nominolo/code/ghc/7.0.2/includes" -optc-I"/Users/nominolo/code/ghc/7.0.2/libffi/dist-install/build" -fPIC -dynamic  -H32m -O    -package-name integer-gmp-0.2.0.3 -hide-all-packages -i -ilibraries/integer-gmp/. -ilibraries/integer-gmp/dist-install/build -ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/dist-install/build -Ilibraries/integer-gmp/dist-install/build/autogen -Ilibraries/integer-gmp/.    -optP-include -optPlibraries/integer-gmp/dist-install/build/autogen/cabal_macros.h -package ghc-prim-0.2.0.0  -package-name integer-gmp -XCPP -XMagicHash -XUnboxedTuples -XNoImplicitPrelude -XForeignFunctionInterface -XUnliftedFFITypes -no-user-package-conf -rtsopts -O2 -XGenerics     -c libraries/integer-gmp/cbits/cbits.c -o libraries/integer-gmp/dist-install/build/cbits/cbits.dyn_o
"inplace/bin/ghc-stage1" libraries/integer-gmp/dist-install/build/GHC/Integer.dyn_o libraries/integer-gmp/dist-install/build/GHC/Integer/GMP/Internals.dyn_o libraries/integer-gmp/dist-install/build/GHC/Integer/Type.dyn_o libraries/integer-gmp/dist-install/build/cbits/gmp-wrappers.dyn_o  libraries/integer-gmp/dist-install/build/cbits/cbits.dyn_o    libraries/integer-gmp/gmp/objs/*.o `/usr/bin/find libraries/integer-gmp/dist-install/build -name "*_stub.dyn_o" -print` -shared -dynamic -dynload deploy -dylib-install-name /Users/nominolo/local/lib/ghc-7.0.2/`basename "libraries/integer-gmp/dist-install/build/libHSinteger-gmp-0.2.0.3-ghc7.0.2.dylib" | sed 's/^libHS//;s/[-]ghc.*//'`/`basename "libraries/integer-gmp/dist-install/build/libHSinteger-gmp-0.2.0.3-ghc7.0.2.dylib"` -no-auto-link-packages -package ghc-prim-0.2.0.0 -o libraries/integer-gmp/dist-install/build/libHSinteger-gmp-0.2.0.3-ghc7.0.2.dylib
ld: absolute addressing (perhaps -mdynamic-no-pic) used in ___gmpn_add_nc from libraries/integer-gmp/gmp/objs/add_n.o not allowed in slidable image
collect2: ld returned 1 exit status
make[1]: *** [libraries/integer-gmp/dist-install/build/libHSinteger-gmp-0.2.0.3-ghc7.0.2.dylib] Error 1
make: *** [all] Error 2

Change History (3)

comment:1 Changed 3 years ago by PHO

  • Cc pho@… added

comment:2 Changed 3 years ago by nominolo

Okay, it seems like the GMP C library is not compilled with PIC defined. Here is part of the hand-coded assembly for add:

	subl	%eax,%edx		C ... enter the loop
	shrl	$2,%eax			C restore previous value

ifdef(`PIC',`
	C Calculate start address in loop for PIC.  Due to limitations in
	C old gas, LF(M4_function_n,oop)-L(0a)-3 cannot be put into the leal
	call	L(0a)
L(0a):	leal	(%eax,%eax,8),%eax
	addl	(%esp),%eax
	addl	$L(oop)-L(0a)-3,%eax
	addl	$4,%esp
',`
	C Calculate start address in loop for non-PIC.
	leal	L(oop)-3(%eax,%eax,8),%eax
')

	C These lines initialize carry from the 5th parameter.  Should be
	C possible to simplify.
	pushl	%ebp		FRAME_pushl()
	movl	PARAM_CARRY,%ebp

If we now look at the output from otool -tv add_n.o we see that it apparently uses the code for non-PIC:

00000026	subl	%eax,%edx
00000028	shrl	$0x02,%eax

0000002b	leal	0x0000007d(%eax,%eax,8),%eax

00000032	pushl	%ebp
00000033	movl	0x20(%esp),%ebp

comment:3 Changed 3 years ago by nominolo

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

Upgrading to XCode 3.1.4 (from 3.0 it seems) fixed it. (XCode version reported at the top of the file /Developer/About\ Xcode\ Tools.pdf. Closing as worksforme.

Note: See TracTickets for help on using tickets.