PCL - Glib从源代码编译,FFI链接

时间:2013-08-07 13:10:27

标签: compiler-construction glib ffi point-cloud-library

我需要在没有root访问权限的Linux服务器上安装PCL(点云库)。然后我下载了源代码并检查了依赖性。我们走了......

这些是我发现的依赖项:

PCL
--BOOST
----ZLIB
----BZIP
--EIGEN
--FLANN
----HDF5
----LIBUSB
------UDEV
--------GLIB
----------LIBFFI
----------ZLIB 
--VTK

我需要从源代码编译glib。 Glib需要FFI库,所以我下载了它们,编译并安装在

/home/franz/Downloads/libffi-3.0.13/installed

然后我设置了这些变量:

    LD_LIBRARY_PATH=/home/franz/Downloads/libffi-3.0.13/installed/lib
    LIBFFI_CFLAGS="-I/home/franz/Downloads/libffi-3.0.13/installed/lib/libffi-3.0.13/include" LIBFFI_LIBS="-lffi -L/home/franz/Downloads/libffi-3.0.13/installed/lib"

然后./configure和make。我收到了这些错误:

make[4]: Entering directory `/home/franz/Downloads/glib-2.37.5/gobject'
/bin/bash ../libtool  --tag=CC   --mode=link gcc -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=missing-include-dirs -g -O2   -o gobject-query gobject-query.o ./libgobject-2.0.la ../glib/libglib-2.0.la 
libtool: link: gcc -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=missing-include-dirs -g -O2 -o .libs/gobject-query gobject-query.o  ./.libs/libgobject-2.0.so -L/home/franz/Downloads/libffi-3.0.13/installed/lib /home/franz/Downloads/glib-2.37.5/glib/.libs/libglib-2.0.so ../glib/.libs/libglib-2.0.so -lpthread -lrt -Wl,-rpath -Wl,/home/franz/Downloads/glib-2.37.5/installed/lib
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_void'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_double'
./.libs/libgobject-2.0.so: undefined reference to `ffi_prep_cif'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_sint32'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_float'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_uint64'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_sint64'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_pointer'
./.libs/libgobject-2.0.so: undefined reference to `ffi_type_uint32'
./.libs/libgobject-2.0.so: undefined reference to `ffi_call'

然后我看到我想在configure中包含和设置LIBFFI_CFLAGS / LIBS的库在make中不存在,所以我更改了我的CC变量以强制我的编译器使用我的库:

LIBFFI_CFLAGS="-I/home/franz/Downloads/libffi-3.0.13/installed/lib/libffi-3.0.13/include" LIBFFI_LIBS="-lffi -L/home/franz/Downloads/libffi-3.0.13/installed/lib" ZLIB_CFLAGS="-I/home/franz/Downloads/zlib-1.2.8/installed/include" ZLIB_LIBS="-L/home/franz/Downloads/zlib-1.2.8/installed/lib" CC="gcc $LIBFFI_CFLAGS $LIBFFI_LIBS" CXX="/usr/bin/g++-4.4 $LIBFFI_CFLAGS $LIBFFI_LIBS" ./configure --prefix=`pwd`/installed

并制作

通过这种方式而不是制作过程中的gcc,我们将获得gcc -I ... -lffi -L ... 这到目前为止一直有效。但现在我在另一个位置得到了同样的错误:

make[4]: Entering directory `/home/franz/Downloads/glib-2.37.5/gio'
/bin/bash ../libtool  --tag=CC   --mode=link gcc -I/home/franz/Downloads/libffi-3.0.13/installed/lib/libffi-3.0.13/include -lffi -L/home/franz/Downloads/libffi-3.0.13/installed/lib -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=missing-include-dirs -g -O2   -o gio-querymodules gio-querymodules.o ../glib/libglib-2.0.la ../gobject/libgobject-2.0.la ../gmodule/libgmodule-2.0.la libgio-2.0.la 

libtool: link: gcc -I/home/franz/Downloads/libffi-3.0.13/installed/lib/libffi-3.0.13/include -Wall -Wstrict-prototypes -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=missing-include-dirs -g -O2 -o .libs/gio-querymodules gio-querymodules.o  -L/home/franz/Downloads/libffi-3.0.13/installed/lib ../glib/.libs/libglib-2.0.so ../gobject/.libs/libgobject-2.0.so ../gmodule/.libs/libgmodule-2.0.so ./.libs/libgio-2.0.so -L/home/franz/Downloads/zlib-1.2.8/installed/lib /home/franz/Downloads/glib-2.37.5/gobject/.libs/libgobject-2.0.so /home/franz/Downloads/glib-2.37.5/gmodule/.libs/libgmodule-2.0.so -ldl /home/franz/Downloads/glib-2.37.5/glib/.libs/libglib-2.0.so -lpthread -lrt /home/franz/Downloads/libffi-3.0.13/installed/lib/../lib/libffi.so -lresolv -Wl,-rpath -Wl,/home/franz/Downloads/glib-2.37.5/installed/lib -Wl,-rpath -Wl,/home/franz/Downloads/libffi-3.0.13/installed/lib/../lib
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_void'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_double'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_prep_cif'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_sint32'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_float'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_uint64'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_sint64'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_pointer'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_type_uint32'
../gobject/.libs/libgobject-2.0.so: undefined reference to `ffi_call'

问题在于,在这种情况下,库存在(您可以看到-lffi -L<ffi_libs_path>但错误看起来与以前相同)。

知道怎么做这个工作吗?我再说一遍,我无法安装库,因为我无法访问root权限。任何建议都将不胜感激。

2 个答案:

答案 0 :(得分:3)

使用

export LIBFFI_LIBS="-L/your/path/to-ffi libraries/ -lffi"

答案 1 :(得分:-1)

./ configure之后,您可以编辑Makefile 找到“ LIBFFI_LIBS = ...”,并在末尾添加“ -lffi”。 例如“ LIBFFI_LIBS = -L / work / opencv-static / libffi-3.2.1 / output / lib -lffi”