[GHC] #9421: magic number mismatch when installing 32bit on 64bit machine

GHC ghc-devs at haskell.org
Fri Aug 29 10:59:59 UTC 2014


#9421: magic number mismatch when installing 32bit on 64bit machine
-------------------------------------+-------------------------------------
              Reporter:              |            Owner:
  MikolajKonarski                    |           Status:  new
                  Type:  bug         |        Milestone:
              Priority:  normal      |          Version:  7.8.3
             Component:  Compiler    |         Keywords:
            Resolution:              |     Architecture:  x86_64 (amd64)
      Operating System:  Linux       |       Difficulty:  Unknown
       Type of failure:  Installing  |       Blocked By:
  GHC failed                         |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by MikolajKonarski):

 Here is the trivial workaround (perhaps I should add it to the wiki
 somewhere and then close the ticket?):

 {{{
 CFLAGS=-m32 ./configure --prefix=.....
 }}}

 Now I can compile many packages and the 32bit executables work (e.g.,
 alex, happy). I still struggle with gtk2hs and I haven't tried beasts like
 yesod, etc, though. The command I use is

 {{{
 cabal install --ghc-option="-optc-m32" --ghc-option="-opta-m32" --ghc-
 option="-optl-m32" --ld-option="-melf_i386"
 }}}

 == Long story ==

 The workaround is inspired by https://ghc.haskell.org/trac/ghc/ticket/8910
 and http://www.haskell.org/pipermail/glasgow-haskell-
 users/2012-February/022014.html

 I had to install many -dev:i386 versions of libraries on my Ubuntu to make
 it work. The most problematic was libgmp-dev, since my Ubuntu only
 tolerates amd64 or i386 version of this lib at once (zlib1g-dev:i386
 didn't have that problem). I ended up adding a hacky symlink instead of
 the -dev:i386 version:

 {{{
 sudo ln -s /usr/lib/i386-linux-gnu/libgmp.so.10.0.2 /usr/lib/i386-linux-
 gnu/libgmp.so
 }}}

 == The remaining gtk2hs problem ==

 This is probably a bug in gtk2hs-buildtools (I reinstalled them for 32bits
 with many extra flags, but no improvement), but I won't report it on
 gtk2hs issue tracker until I research a bit more. I try monstrosities like

 {{{
 CFLAGS=-m32 cabal install glib -j1 --ghc-option="-optc-m32" --ghc-
 option="-opta-m32" --ghc-option="-optl-m32" --ld-option="-melf_i386" -v3
 --gcc-option="-m32" --configure-option="CFLAGS=-m32" --ghc-option="-optl-
 Wl,-melf_i386"
 }}}

 but I'm still getting

 {{{
 /tmp/glib-0.13.0.1-1099/glib-0.13.0.1/dist/setup/setup configure
 --verbose=3
 --ghc --prefix=/mikolaj/.cabal --bindir=/mikolaj/.cabal/bin
 --libdir=/mikolaj/.cabal/lib --libsubdir=i386-linux-
 ghc-7.8.3/glib-0.13.0.1
 --libexecdir=/mikolaj/.cabal/libexec --datadir=/mikolaj/.cabal/share
 --datasubdir=i386-linux-ghc-7.8.3/glib-0.13.0.1
 --docdir=/mikolaj/.cabal/share/doc/i386-linux-ghc-7.8.3/glib-0.13.0.1
 --htmldir=/mikolaj/.cabal/share/doc/i386-linux-
 ghc-7.8.3/glib-0.13.0.1/html
 --haddockdir=/mikolaj/.cabal/share/doc/i386-linux-
 ghc-7.8.3/glib-0.13.0.1/html
 --sysconfdir=/mikolaj/.cabal/etc --configure-option=CFLAGS=-m32 --user
 --flags=closure_signals --extra-prog-path=/mikolaj/.cabal/bin
 --constraint=utf8-string ==0.3.8 --constraint=text ==1.1.1.3
 --constraint=containers ==0.5.5.1 --constraint=bytestring ==0.10.4.0
 --constraint=base ==4.7.0.1 --disable-tests --disable-benchmarks
 --gcc-option=-m32 --ghc-option=-optc-m32 --ghc-option=-opta-m32
 --ghc-option=-optl-m32 --ghc-option=-optl-Wl,-melf_i386 --ld-
 option=-melf_i386
 [1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-
 wrapper/Gtk2HsSetup.o )
 /tmp/ghc1232_0/ghc1232_4.s: Assembler messages:

 /tmp/ghc1232_0/ghc1232_4.s:43:0:
      Error: invalid instruction suffix for `push'
 }}}

 I haven't looked inside the generated files nor inside the gtk2hs-
 buildtools yet.

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


More information about the ghc-tickets mailing list