[GHC] #15396: -staticlib is broken on GHC 8.4.3 on Linux under certain conditions

GHC ghc-devs at haskell.org
Mon Jul 16 13:36:35 UTC 2018


#15396: -staticlib is broken on GHC 8.4.3 on Linux under certain conditions
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
  (Linking)                          |
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by RyanGlScott:

Old description:

> When compiling this simple program:
>
> {{{#!hs
> main = pure ()
> }}}
>
> Using the `-staticlib` flag on GHC 8.4.3 on Linux, it panics if using a
> certain toolchain:
>
> {{{
> $ uname -a
> Linux gearloose 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29
> 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
> $ /opt/ghc/8.4.3/bin/ghc -staticlib Bug.hs
> Linking Bug.a ...
> ghc: panic! (the 'impossible' happened)
>   (GHC version 8.4.3 for x86_64-unknown-linux):
>         Data.Binary.Get.runGet at position 27462987: Invalid archive
> header end marker
> CallStack (from HasCallStack):
>   error, called at libraries/binary/src/Data/Binary/Get.hs:351:5 in
> binary-0.8.5.1:Data.Binary.Get
> }}}
>
> I say "certain toolchain" since I am able to reproduce this issue on
> Ubuntu 14.04, but not 18.04:
>
> {{{
> $ uname -a
> Linux Linux-T450 4.15.0-24-generic #26-Ubuntu SMP Wed Jun 13 08:44:47 UTC
> 2018 x86_64 x86_64 x86_64 GNU/Linux
> $ ghc -staticlib Bug.hs
> [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
> Linking Bug.a ...
> }}}
>
> This issue does not occur on GHC 8.2 and earlier:
>
> {{{
> $ /opt/ghc/8.2.2/bin/ghc -staticlib Bug.hs
> [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
> Linking Bug.a ...
> Static archive creation only supported on Darwin/OS X/iOS
> }}}
>
> Commit b8f33bc6b738b0378976e42b79369f0e53b680c7 allowed the use of
> `-staticlib` on all platforms. angerman, do you know what might be
> happening here?

New description:

 When compiling this simple program:

 {{{#!hs
 main = pure ()
 }}}

 Using the `-staticlib` flag on GHC 8.4.3 on Linux, it panics if using a
 certain toolchain:

 {{{
 $ lsb_release -a
 No LSB modules are available.
 Distributor ID: Ubuntu
 Description:    Ubuntu 14.04.5 LTS
 Release:        14.04
 Codename:       trusty
 $ /opt/ghc/8.4.3/bin/ghc -staticlib Bug.hs
 Linking Bug.a ...
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.4.3 for x86_64-unknown-linux):
         Data.Binary.Get.runGet at position 27462987: Invalid archive
 header end marker
 CallStack (from HasCallStack):
   error, called at libraries/binary/src/Data/Binary/Get.hs:351:5 in
 binary-0.8.5.1:Data.Binary.Get
 }}}

 I say "certain toolchain" since I am able to reproduce this issue on
 Ubuntu 14.04, but not 18.04:

 {{{
 $ lsb_release -a
 No LSB modules are available.
 Distributor ID: Ubuntu
 Description:    Ubuntu 18.04 LTS
 Release:        18.04
 Codename:       bionic
 $ ghc -staticlib Bug.hs
 [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
 Linking Bug.a ...
 }}}

 This issue does not occur on GHC 8.2 and earlier:

 {{{
 $ /opt/ghc/8.2.2/bin/ghc -staticlib Bug.hs
 [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
 Linking Bug.a ...
 Static archive creation only supported on Darwin/OS X/iOS
 }}}

 Commit b8f33bc6b738b0378976e42b79369f0e53b680c7 allowed the use of
 `-staticlib` on all platforms. angerman, do you know what might be
 happening here?

--

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


More information about the ghc-tickets mailing list