[GHC] #7806: Dynamic linking and libffi

GHC cvs-ghc at haskell.org
Tue Apr 2 10:26:18 CEST 2013


#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



More information about the ghc-tickets mailing list