Re: Ubuntu missing: FFI_INCLUDE_DIRS

"lexfiend" <[email protected]> Mon, 14 Nov 2011 06:20:55 -0000
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>

--- In [email protected], Oscar Martinez <wasi.network@...> wrote:
>
> 2011/1/31 Petr Man <petr@...>
> 
> >
> >
> > On Mon, Jan 31, 2011 at 07:22, Friedrich Dominicus
> > <frido@... <frido%40q-software-solutions.de>> wrote:
> > >
> > > "nelsonov" <lnelson@... <lnelson%40nelnet.org>> writes:
> > >
> > > > cmake is complaining about "missing: FFI_INCLUDE_DIRS":
> > > >
> > > > -- checking for one of the modules 'libffi'
> > > > -- found libffi, version 3.0.9
> > > > -- Could NOT find FFI (missing: FFI_INCLUDE_DIRS)
> > > >
> > > > It is finding libffi but apparently not finding the include files.
> > > > This is on Ubuntu 10.04.1. Does anyone know how to resolve this
> > > > dependency? It's been driving me nuts for several days.
> > > Ubuntu is debian based and they have different packages for use and
> > > development. In your case something like
> > >
> > > instlal libffi-dev or the like will install the needed files for
> > > development. E.g on my Debian it would be
> > > apt-get instll libffi-dev
> > >
> > > I bet Ubuntus solutions is very similiar
> >
> > I would also check where exactly the include files are, I noticed in
> > the past, that libffi tends to be in non-standard locations. I
> > remember it was the case with Arch.
> > 
> >
> 
> For example, on 32 bit Debian based distros the include headers are located
> in /usr/include/i486-linux-gnu. But this should not be a problem if its
> pkg-config was correct.
> 
> A temporary fix should be to test for those non-standard locations in the
> FindFFI.cmake module (I think I tested this some time ago, will look at it)
> 
> Meanwhile, a solution for nelsonov, would be to disable the addon
> compilation commenting out the line "add_subdirectory(CFFI)" in
> addons/CMakeLists.txt
> 
> omf

Apologies for following up on such an old thread, but I ran into the same issue when building the latest source on Ubuntu 10.10.  I've never written CMakefiles before, but it seemed rather odd to me that FindFFI.cmake doesn't use pkg-config to populate FFI_INCLUDE_DIRS, so I hacked the patch below and it seems to work fine.  Hope that helps someone.


*** io.git/modules/FindFFI.cmake.orig   2010-09-02 18:06:18.000000000 +0800
--- io.git/modules/FindFFI.cmake        2011-11-14 13:01:40.000000000 +0800
***************
*** 20,25 ****
--- 20,26 ----
  PKG_SEARCH_MODULE( FFI ${_pkgconfig_REQUIRED} libffi )
  IF ( PKG_CONFIG_FOUND )
  SET ( FFI_FOUND TRUE )
+ execute_process(COMMAND pkg-config --variable=includedir libffi OUTPUT_VARIABLE FFI_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
  ENDIF ( PKG_CONFIG_FOUND )
  
  IF ( NOT FFI_FOUND AND NOT PKG_CONFIG_FOUND )