Error building Python-Fontconfig (Gramps for Windows with MSYS2)

Decided to step through the wiki Gramps for Windows with MSYS2 now that I have spent some time dabbling in MSYS2. Ran into one issue with this section:

The Genealogical Symbols preferences tab needs Python Fontconfig version 0.5 so we need to build it. From a suitable build directory (I use ~/build)

git clone GitHub - vayn/python-fontconfig: Python binding for Fontconfig
cd python-fontconfig/
git checkout e1b1751f52167184e0c
python3 setup.py install

Current msys2 setup has gcc version 13.2.0 and with that the last step runs in to errors compiling fontconfig.c (see end of message). Full log available if needed.

Wondering whether this is a current issue, or if the wiki is outdated because I don’t see similar steps in the pull request that is being used to build Gramps 5.2 AIO beta. Another reason I’m thinking the wiki is outdated is because @emyoulation mentioned another thread that there are some changes around symbols which may have made this step obsolete?

Errors:

fontconfig.c: In function '__pyx_tp_dealloc_10fontconfig_FcFont':
fontconfig.c:3761:5: error: lvalue required as increment operand
 3761 |     ++Py_REFCNT(o);
      |     ^~
fontconfig.c:3764:5: error: lvalue required as decrement operand
 3764 |     --Py_REFCNT(o);
      |     ^~

fontconfig.c: In function '__Pyx_GetException':
fontconfig.c:4528:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
 4528 |     tmp_type = tstate->exc_type;
      |                        ^~~~~~~~
      |                        curexc_type
fontconfig.c:4529:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
 4529 |     tmp_value = tstate->exc_value;
      |                         ^~~~~~~~~
      |                         curexc_value
fontconfig.c:4530:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
 4530 |     tmp_tb = tstate->exc_traceback;
      |                      ^~~~~~~~~~~~~
      |                      curexc_traceback



fontconfig.c:5318:15: error: too few arguments to function 'PyCode_New'
 5318 |     py_code = PyCode_New(
      |               ^~~~~~~~~~
C:/msys64/mingw64/include/python3.11/cpython/code.h:148:28: note: declared here
  148 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
      |                            ^~~~~~~~~~
fontconfig.c:5345:13: error: invalid use of incomplete typedef 'PyFrameObject' {aka 'struct _frame'}
 5345 |     py_frame->f_lineno = __pyx_lineno;
      |             ^~
error: command 'C:\\msys64\\mingw64\\bin/gcc.exe' failed with exit code 1

The wiki page was written before Jean Michault wrote a more automated script to build the installer, and create a couple of exe’s that you can run from the MSYS shell to test. You can find that script in our 5.2 branch, in the aio directory, with instructions in the README:

I ran that script here, on two machines, and works well, if you correct this text on line 67

cd D:/a/gramps/gramps/aio

to make sure that the cd command chooses a directory that you actually have. And if you cloned the repo as advised, that directory will probably be ~/gramps/aio

You will also need to make sure that you checkout the maintenance/gramps52 branch first, because that’s where this latest script lives.

The 5.2 version of Gramps no longer needs the fontconfig utility to select a font for Genealogical Symbols. Feel free to edit the Gramps for Windows with MSYS2 wiki, or perhaps better create a new wiki describing how to use the AIO scripts now included in the Gramps repository.

2 Likes

Hello @ennoborg, thanks to your nudge I ended up trying out the local build using aio\build.sh. It really has made building the aio executable much easier.

For anyone coming across this thread, a change has been submitted to maintenance/gramps52 branch which makes it so that no modification is needed to run build.sh now. Just invoke the script with the aio as the current folder and it will work.

A post was split to a new topic: AIO move of User Director from %AppData% to %LocalAppData%

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.