Reputation: 14729
I cannot make glib. On a kubuntu installation, I run ./configure without any options. But what I run make, I get the following error:
make[4]: Entering directory `/home/software/glib/glib-2.40.0/gobject'
CCLD libgobject-2.0.la
../libtool: line 6003: cd: (libdir): No such file or directory
libtool: link: cannot determine absolute directory name of `(libdir)'
As far as I am aware, all the dependencies are met. I tried to set libdir or LIBDIR as a configure option:
libdir=/usr/local/lib/ && ./configure
I have been searching the net, tried compiling an older version of glib but I am still completely lost.
[Edit] It appears that the following search results are relevant:
https://bbs.archlinux.org/viewtopic.php?id=182353
Hi,I also get the same problem when I cross compilig the glib. Then,I finally solved the problem by set the LIBFFI_LIBS and LIBFFI_CFLAGS. My problem was because I just build libffi simply, but it need to fix to install header in the right place (/usr/include) and modify the /usr/lib/pkgconfig/libffi.pc .
I also compiled libffi myself, without any specific configuration options.
and
https://lists.gnu.org/archive/html/guile-devel/2014-04/msg00056.html
What is the output of "pkg-config --libs libffi" on your system?
-L\$(libdir) -lffi-> Bingo! Good question :-)
In my case, it's:
~/download/software/glib/glib-2.40.0 $ grep -H '^LIBFFI' */Makefile
build/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
build/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
docs/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
docs/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
gio/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
gio/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
glib/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
glib/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
gmodule/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
gmodule/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
gobject/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
gobject/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
gthread/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
gthread/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
m4macros/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
m4macros/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
tests/Makefile:LIBFFI_CFLAGS = -I/usr/local/lib/libffi-3.1/include
tests/Makefile:LIBFFI_LIBS = -L\$\(libdir\) -lffi
After reading the above, I tried the following but the result is the same (and the output of the grep command above is the same):
LIBFFI_LIBS=/usr/local/lib/ && ./configure
Let me know what variables, settings or information to provide that could make debugging this problem easier.
[Edit 2] I found this file: /usr/local/lib/pkgconfig/libffi.pc with the following content:
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
toolexeclibdir=$(libdir)
includedir=${libdir}/libffi-3.1/include
Name: libffi
Description: Library supporting Foreign Function Interfaces
Version: 3.1
Libs: -L${toolexeclibdir} -lffi
Cflags: -I${includedir}
I am not sure what values to replace by what, but I'll try...
Upvotes: 1
Views: 3325
Reputation: 14729
I managed to compile glib.
The problem was indeed in the file /usr/local/lib/pkgconfig/libffi.pc which I quoted in the second edit to the question.
The line:
toolexeclibdir=$(libdir)
should be changed to
toolexeclibdir=${libdir}
in order to conform to the pkg-config syntax.
Having done so, I could finally make glib without problems.
There are two easier follow up questions that you may post as an answer for me to accept:
1) Is the faulty syntax in libffi.pc a bug in libffi itself? Who is responsible for creating the .pc files? [Edit: Looking at the source code of libffi, it seems that they are responsible for the original bug. I am going to report it so that it gets fixed. Thanks.]
2) what can I learn from this whole bug? I wasted a lot of time debugging this and searching for a solution. What trick or know-how would have helped me find the solution quiker?
Upvotes: 2