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

#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 System | Version: 7.8.3 Keywords: | Operating System: Linux Architecture: Unknown/Multiple | Type of failure: Building Difficulty: Unknown | GHC failed Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- 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 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#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: | -------------------------------------+------------------------------------- Comment (by rwbarton): From `rts/package.conf.in` {{{ extra-libraries: #ifdef HAVE_LIBM "m" /* for ldexp() */ #endif #ifdef HAVE_LIBRT , "rt" #endif #ifdef HAVE_LIBDL , "dl" #endif ... }}} suggests that `HAVE_LIBDL` is not set for you. What is the output of `inplace/bin/ghc-pkg describe rts`? What does `include/ghcautoconf.h` say about `HAVE_LIBDL`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by jpmasseria): `inplace/bin/ghc-pkg describe rts` outputs: {{{ johnma@aspire-ubuntu:~/ghc$ inplace/bin/ghc-pkg describe rts name: rts version: 1.0 id: builtin_rts license: BSD3 copyright: maintainer: glasgow-haskell-users@haskell.org stability: homepage: package-url: synopsis: description: category: author: exposed: True exposed-modules: hidden-modules: trusted: False import-dirs: library-dirs: /home/johnma/ghc/rts/dist/build hs-libraries: HSrts Cffi extra-libraries: m rt extra-ghci-libraries: include-dirs: /home/johnma/ghc/rts/dist/build /home/johnma/ghc/includes /home/johnma/ghc/includes/dist-derivedconstants/header includes: Stg.h depends: hugs-options: cc-options: ld-options: "-Wl,-u,ghczmprim_GHCziTypes_Izh_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Czh_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Fzh_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Dzh_static_info" "-Wl,-u,base_GHCziPtr_Ptr_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Wzh_static_info" "-Wl,-u,base_GHCziInt_I8zh_static_info" "-Wl,-u,base_GHCziInt_I16zh_static_info" "-Wl,-u,base_GHCziInt_I32zh_static_info" "-Wl,-u,base_GHCziInt_I64zh_static_info" "-Wl,-u,base_GHCziWord_W8zh_static_info" "-Wl,-u,base_GHCziWord_W16zh_static_info" "-Wl,-u,base_GHCziWord_W32zh_static_info" "-Wl,-u,base_GHCziWord_W64zh_static_info" "-Wl,-u,base_GHCziStable_StablePtr_static_info" "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info" "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info" "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info" "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info" "-Wl,-u,base_GHCziPtr_Ptr_con_info" "-Wl,-u,base_GHCziPtr_FunPtr_con_info" "-Wl,-u,base_GHCziStable_StablePtr_con_info" "-Wl,-u,ghczmprim_GHCziTypes_False_closure" "-Wl,-u,ghczmprim_GHCziTypes_True_closure" "-Wl,-u,base_GHCziPack_unpackCString_closure" "-Wl,-u,base_GHCziIOziException_stackOverflow_closure" "-Wl,-u,base_GHCziIOziException_heapOverflow_closure" "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure" "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure" "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure" "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure" "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure" "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure" "-Wl,-u,base_GHCziTopHandler_runIO_closure" "-Wl,-u,base_GHCziTopHandler_runNonIO_closure" "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure" "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure" "-Wl,-u,base_GHCziConcziSync_runSparks_closure" "-Wl,-u,base_GHCziConcziSignal_runHandlers_closure" framework-dirs: frameworks: haddock-interfaces: haddock-html: pkgroot: "/home/johnma/ghc/inplace/lib" }}} `includes/ghcautoconf.h` contains: {{{ /* Define to 1 if you need -ldl to get dlopen(). */ /* #undef HAVE_LIBDL */ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by rwbarton): What does your config.log say between "checking for dlopen in -ldl" and whatever the next item is (for me it's "checking for size_t")? Is it possible that your toolchain somehow doesn't support dlopen at all? Can you try building a small C program that uses dlopen? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by jpmasseria): Here's what's in my `config.log` related to `-ldl`: {{{ configure:10619: /home/johnma/mygcc -o conftest -g -O2 -fno-stack- protector conftest.c -ldl >&5 /tmp/ccqfJgej.o: In function `main': /home/johnma/ghc/conftest.c:99: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/johnma/rpi-toolchain/rootfs/usr/lib/arm-linux- gnueabihf/libdl.a(dlopen.o): In function `dlopen': (.text+0xc): undefined reference to `__dlopen' collect2: error: ld returned 1 exit status configure:10619: $? = 1 }}} This is strange because I am using the tool chain recommended here: [https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/RaspberryPi] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Comment (by rwbarton): Maybe you are having the same problem as this person: http://stackoverflow.com/questions/13626726/an-error-building-qt- libraries-for-the-raspberry-pi -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9589: Building GHC as a cross-compiler for armhf fails with undefined reference to `dlopen', `dlerror', `dlsym' -------------------------------------+------------------------------------- Reporter: jpmasseria | Owner: Type: bug | Status: infoneeded 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: | -------------------------------------+------------------------------------- Changes (by jpmasseria): * status: new => infoneeded Comment: Thank you for your assistance. Looking at the contents of a copy of `/lib` and `/usr/lib` from my target machine (RaspberryPi) it appears that I may not have `libc6-dev` installed on that machine. Unfortunately I am unable to access my target machine remotely and won't be able to perform a `dpkg -l` on it until the weekend. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9589: Building GHC as a cross-compiler for armhf fails with undefined reference to `dlopen', `dlerror', `dlsym' -------------------------------------+------------------------------------- Reporter: jpmasseria | Owner: Type: bug | Status: infoneeded 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: | -------------------------------------+------------------------------------- Comment (by jpmasseria): Success! I manually created the symlinks that `libc6-dev` creates between `/usr/lib/` to `/lib` as relative links as described in the StackOverflow posting you provided [http://stackoverflow.com/questions/13626726/an- error-building-qt-libraries-for-the-raspberry-pi] and the build completed. Here are the symlinks I created: {{{ johnma@aspire-ubuntu:~$ ls -l rpi-toolchain/rootfs/usr/lib/arm-linux- gnueabihf/ | grep "../.." lrwxrwxrwx 1 johnma johnma 44 Sep 17 19:07 libanl.so -> ../../../lib /arm-linux-gnueabihf/libanl.so.1 lrwxrwxrwx 1 johnma johnma 53 Sep 17 19:08 libBrokenLocale.so -> ../../../lib/arm-linux-gnueabihf/libBrokenLocale.so.1 lrwxrwxrwx 1 johnma johnma 45 Sep 17 19:08 libcidn.so -> ../../../lib/arm-linux-gnueabihf/libcidn.so.1 lrwxrwxrwx 1 johnma johnma 46 Sep 17 19:08 libcrypt.so -> ../../../lib/arm-linux-gnueabihf/libcrypt.so.1 lrwxrwxrwx 1 johnma johnma 43 Sep 17 18:50 libdl.so -> ../../../lib /arm-linux-gnueabihf/libdl.so.2 lrwxrwxrwx 1 johnma johnma 42 Sep 17 19:08 libm.so -> ../../../lib /arm-linux-gnueabihf/libm.so.6 lrwxrwxrwx 1 johnma johnma 44 Sep 17 19:08 libnsl.so -> ../../../lib /arm-linux-gnueabihf/libnsl.so.1 lrwxrwxrwx 1 johnma johnma 51 Sep 17 19:08 libnss_compat.so -> ../../../lib/arm-linux-gnueabihf/libnss_compat.so.2 lrwxrwxrwx 1 johnma johnma 48 Sep 17 19:08 libnss_dns.so -> ../../../lib/arm-linux-gnueabihf/libnss_dns.so.2 lrwxrwxrwx 1 johnma johnma 50 Sep 17 19:08 libnss_files.so -> ../../../lib/arm-linux-gnueabihf/libnss_files.so.2 lrwxrwxrwx 1 johnma johnma 51 Sep 17 19:08 libnss_hesiod.so -> ../../../lib/arm-linux-gnueabihf/libnss_hesiod.so.2 lrwxrwxrwx 1 johnma johnma 52 Sep 17 19:08 libnss_nisplus.so -> ../../../lib/arm-linux-gnueabihf/libnss_nisplus.so.2 lrwxrwxrwx 1 johnma johnma 48 Sep 17 19:08 libnss_nis.so -> ../../../lib/arm-linux-gnueabihf/libnss_nis.so.2 lrwxrwxrwx 1 johnma johnma 47 Sep 17 19:08 libresolv.so -> ../../../lib/arm-linux-gnueabihf/libresolv.so.2 lrwxrwxrwx 1 johnma johnma 43 Sep 17 19:08 librt.so -> ../../../lib /arm-linux-gnueabihf/librt.so.1 lrwxrwxrwx 1 johnma johnma 50 Sep 17 19:08 libthread_db.so -> ../../../lib/arm-linux-gnueabihf/libthread_db.so.1 lrwxrwxrwx 1 johnma johnma 45 Sep 17 19:08 libutil.so -> ../../../lib/arm-linux-gnueabihf/libutil.so.1 johnma@aspire-ubuntu:~$ }}} On my system the links did not exist at all. I had copied the `/lib` and `/usr/lib` from my target machine to my build machine using `rsync`. It is possible that my target machine did not have `libc6-dev` installed. My target machine is down right now so I can't tell that for sure. However, bottom line, for me to build a stage1 cross-compiler for a Raspberry Pi I had to create the relative symlinks shown above. I also had to create a short script to call `gcc` using `--sysroot` pointing to my local sysroot with my target `/lib` and `/usr/lib` directories as follows where `arm-linux-gnuabihf-gcc` is the cross-compiler from [https://github.com/raspberrypi/tools] installed on my build machine: {{{ johnma@aspire-ubuntu:~$ cat mygcc #!/bin/bash arm-linux-gnueabihf-gcc --sysroot=/home/johnma/rpi-toolchain/rootfs $@ johnma@aspire-ubuntu:~$ }}} And then used this `./configure` command: {{{ ./configure --target=arm-linux-gnueabihf --enable-unregisterised --with- gcc=/home/johnma/mygcc --with-nm=/usr/bin/nm }}} I tested my build as follows: {{{ johnma@aspire-ubuntu:~$ ./ghc/inplace/bin/ghc-stage1 haq.hs [1 of 1] Compiling Main ( haq.hs, haq.o ) Linking haq ... johnma@aspire-ubuntu:~$ johnma@aspire-ubuntu:~$ file haq haq: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, Buil dID[sha1]=26c431c1e98551502c244089c9028ce7e83b7a30, not stripped johnma@aspire-ubuntu:~$ johnma@aspire-ubuntu:~$ cat haq.hs -- -- Copyright (c) 2006 Don Stewart - http://www.cse.unsw.edu.au/~dons/ -- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html) -- import System.Environment -- | 'main' runs the main program main :: IO () main = getArgs >>= print . haqify . head haqify s = "Haq! " ++ s }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9589: Building GHC as a cross-compiler for armhf fails with undefined reference to `dlopen', `dlerror', `dlsym' -------------------------------------+------------------------------------- Reporter: jpmasseria | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build | Version: 7.8.3 System | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: Linux | Difficulty: Unknown Type of failure: Building | Blocked By: GHC failed | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by jpmasseria): * status: infoneeded => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9589#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC