Re: fatal error: pthread.h: No such file or directory

suzuki toshiya <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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 <[email protected]> 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.
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.