[cairo] fatal error: pthread.h: No such file or directory

suzuki toshiya mpsuzuki at hiroshima-u.ac.jp
Sun Jul 5 04:28:29 PDT 2015


Congratulations.

Maybe you wondered why I don't mention PKG_CONFIG_LIBDIR
promptly. Recently I'm impressed as so many cross-building
people ask why PKG_CONFIG_PATH does not work well. I thought
there might be some false guru promoting PKG_CONFIG_PATH.
I didn't want people to follow any guru on the internet,
I want people to read the official documents bundled to
the tools in their hands.

I wish you could finish your product successfully.

Regards,
mpsuzuki

YuGiOhJCJ Mailing-List wrote:
> Yes, you are right I have not answered to your question.
> Here is the answer: I am sure that nobody told me to use PKG_CONFIG_PATH.
> In fact, that is just because I have read the pkg-config manual and found that the PKG_CONFIG_PATH environment variable could be useful to find correctly my *.pc files.
> I was not aware that there was better than PKG_CONFIG_PATH probably because I have not read carefully the manual of pkg-config.
> I am reading again this manual and I think "PKG_CONFIG_LIBDIR" is what I am looking for: "Replaces the  default  pkg-config search directory, usually /usr/lib/pkgconfig".
> It seems to be better than PKG_CONFIG_PATH because as it is written in the manual, with PKG_CONFIG_PATH: "The default directory will always be searched after searching the path".
> So, it is just me that does not use correctly pkg-config program.
> Sorry about that.
> 
> I have just cross-compiled glib and now the problem is solved.
> Thank you a lot.
> 
> On Sun, 05 Jul 2015 19:01:32 +0900
> suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp> wrote:
> 
>> YuGiOhJCJ Mailing-List wrote:
>>> This command line is very important when I am cross-compiling:
>>> PKG_CONFIG_PATH="/usr/i686-pc-mingw32/lib/pkgconfig"
>> I ask "who told you to do such", not "why you do such".
>> I know what you want to do.
>>
>> If you read pkg-config manual carefully, you will find
>> that PKG_CONFIG_PATH do not exclude the header files
>> for the building platform, so it is not good for the
>> cross-building for the platform with very different nature.
>>
>> If you read pkg-config manual carefully, you will find
>> something better than PKG_CONFIG_PATH.
>>
>>> What is strange is that if glib is a requirement for cross-compiling cairo, why the configure script does not tell me that it is missing for my cross-compiler?
>> For first, glib is required if you want to make cairo-
>> gobject. I don't know if you need cairo-gobject /or not.
>>
>> In next, as I've written in above, using PKG_CONFIG_PATH
>> for cross-compiling is not good idea (I ask again, who
>> told you to use it?). It could not separate the packages
>> for building & target platforms. So, as far as glib for
>> the building platform is installed, pkg-config will act
>> as "glib is available".
>>
>> If you complain as "why pkg-config does not check the
>> headers/libraries are compatible with the compiler/linker?",
>> you will complain almost all packages using pkg-config.
>> pkg-config is a tool to search a package quickly, by
>> package name, without testing compiling and linking.
>> I think it is a designed feature. People using pkg-config
>> in their configure script would agree with its designed
>> feature.
>>
>> Regards,
>> mpsuzuki
>>
>>> Without this command line, the "pkg-config" program will use this path "/usr/lib/pkgconfig" by default.
>>> The "/usr/lib/pkgconfig" path contains *.pc files that are useful when you do not cross-compile.
>>>
>>> See the difference of the content for these *.pc files:
>>> /usr/lib/pkgconfig/sdl.pc:
>>>  [...]
>>>  prefix=/usr
>>>  [...]
>>>  Libs: -L${libdir} -Wl,-rpath,${libdir} -lSDL  -lpthread
>>>  [...]
>>> /usr/i686-pc-mingw32/lib/pkgconfig/sdl.pc:
>>>  [...]
>>>  prefix=/usr/i686-pc-mingw32
>>>  [...]
>>>  Libs: -L${libdir}  -lmingw32 -lSDLmain -lSDL  -mwindows
>>>  [...]
>>>
>>> You can clearly see here that the prefix and libraries information in these files matches to the linux compiler when the path is "/usr/lib/pkgconfig" whereas they matches to the (linux to windows) cross-compiler when the path is "/usr/i686-pc-mingw32/lib/pkgconfig".
>>> So, that is why I am using this command line before cross-compiling.
>>>
>>> Indeed you are right, the path of glib is not correct as we can see in the error messages.
>>> I think it is because glib is not at all installed for my cross-compiler.
>>> If you check the list of libraries I give in the previous e-mail, you will see that glib is not available.
>>> What is strange is that if glib is a requirement for cross-compiling cairo, why the configure script does not tell me that it is missing for my cross-compiler?
>>> Also, why the configure script choose the "/usr/include/glib-2.0" path for the glib headers?
>>> Do you think that if I cross-compile glib, the configure script will find it and will use the correct path automatically and solve my problem?
>>>
>>> On Sun, 05 Jul 2015 11:16:09 +0900
>>> suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp> wrote:
>>>
>>>>> That is how I am doing to cross-compile cairo-1.14.2:
>>>>> $ PKG_CONFIG_PATH="/usr/i686-pc-mingw32/lib/pkgconfig"
>>>> Who told you to do such? Clearly it does not fit to
>>>> the cross building, as you see that GLib header files
>>>> for the building system are included, like,
>>>>
>>>>> In file included from /usr/include/glib-2.0/glib.h:107:0,
>>>>>                  from /usr/include/glib-2.0/gobject/gbinding.h:28,
>>>>>                  from /usr/include/glib-2.0/glib-object.h:23,
>>>> YuGiOhJCJ Mailing-List wrote:
>>>>> Hello,
>>>>>
>>>>> I try to cross-compile cairo-1.14.2 (because it is a dependency for gtk+-2.24.20).
>>>>> I do this with my cross-compiler (linux to windows) built with mingw32 and including all these libraries:
>>>>> binutils-2.24.51
>>>>> bzip2-1.0.6
>>>>> expat-2.1.0
>>>>> fontconfig-2.11.1
>>>>> freeglut-2.8.1
>>>>> freetype-2.4.10
>>>>> gcc-4.9.1
>>>>> gettext-0.18.2.1
>>>>> gtk+-1.2.10
>>>>> libffi-3.0.13
>>>>> libiconv-1.14
>>>>> libxml2-2.9.2
>>>>> libxmp-4.2.8
>>>>> mesa-9.1.3
>>>>> mingwrt-3.20.2
>>>>> sdl-1.2.15
>>>>> sdl-mixer-1.2.12
>>>>> sdl-net-1.2.8
>>>>> sdl-ttf-2.0.11
>>>>> smpeg-r389
>>>>> w32api-3.17.2
>>>>> xmp-4.0.8
>>>>> zlib-1.2.8
>>>>>
>>>>> That is how I am doing to cross-compile cairo-1.14.2:
>>>>> $ PKG_CONFIG_PATH="/usr/i686-pc-mingw32/lib/pkgconfig"
>>>>> $ tar xvf cairo-1.14.2.tar.xz
>>>>> $ cd cairo-1.14.2
>>>>> $ ./configure --prefix=/usr/i686-pc-mingw32 --host=i686-pc-mingw32 --enable-win32 --enable-win32-font --disable-xlib --disable-xlib-xrender --disable-xcb --disable-xlib-xcb --disable-xcb-shm --disable-pthread --without-x
>>>>> $ make
>>>>> [...]
>>>>> make[4]: Entering directory `/tmp/build/cairo-1.14.2/util/cairo-gobject'
>>>>>   CC       libcairo_gobject_la-cairo-gobject-enums.lo
>>>>> In file included from /usr/include/glib-2.0/glib.h:107:0,
>>>>>                  from /usr/include/glib-2.0/gobject/gbinding.h:28,
>>>>>                  from /usr/include/glib-2.0/glib-object.h:23,
>>>>>                  from cairo-gobject.h:44,
>>>>>                  from cairo-gobject-enums.c:8:
>>>>> /usr/include/glib-2.0/glib/deprecated/gthread.h:128:21: fatal error: pthread.h: No such file or directory
>>>>>  #include <pthread.h>
>>>>>                      ^
>>>>> compilation terminated.
>>>>> make[4]: *** [libcairo_gobject_la-cairo-gobject-enums.lo] Error 1
>>>>> make[4]: Leaving directory `/tmp/build/cairo-1.14.2/util/cairo-gobject'
>>>>> make[3]: *** [all-recursive] Error 1
>>>>> make[3]: Leaving directory `/tmp/build/cairo-1.14.2/util'
>>>>> make[2]: *** [all] Error 2
>>>>> make[2]: Leaving directory `/tmp/build/cairo-1.14.2/util'
>>>>> make[1]: *** [all-recursive] Error 1
>>>>> make[1]: Leaving directory `/tmp/build/cairo-1.14.2'
>>>>> make: *** [all] Error 2
>>>>>
>>>>> That is the first time I can't cross compile a library with my cross-compiler.
>>>>> I don't know exactly why it is looking for the "pthread.h" header because my cross-compiler is not supporting threads and because I have given the "--disable-pthread" option to the configure script.
>>>>>
>>>>> When I am looking at the /tmp/build/cairo-1.14.2/util/cairo-gobject/Makefile file where the problem is found, I see this rule:
>>>>> libcairo_gobject_la-cairo-gobject-enums.lo: cairo-gobject-enums.c
>>>>> 	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcairo_gobject_la_CFLAGS) $(CFLAGS) -MT libcairo_gobject_la-cairo-gobject-enums.lo -MD -MP -MF $(DEPDIR)/libcairo_gobject_la-cairo-gobject-enums.Tpo -c -o libcairo_gobject_la-cairo-gobject-enums.lo `test -f 'cairo-gobject-enums.c' || echo '$(srcdir)/'`cairo-gobject-enums.c
>>>>> 	$(AM_V_at)$(am__mv) $(DEPDIR)/libcairo_gobject_la-cairo-gobject-enums.Tpo $(DEPDIR)/libcairo_gobject_la-cairo-gobject-enums.Plo
>>>>>
>>>>> I think it is not normal that the "/usr/include/glib-2.0/glib/deprecated/gthread.h" file appears in the error message because this file is part of the headers available in my linux system.
>>>>> As I am cross-compiling cairo for windows, I should not see that.
>>>>> Maybe the problem is relative to libtool.
>>>>>
>>>>> Any idea why I got this error message please?
>>>>>
>>>>> Thank you.
>>>>> Best regards.


More information about the cairo mailing list