[GHC] #9589: Building GHC as a cross-compiler for armhf fails with undefined reference to `dlopen', `dlerror', `dlsym'

GHC ghc-devs at haskell.org
Sun Sep 14 00:30:44 UTC 2014


#9589: Building GHC as a cross-compiler for armhf fails with undefined reference
to `dlopen', `dlerror', `dlsym'
-------------------------------------+-------------------------------------
              Reporter:  jpmasseria  |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Build       |          Version:  7.8.3
  System                             |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:  Linux       |       Difficulty:  Unknown
       Type of failure:  Building    |       Blocked By:
  GHC failed                         |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Description changed by jpmasseria:

Old description:

> Running on Ubuntu 14.04.1 I am trying to build a stage1 cross-compiler
> for a Raspberry Pi running Raspbian.  I am using the tool chain located
> at https://github.com/raspberrypi/tools.
>
> I copied my Raspberry Pi's /include and /usr directories to my build
> machine into directory `/home/johnma/rpi-toolchain/rootfs`.
>
> Following these instructions [https://ghcarm.wordpress.com/2014/01/18
> /unregisterised-ghc-head-build-for-arm64-platform/] I force gcc to use my
> sysroot using this bash script:
>
> `/home/johnma/mygcc` contains:
> {{{
> #!/bin/bash
> arm-linux-gnueabihf-gcc --sysroot=/home/johnma/rpi-toolchain/rootfs $@
> }}}
>
> I used this configure command:
>
> {{{
> ./configure --target=arm-linux-gnueabihf --enable-unregisterised --with-
> gcc=/home/johnma/mygcc --with-nm=/usr/bin/nm
> }}}
>

>
> The build ends with:
> {{{
> "inplace/bin/ghc-stage1" -o utils/hsc2hs/dist-install/build/tmp/hsc2hs
> -hisuf hi -osuf  o -hcsuf hc -static  -H64m -O0    -hide-all-packages -i
> -iutils/hsc2hs/. -iutils/hsc2hs/dist-install/build -iutils/hsc2hs/dist-
> install/build/autogen -Iutils/hsc2hs/dist-install/build -Iutils/hsc2hs
> /dist-install/build/autogen     -optP-include -optPutils/hsc2hs/dist-
> install/build/autogen/cabal_macros.h -package base-4.7.0.1 -package
> containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2
> -package process-1.2.0.0 -XHaskell98 -XCPP -XForeignFunctionInterface
> -no-user-package-db -rtsopts      -odir utils/hsc2hs/dist-install/build
> -hidir utils/hsc2hs/dist-install/build -stubdir utils/hsc2hs/dist-
> install/build   -optl-L'/home/johnma/ghc/libraries/process/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/directory/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/unix/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/time/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/old-locale/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/filepath/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/containers/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/bytestring/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/deepseq/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/array/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/base/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/integer-simple/dist-
> install/build' -optl-L'/home/johnma/ghc/libraries/ghc-prim/dist-
> install/build' -optl-L'/home/johnma/ghc/rts/dist/build' -optl-lrt -optl-
> lutil -optl-lpthread -optl-lm -optl-lrt -static  -H64m -O0    -hide-all-
> packages -i -iutils/hsc2hs/. -iutils/hsc2hs/dist-install/build
> -iutils/hsc2hs/dist-install/build/autogen -Iutils/hsc2hs/dist-
> install/build -Iutils/hsc2hs/dist-install/build/autogen     -optP-include
> -optPutils/hsc2hs/dist-install/build/autogen/cabal_macros.h -package
> base-4.7.0.1 -package containers-0.5.5.1 -package directory-1.2.1.0
> -package filepath-1.3.0.2 -package process-1.2.0.0 -XHaskell98 -XCPP
> -XForeignFunctionInterface  -no-user-package-db -rtsopts
> utils/hsc2hs/dist-install/build/Main.o utils/hsc2hs/dist-
> install/build/HSCParser.o utils/hsc2hs/dist-install/build/DirectCodegen.o
> utils/hsc2hs/dist-install/build/CrossCodegen.o utils/hsc2hs/dist-
> install/build/UtilsCodegen.o utils/hsc2hs/dist-install/build/Common.o
> utils/hsc2hs/dist-install/build/C.o utils/hsc2hs/dist-
> install/build/Flags.o utils/hsc2hs/dist-install/build/Paths_hsc2hs.o
> /home/johnma/ghc/rts/dist/build/libHSrts.a(Linker.o): In function
> `internal_dlopen':
> Linker.c:(.text+0x68): undefined reference to `dlopen'
> Linker.c:(.text+0xa4): undefined reference to `dlerror'
> /home/johnma/ghc/rts/dist/build/libHSrts.a(Linker.o): In function
> `lookupSymbol':
> Linker.c:(.text+0x874): undefined reference to `dlerror'
> Linker.c:(.text+0x89c): undefined reference to `dlsym'
> Linker.c:(.text+0x8a4): undefined reference to `dlerror'
> Linker.c:(.text+0x8c4): undefined reference to `dlsym'
> collect2: error: ld returned 1 exit status
> make[1]: *** [utils/hsc2hs/dist-install/build/tmp/hsc2hs] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [all] Error 2
>
> }}}

