[GHC] #8156: amd64 + in-tree gmp build broken

GHC ghc-devs at haskell.org
Thu Aug 22 13:37:25 UTC 2013


#8156: amd64 + in-tree gmp build broken
-------------------------------------+-------------------------------------
       Reporter:  errge              |             Owner:
           Type:  bug                |            Status:  new
       Priority:  normal             |         Milestone:  7.8.1
      Component:  Build System       |           Version:  7.7
       Keywords:                     |  Operating System:  Unknown/Multiple
   Architecture:  x86_64 (amd64)     |   Type of failure:  Building GHC
     Difficulty:  Easy (less than 1  |  failed
  hour)                              |         Test Case:
     Blocked By:                     |          Blocking:
Related Tickets:  #4022 #4366 #4374  |
-------------------------------------+-------------------------------------
 Currently, the GHC build system has an in-tree GMP.  This GMP seems to
 be used only if there is no usable GMP found on the system and the
 user didn't provide one using configure flags.

 When we build GHC using an external shared version of GMP, the
 resulting GHC is dynamically linked against GMP and also the
 generated programs are linked dynamically against GMP.

 When the in-tree GMP is used, it is built statically, even if the GHC
 we are building is shared GHC on GNU/Linux.  This feature is currently
 broken on amd64 (#4366, #4022), but is working currently
 very well on Linux i686.

 Apart from the breakage this setting is very flexible and I'd be very
 happy if it were possible to keep it, in spite of removeal requests
 like #4374.

 When there is a system GMP, nothing would change, this is the most
 typical usage, e.g. distributions are all building this way.

 On the other hand, if the user removes his GMP (maybe we should
 provide an option to explicity trigger this in ./configure, instead of
 having to remove GMP); she can build a GHC that is not linked
 dynamically against GMP and the resulting programs are not linked
 either.  This makes it possible to generate binaries that link
 dynamically against libc (no -static) which is quite compatible
 amongst versions, but doesn't require a libgmp.so to run.  For binary
 deployments this seems to be the best kind of setup nowadays.

 Now, if we were only able to fix this for amd64.  See this:
 https://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3

 On amd64 we can continue to compile GMP statically and link into the
 binary library, we just have to compile GMP with the fPIC.  I attached
 the patch to fix this.  Previously a similar patch has been rejected
 in #4022 because "this shouldn't
 be platform specific", but this is clearly not the case, this is
 specific to amd64.

 Tadaaaam:
 {{{
 errge at sid64:~/ghc/inplace/bin$ cat test.hs
 main = print (2^100)
 errge at sid64:~/ghc/inplace/bin$ ./ghc-stage2 test.hs
 [1 of 1] Compiling Main             ( test.hs, test.o )
 Linking test ...
 errge at sid64:~/ghc/inplace/bin$ ./test
 1267650600228229401496703205376
 errge at sid64:~/ghc/inplace/bin$ ldd ./test
         linux-vdso.so.1 (0x00007fff79962000)
         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe4b9a83000)
         librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
 (0x00007fe4b987a000)
         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
 (0x00007fe4b9676000)
         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe4b92c6000)
         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
 (0x00007fe4b90a6000)
         /lib64/ld-linux-x86-64.so.2 (0x00007fe4b9d83000)
 }}}

 No GMP!

 I attach the build file patch to the bugreport.

 So, can we please apply this patch and just keep the in-tree GMP?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8156>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list