[GHC] #7806: Dynamic linking and libffi

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: ----------------------------------+----------------------------------------- After dynamic linking became the default, building/installing GHC on FreeBSD and Mac fails due to libffi. I don't see any problems on Linux. = FreeBSD without system libffi = GHC can be build: {{{ % make maintainer-clean % perl boot % ./configure --prefix=/ghc-head \ --with-iconv-includes=/usr/local/include \ --with-iconv-libraries=/usr/local/lib \ --with-gmp-includes=/usr/local/include \ --with-gmp-libraries=/usr/local/lib \ --with-gcc=/usr/local/bin/gcc47 \ --with-gcc-4.2=/usr/local/bin/gcc47 % gmake -j10 }}} But installation fails: {{{ % gmake install Installing library in /ghc-head/lib/ghc-7.7.20130323/haskell2010-1.1.1.0 "/ghc-head/lib/ghc-7.7.20130323/bin/ghc-pkg" --force --global-package-db "/ghc-head/lib/ghc-7.7.20130323/package.conf.d" update rts/package.conf.install Shared object "libffi.so.6" not found, required by "libHSrts- ghc7.7.20130323.so" gmake[1]: *** [install_packages] Error 1 gmake: *** [install] Error 2 }}} = FreeBSD with system libffi = The following procedure has no problems: {{{ % make maintainer-clean % perl boot % ./configure --prefix=/ghc-head \ --with-iconv-includes=/usr/local/include \ --with-iconv-libraries=/usr/local/lib \ --with-gmp-includes=/usr/local/include \ --with-gmp-libraries=/usr/local/lib \ --with-gcc=/usr/local/bin/gcc47 \ --with-gcc-4.2=/usr/local/bin/gcc47 --with-system-libffi \ --with-ffi-includes=/usr/local/include \ --with-ffi-libraries=/usr/local/lib % gmake -j10 % gmake install }}} = Mac without system libffi = GHC can be build: {{{ % make maintainer-clean % perl boot % ./configure --prefix=/ghc-head % make -j6 }}} But installation fails: {{{ % make install Installing library in /ghc-head/lib/ghc-7.7.20130323/haskell2010-1.1.1.0 "/ghc-head/lib/ghc-7.7.20130323/bin/ghc-pkg" --force --global-package-db "/ghc-head/lib/ghc-7.7.20130323/package.conf.d" update rts/package.conf.install dyld: Library not loaded: @loader_path/../terminfo-0.3.2.5/libHSterminfo-0.3.2.5-ghc7.7.20130323.dylib Referenced from: /ghc-head/lib/ghc-7.7.20130323/bin/ghc-pkg Reason: image not found make[1]: *** [install_packages] Trace/BPT trap: 5 make: *** [install] Error 2 }}} = Mac with system libffi = If I do: {{{ % make maintainer-clean % perl boot % ./configure --prefix=/ghc-head \ --with-system-libffi \ --with-ffi-includes=/usr/include/ffi \ --with-ffi-libraries=/usr/lib % make -j6 }}} hsc2hs cannot find necessary .h files. {{{ "inplace/bin/hsc2hs" '--cc=/usr/bin/gcc' '--ld=/usr/bin/gcc' --cross-safe --cflag=-m64 --cflag=-fno-stack-protector --cflag=-m64 --lflag=-m64 --cflag=-D__GLASGOW_HASKELL__=707 --cflag=-Dx86_64_HOST_ARCH=1 --cflag=-Ddarwin_HOST_OS=1 '--cflag=-m64' '--cflag=-fno-stack-protector' ' --cflag=-Icompiler/../rts/dist/build' '--cflag=-Icompiler/stage2' '-- cflag=-Icompiler/.' '--cflag=-Icompiler/parser' '--cflag=-Icompiler/utils' '--cflag=-DGHCI' '-- cflag=-I/Users/kazu/work/ghc/libraries/process/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/directory/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/unix/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/time/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/containers/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/bytestring/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/array/include' '-- cflag=-I/Users/kazu/work/ghc/libraries/base/include' '-- cflag=-I/Users/kazu/work/ghc/rts/dist/build' '-- cflag=-I/Users/kazu/work/ghc/includes' '-- cflag=-I/Users/kazu/work/ghc/includes/dist-derivedconstants/header' '-- lflag=-m64' '--lflag=-L/Users/kazu/work/ghc/libraries/transformers/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/template-haskell /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/hpc/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/hoopl/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/bin-package-db /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/binary /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/Cabal/Cabal /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/process /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/pretty /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/directory /dist-install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/unix/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/time/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/old-locale/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/filepath/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/containers/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/bytestring/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/deepseq/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/array/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/base/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/integer-gmp/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/libraries/ghc-prim/dist- install/build' '--lflag=-L/Users/kazu/work/ghc/rts/dist/build' '-- lflag=-ldl' '--lflag=-liconv' '--lflag=-lm' '--lflag=-ldl' '--lflag=-lffi' --cflag=-Icompiler/stage2/build/autogen --cflag=-include --cflag=compiler/stage2/build/autogen/cabal_macros.h compiler/ghci/LibFFI.hsc -o compiler/stage2/build/LibFFI.hs LibFFI.hsc:9:17: error: ffi.h: No such file or directory LibFFI.hsc: In function ‘main’: LibFFI.hsc:42: error: ‘ffi_cif’ undeclared (first use in this function) LibFFI.hsc:42: error: (Each undeclared identifier is reported only once LibFFI.hsc:42: error: for each function it appears in.) LibFFI.hsc:82: error: ‘ffi_status’ undeclared (first use in this function) LibFFI.hsc:82: error: expected expression before ‘int’ LibFFI.hsc:82: error: expected ‘)’ before numeric constant LibFFI.hsc:82: error: expected ‘)’ before numeric constant LibFFI.hsc:83: error: ‘ffi_abi’ undeclared (first use in this function) LibFFI.hsc:83: error: expected expression before ‘int’ LibFFI.hsc:83: error: expected ‘)’ before numeric constant LibFFI.hsc:83: error: expected ‘)’ before numeric constant LibFFI.hsc:99: error: ‘FFI_OK’ undeclared (first use in this function) LibFFI.hsc:106: error: ‘FFI_DEFAULT_ABI’ undeclared (first use in this function) compiling compiler/stage2/build/LibFFI_hsc_make.c failed (exit code 1) command was: /usr/bin/gcc -c compiler/stage2/build/LibFFI_hsc_make.c -o compiler/stage2/build/LibFFI_hsc_make.o -m64 -fno-stack-protector -I/Users/kazu/work/ghc/includes -m64 -fno-stack-protector -m64 -D__GLASGOW_HASKELL__=707 -Dx86_64_HOST_ARCH=1 -Ddarwin_HOST_OS=1 -m64 -fno-stack-protector -Icompiler/../rts/dist/build -Icompiler/stage2 -Icompiler/. -Icompiler/parser -Icompiler/utils -DGHCI -I/Users/kazu/work/ghc/libraries/process/include -I/Users/kazu/work/ghc/libraries/directory/include -I/Users/kazu/work/ghc/libraries/unix/include -I/Users/kazu/work/ghc/libraries/time/include -I/Users/kazu/work/ghc/libraries/containers/include -I/Users/kazu/work/ghc/libraries/bytestring/include -I/Users/kazu/work/ghc/libraries/array/include -I/Users/kazu/work/ghc/libraries/base/include -I/Users/kazu/work/ghc/rts/dist/build -I/Users/kazu/work/ghc/includes -I/Users/kazu/work/ghc/includes/dist-derivedconstants/header -Icompiler/stage2/build/autogen -include compiler/stage2/build/autogen/cabal_macros.h -I/Users/kazu/work/ghc/inplace/lib/include/ make[1]: *** [compiler/stage2/build/LibFFI.hs] Error 1 make: *** [all] Error 2 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: ----------------------------------+----------------------------------------- Changes (by PHO): * cc: pho@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: ----------------------------------+----------------------------------------- Changes (by goldfire): * cc: eir@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: #7686 ----------------------------------+----------------------------------------- Changes (by trommler): * cc: ptrommler@… (added) * related: => #7686 Comment: The issue "Mac with system libffi" is a duplicate of #7686. A patch for #7686 is currently under review. The two issues "without system libffi" were solved in Linux by adding an ELF rpath/runpath to the library if a library was not installed in a linker standard directory. I believe the same would work for any ELF system and IIRC FreeBSD uses ELF, too. Do we have a conditional to check for ELF system (instead of Linux as done now) in our build system? I don't know enough about mach-o to provide a "Mac without system libffi" solution. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: #7686 ----------------------------------+----------------------------------------- Changes (by heisenbug): * cc: ggreif@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: #7686 ----------------------------------+----------------------------------------- Comment(by kazu-yamamoto): = Mac with system libffi = #7686 solves the problem of hsc2hs. Build finished. But "make install" causes an error: {{{ "/Users/kazu/bin/ghc-head/lib/ghc-7.7.20130403/bin/ghc-pkg" --force --global-package-db "/Users/kazu/bin/ghc- head/lib/ghc-7.7.20130403/package.conf.d" update rts/package.conf.install dyld: Library not loaded: @loader_path/../terminfo-0.3.2.5/libHSterminfo-0.3.2.5-ghc7.7.20130403.dylib Referenced from: /Users/kazu/bin/ghc-head/lib/ghc-7.7.20130403/bin/ghc- pkg Reason: image not found make[1]: *** [install_packages] Trace/BPT trap: 5 make: *** [install] Error 2 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: #7686 ----------------------------------+----------------------------------------- Changes (by carter): * cc: carter.schonwald@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ----------------------------------+----------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Component: Build System Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Blockedby: Blocking: | Related: #7686 ----------------------------------+----------------------------------------- Changes (by byorgey): * cc: byorgey@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Changes (by igloo): * status: new => closed * difficulty: => Unknown * resolution: => fixed Comment: Fixed by #7686 fix -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Comment(by kazu-yamamoto): The problem of "Mac with system libffi" has been fixed in my environment. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Comment(by kazu-yamamoto): The problem of "Mac without system libffi" has been fixed in my environment. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Changes (by kazu-yamamoto): * status: closed => new * resolution: fixed => Comment: The problem of "FreeBSD without system libffi" has not been fixed yet. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Changes (by igloo): * status: new => closed * resolution: => fixed Comment: I've filed #7819 for that bug -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Changes (by kazu-yamamoto): * status: closed => new * resolution: fixed => Comment: = Mac without system libffi = After "make install", the installed GHC refers to libffi in the build directory. % otool -L ghc | grep libffi /Users/kazu/work/ghc/libffi/build/inst/lib/libffi.6.dylib (compatibility version 7.0.0, current version 7.0.0) So, after I did "make maintainer-clean", the installed GHC could not find a libffi. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Comment(by kazu-yamamoto): = Mac with system libffi = {{{ % ghc --version dyld: Library not loaded: /Users/kazu/work/ghc/libraries/transformers /dist-install/build/libHStransformers-0.3.0.0-ghc7.7.20130413.dylib Referenced from: /Users/kazu/bin/ghc- head/lib/ghc-7.7.20130413/bin/../haskeline-0.7.0.4/libHShaskeline-0.7.0.4-ghc7.7.20130413.dylib }}} Note that both libHShaskeline and libHStransformers are certainly installed. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7806: Dynamic linking and libffi ------------------------------------+--------------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Build System | Version: 7.7 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Installing GHC failed | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: #7686 ------------------------------------+--------------------------------------- Changes (by igloo): * status: new => closed * resolution: => fixed Comment: Please file a separate ticket for each issue, so that we can track them more easily. I've just opened #7833 for this latest one (both errors look like symptoms of the same bug to me). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7806#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC