Bug 101280 - Build failure with 2.12.3
Summary: Build failure with 2.12.3
Status: RESOLVED MOVED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Akira TAGOH
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
: 101514 101546 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-02 17:39 UTC by Christoph Reiter
Modified: 2018-08-20 21:43 UTC (History)
7 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Christoph Reiter 2017-06-02 17:39:38 UTC
CC       fcobjs.lo
In file included from ../../fontconfig-2.12.3/src/fcobjs.c:33:0:
fcobjshash.gperf:28:1: error: conflicting types for 'FcObjectTypeHash'
../../fontconfig-2.12.3/src/fcobjs.c:28:1: note: previous declaration of 'FcObjectTypeHash' was here
 FcObjectTypeHash (register const char *str, register FC_GPERF_SIZE_T len);
 ^~~~~~~~~~~~~~~~
In file included from ../../fontconfig-2.12.3/src/fcobjs.c:33:0:
fcobjshash.gperf:172:1: error: conflicting types for 'FcObjectTypeLookup'
../../fontconfig-2.12.3/src/fcobjs.c:31:1: note: previous declaration of 'FcObjectTypeLookup' was here
 FcObjectTypeLookup (register const char *str, register FC_GPERF_SIZE_T len);
 ^~~~~~~~~~~~~~~~~~

Building on 64bit mingw (msys2)
2.12.1 Builds fine