New description:

 Running on Ubuntu 14.04.1 I am trying to build a stage1 cross-compiler for
 a Raspberry Pi running Raspbian.  I am using the tool chain located at
 https://github.com/raspberrypi/tools.

 I copied my Raspberry Pi's /include and /usr directories to my build
 machine into directory `/home/johnma/rpi-toolchain/rootfs`.

 Following these instructions [https://ghcarm.wordpress.com/2014/01/18
 /unregisterised-ghc-head-build-for-arm64-platform/] I force gcc to use my
 sysroot using this bash script:

 `/home/johnma/mygcc` contains:
 {{{
 #!/bin/bash
 arm-linux-gnueabihf-gcc --sysroot=/home/johnma/rpi-toolchain/rootfs $@
 }}}

 My `mk/build.mk` file contains:


 {{{
 # Fast build configured for a cross compiler
 BuildFlavour  = quick-cross

 }}}


 I used this configure command:

 {{{
 ./configure --target=arm-linux-gnueabihf --enable-unregisterised --with-
 gcc=/home/johnma/mygcc --with-nm=/usr/bin/nm
 }}}



 The build ends with:
 {{{
 "inplace/bin/ghc-stage1" -o utils/hsc2hs/dist-install/build/tmp/hsc2hs
 -hisuf hi -osuf  o -hcsuf hc -static  -H64m -O0    -hide-all-packages -i
 -iutils/hsc2hs/. -iutils/hsc2hs/dist-install/build -iutils/hsc2hs/dist-
 install/build/autogen -Iutils/hsc2hs/dist-install/build -Iutils/hsc2hs
 /dist-install/build/autogen     -optP-include -optPutils/hsc2hs/dist-
 install/build/autogen/cabal_macros.h -package base-4.7.0.1 -package
 containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2
 -package process-1.2.0.0 -XHaskell98 -XCPP -XForeignFunctionInterface
 -no-user-package-db -rtsopts      -odir utils/hsc2hs/dist-install/build
 -hidir utils/hsc2hs/dist-install/build -stubdir utils/hsc2hs/dist-
 install/build   -optl-L'/home/johnma/ghc/libraries/process/dist-
 install/build' -optl-L'/home/johnma/ghc/libraries/directory/dist-
 install/build' -optl-L'/home/johnma/ghc/libraries/unix/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/time/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/old-locale/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/filepath/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/containers/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/bytestring/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/deepseq/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/array/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/base/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/integer-simple/dist-install/build'
 -optl-L'/home/johnma/ghc/libraries/ghc-prim/dist-install/build'
 -optl-L'/home/johnma/ghc/rts/dist/build' -optl-lrt -optl-lutil -optl-
 lpthread -optl-lm -optl-lrt -static  -H64m -O0    -hide-all-packages -i
 -iutils/hsc2hs/. -iutils/hsc2hs/dist-install/build -iutils/hsc2hs/dist-
 install/build/autogen -Iutils/hsc2hs/dist-install/build -Iutils/hsc2hs
 /dist-install/build/autogen     -optP-include -optPutils/hsc2hs/dist-
 install/build/autogen/cabal_macros.h -package base-4.7.0.1 -package
 containers-0.5.5.1 -package directory-1.2.1.0 -package filepath-1.3.0.2
 -package process-1.2.0.0 -XHaskell98 -XCPP -XForeignFunctionInterface
 -no-user-package-db -rtsopts      utils/hsc2hs/dist-install/build/Main.o
 utils/hsc2hs/dist-install/build/HSCParser.o utils/hsc2hs/dist-
 install/build/DirectCodegen.o utils/hsc2hs/dist-
 install/build/CrossCodegen.o utils/hsc2hs/dist-
 install/build/UtilsCodegen.o utils/hsc2hs/dist-install/build/Common.o
 utils/hsc2hs/dist-install/build/C.o utils/hsc2hs/dist-
 install/build/Flags.o utils/hsc2hs/dist-install/build/Paths_hsc2hs.o
 /home/johnma/ghc/rts/dist/build/libHSrts.a(Linker.o): In function
 `internal_dlopen':
 Linker.c:(.text+0x68): undefined reference to `dlopen'
 Linker.c:(.text+0xa4): undefined reference to `dlerror'
 /home/johnma/ghc/rts/dist/build/libHSrts.a(Linker.o): In function
 `lookupSymbol':
 Linker.c:(.text+0x874): undefined reference to `dlerror'
 Linker.c:(.text+0x89c): undefined reference to `dlsym'
 Linker.c:(.text+0x8a4): undefined reference to `dlerror'
 Linker.c:(.text+0x8c4): undefined reference to `dlsym'
 collect2: error: ld returned 1 exit status
 make[1]: *** [utils/hsc2hs/dist-install/build/tmp/hsc2hs] Error 1
 make[1]: *** Waiting for unfinished jobs....
 make: *** [all] Error 2

 }}}

--

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


More information about the ghc-tickets mailing list