Skip to content

"I found a duplicate definition for symbol: __x86.get_pc_thunk.bx" in package network

hi, i get this panic! using hint to interpret code which uses the network package (on 32bit ubuntu):

GHC runtime linker: fatal error: I found a duplicate definition for symbol
   __i686.get_pc_thunk.bx
whilst processing object file
   /home/mechgen/get_pc_thunk.bx/.cabal-sandbox/lib/i386-linux-ghc-7.10.2/network-2.6.2.1-F6mK9sCIw3M5SbZMt2lUQE/libHSnetwork-2.6.2.1-F6mK9sCIw3M5SbZMt2lUQE.a
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.
Left (GhcException "panic! (the 'impossible' happened)\n  (GHC version 7.10.2 for i386-unknown-linux):\n\tloadArchive \"/home/mechgen/get_pc_thunk.bx/.cabal-sandbox/lib/i386-linux-ghc-7.10.2/network-2.6.2.1-F6mK9sCIw3M5SbZMt2lUQE/libHSnetwork-2.6.2.1-F6mK9sCIw3M5SbZMt2lUQE.a\": failed\n\nPlease report this as a GHC bug:  http://www.haskell.org/ghc/reportabug\n")

the problem also arises when the interpreted module imports a module which imports network, so it doesn't have to import network directly.

also "it worked before". i can't really remember the previous working versions, but it must have been something like ghc 7.6.3 and haskell-platform 2013.2.0.0.

the related ticket mentioned building without -fPIC, but i can't find it in network's cabal file.

more info:

$  uname -a
Linux mechgen 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:15:33 UTC 2013 i686 i686 i386 GNU/Linux
$  ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.2
$  cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library 

to reproduce:

cat <<EOF > Compile.hs 
module Main where

import Control.Exception (bracket)
import System.IO (openTempFile, hClose, hPutStr)
import System.Directory (removeFile)
import Language.Haskell.Interpreter hiding (reset, get)

withTempFile :: FilePath -> FilePath -> String -> (FilePath -> IO a) -> IO a
withTempFile tempDir name' body action = do
  (fp,h) <- openTempFile tempDir (name' ++ ".hs")
  hPutStr h body 
  hClose h
  bracket (return fp) (\fp' -> removeFile fp') action

compile :: IO (Either InterpreterError Int)
compile = do
  let tempDir = "."
  let name' = "DummyImportingNetwork"
  body <- readFile $ name' ++ ".hs"
  withTempFile tempDir name' body $ \fp -> do
      runInterpreter $ do
          set [installedModulesInScope := True]
          loadModules [fp]
          setTopLevelModules [name']
          interpret ("foobar") infer


main = compile >>= print
EOF
cat <<EOF > DummyImportingNetwork.hs 
module DummyImportingNetwork where

-- this breaks everything
import Network.Socket

-- this just has to typecheck
foobar :: Int
foobar = 23
EOF
cabal sandbox init
cabal install  network==2.6.2.1 hint==0.4.2.3
cabal exec -- ghc --make -o compile Compile.hs
PATH=.:$PATH cabal exec compile
Edited by blueonyx
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information