gperf version is 3.1
FC_GPERF_SIZE_T in config.h is size_t
Comment 1 Akira TAGOH 2017-06-03 09:39:40 UTC
That is because you have newer version of gperf installed. remove src/fcobjs.hash.h and try again.
Comment 2 Akira TAGOH 2017-06-03 09:42:20 UTC
(In reply to Akira TAGOH from comment #1)
> That is because you have newer version of gperf installed. remove
> src/fcobjs.hash.h and try again.

meant src/fcobjshash.h
Comment 3 Akira TAGOH 2017-06-03 10:05:58 UTC
Fixed in git to regenerate fcobjshash.h on updating Makefile. so should be updated after configure then.
Comment 4 Christoph Reiter 2017-06-03 10:59:10 UTC
2.12.3 with the patch from git gives me this now:

$ make V=1
...
...
make[3]: Entering directory '/home/xy/M/mingw-w64-fontconfig/src/build-x86_64-w64-mingw32/fc-glyphname'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/xy/M/mingw-w64-fontconfig/src/build-x86_64-w64-mingw32/fc-glyphname'
make[2]: Leaving directory '/home/xy/M/mingw-w64-fontconfig/src/build-x86_64-w64-mingw32/fc-glyphname'
Making all in src
make[2]: Entering directory '/home/xy/M/mingw-w64-fontconfig/src/build-x86_64-w64-mingw32/src'
/bin/sh /home/xy/M/mingw-w64-fontconfig/src/fontconfig-2.12.3/missing gperf -m 100 fcobjshash.gperf > fcobjshash.h.tmp && \
mv -f fcobjshash.h.tmp fcobjshash.h || ( rm -f fcobjshash.h.tmp && false )
Cannot open input file 'fcobjshash.gperf'
make[2]: *** [Makefile:906: fcobjshash.h] Error 1
make[2]: Leaving directory '/home/xy/M/mingw-w64-fontconfig/src/build-x86_64-w64-mingw32/src'
make[1]: *** [Makefile:581: all-recursive] Error 1
make[1]: Leaving directory '/home/xy/M/mingw-w64-fontconfig/src/build-x86_64-w64-mingw32'
make: *** [Makefile:465: all] Error 2
Comment 5 Akira TAGOH 2017-06-03 11:52:07 UTC
Hmm, where is fcobjshash.gperf then?
Comment 6 Christoph Reiter 2017-06-03 11:56:25 UTC
Not 100% sure, but fcobjshash.gperf exists in the srcdir but not in the builddir where the command is executed.
Comment 7 Akira TAGOH 2017-06-05 11:46:17 UTC
Hm, then removing fcobjshash.gperf should be the workaround.
Comment 8 Akira TAGOH 2017-06-05 12:02:33 UTC
should be fixed in https://cgit.freedesktop.org/fontconfig/commit/?id=28139816d62b8444ca61a000a87c71e59fef104d

Please test.
Comment 9 Christoph Reiter 2017-06-05 14:44:13 UTC
Now I get

In file included from ../../fontconfig-2.12.3/src/fcobjs.c:33:0:
fcobjshash.gperf:28:1: error: conflicting types for 'FcObjectTypeHash'
 "aspect",FC_ASPECT_OBJECT
 ^~~~~~~~~~~~~~~~
../../fontconfig-2.12.3/src/fcobjs.c:28:1: note: previous declaration of 'FcObjectTypeHash' was here
 FcObjectTypeHash (register const char *str, register FC_GPERF_SIZE_T len);
 ^~~~~~~~~~~~~~~~
In file included from ../../fontconfig-2.12.3/src/fcobjs.c:33:0:
fcobjshash.gperf:172:1: error: conflicting types for 'FcObjectTypeLookup'
../../fontconfig-2.12.3/src/fcobjs.c:31:1: note: previous declaration of 'FcObjectTypeLookup' was here
 FcObjectTypeLookup (register const char *str, register FC_GPERF_SIZE_T len);
 ^~~~~~~~~~~~~~~~~~
Comment 10 Akira TAGOH 2017-06-06 02:51:37 UTC
Can you give me more detailed logs? after those changes, fcobjshash.gperf and fcobjshash.h should be regenerated and that error should be gone though.
Comment 11 guido 2017-06-06 13:18:41 UTC
Removing both src/fcobjshash.h and src/fcobjshash.gperf and re-running configure solves the issue.

Thanks !
Comment 12 Akira TAGOH 2017-06-20 08:01:40 UTC
just made a testing tarball from current git and tried to build without any trick. I can see no problem. so closing.
Comment 13 Akira TAGOH 2017-06-20 12:18:02 UTC
*** Bug 101514 has been marked as a duplicate of this bug. ***
Comment 14 Akira TAGOH 2017-06-22 03:15:52 UTC
*** Bug 101546 has been marked as a duplicate of this bug. ***
Comment 15 Jussi Kukkonen [inactive] 2017-08-14 07:33:19 UTC
I'm reopening as I can reproduce 100% with 2.12.4:
 * building out-of-tree
 * using a tarball release
 * gperf 3.1


The reason seems clear to me:
 * src/fcobjshash.h is still shipped in the tarball
 * It's referred to with "#include "fcobjshash.h"
This leads to compiler always looking into the source directory first, and always finding the shipped header and using that. The new generated version is never even considered.

Is there a reason to ship the header if it's nowadays also always generated?
Comment 16 Akira TAGOH 2017-08-15 09:21:23 UTC
No, not at all I suppose. fixed in git. thank you for pointing that out.
Comment 17 FederatedJam 2018-01-03 07:20:02 UTC
Which commit fixes this?
Comment 18 Gab 2018-02-27 15:30:28 UTC
The version 2.12.6 of Fontconfig still has this problem of conflicting types of parameters of the functions FcObjectTypeHash() and FcObjectTypeLookup(), if compiled in a directory other than the directory "fontconfig-2.12.6".

I obtained the source from
https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.6.tar.gz


### I did the following

mkdir fontconfig-2.12.6-build
cd fontconfig-2.12.6-build
../fontconfig-2.12.6/configure
make


### Actual Result

The "make" was terminated with the following error messages.


In file included from fontconfig-2.12.6/src/fcobjs.c:33:
fcobjshash.gperf:28:1: error: conflicting types for 'FcObjectTypeHash'
FcObjectTypeHash (register const char *str, register size_t len)
^
fontconfig-2.12.6/src/fcobjs.c:28:1: note: previous declaration is here
FcObjectTypeHash (register const char *str, register FC_GPERF_SIZE_T len);
^
In file included from fontconfig-2.12.6/src/fcobjs.c:33:
fcobjshash.gperf:166:1: error: conflicting types for 'FcObjectTypeLookup'
FcObjectTypeLookup (register const char *str, register size_t len)
^
fontconfig-2.12.6/src/fcobjs.c:31:1: note: previous declaration is here
FcObjectTypeLookup (register const char *str, register FC_GPERF_SIZE_T len);
^
2 errors generated.
make[3]: *** [fcobjs.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


### Workaround

By configuring and compiling in the directory "fontconfig-2.12.6" instead of "fontconfig-2.12.6-build", this problem of conflicting types can be avoided, and the "make" successfully completes.

    rm -r fontconfig-2.12.6-build
    rm -r fontconfig-2.12.6
    tar -xpf fontconfig-2.12.6.tar.gz

cd fontconfig-2.12.6
./configure
make


### Environment

Fontconfig 2.12.6
Mac OS X
Intel 64-bit
Comment 19 Akira TAGOH 2018-02-28 03:46:17 UTC
attach the config.log please. we don't ship fcobjshash.gperf anymore. thus it should be generated at the build time as well as fcobjshash.h where that error is coming from. however you have a conflict on the type of len. also check the timestamp for those files too.
Comment 20 Akira TAGOH 2018-03-05 10:28:13 UTC
confirmed the build with gperf-3.1 which generates the hash with size_t len and 3.0.4 which generates the hash with unsigned int len.

If gperf isn't installed on the system, the build will simply be stopped. not like that reason. so this should be fixed.
I don't know how you build fontconfig on your box and see that though, you probably misconfigured or may have both versions of gperf installed and referring different on configure and build.

Anyway, closing.
Comment 21 Carlos Sánchez de La Lama 2018-03-27 13:42:24 UTC
This is still happening in fontconfig-2.13.0 when builddir != srcdir, as Comment 18 says.

fcobjshash.h is indeed regenerated, but fcobjs.c has an

#include "fcobjshash.h"

which searchs in current file directory first, and therefore sees the shipped fcobjshash.h (in srcdir) and uses it, instead of the regenerated fcobjshash.h (in builddir).

A possible solution is changing the quoting to:
#include <fcobjshash.h>

which would search system directories (finding nothing) and then the included directories in compile command line, which place builddir before srcdir.

Another is not shippinh fcobjshash.h at all.
Comment 22 Philip Chimento 2018-04-08 19:43:25 UTC
Indeed, removing src/fcobjshash.h from the srcdir seems to make everything work fine. I would recommend not shipping it in the tarball as well.
Comment 23 GitLab Migration User 2018-08-20 21:43:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/10.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.