Trying to build gnucash from source (cmake), getting "No package 'glib-2.0' found"


I’m trying to build gnucash from source (rather than using the rpm package or
flatpak for python bindings) on Linux (Fedora 37) and keep running into an
issue where on build I get the error:

-- Checking for module 'glib-2.0>=2.56.1'
--   No package 'glib-2.0' found

What I’ve tried so far:

  • I’ve installed glib2.0-devel via sudo dnf install glib2-devel
  • I’ve checked via yum provides */glib2.0.pc which shows it is in the
    /usr/lib64/pkgconfig directory.
  • I’ve checked the contents of echo $PKG_CONFIG_PATH which shows
    directories like /usr/lib64/pkgconfig are listed.
  • I’ve tried building gnucash with various different arguments, but similar
    to the directions in
    CMake - GnuCash &
    Building On Linux - GnuCash
    I’ve tried in my build directory:
    and get the glib error. It happens also without the CMAKE_PREFIX_PATH, just
    running plain cmake . in the gnucash source directory, etc.

Any idea what I’m missing to get things to build? I’ve gotten debian/ubuntu-specific advice but it doesn’t quite apply on fedora/redhat distros.

The CMakeLists.txt ( source ) doesn’t seem to have anything too special for checking for Glib, just:

# glib et al.
pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.56.1)

Thanks in advance,

(note: I’m crossposting this from my post in the gnucash-user mailing list: [GNC] Building Gnucash on Fedora 37 - "No package 'glib-2.0' found" error )

What version of glib2 is installed?
dnf list installed glib* should give you both glib2 and glibc packages.

I really don’t understand why you should be adverse to using the rpm version of gnucash. I use it consistently and have for years.

I just checked, and I have glib2 and glib2-devel both installed but the file you show glib2.0.pc does not exist on my system. dnf provides */glib2.0.pc also does not return a value so it seems that file is not part of an installed (or available) package.

Specifically, at what stage of the build do you see this error? Is it in the configuration stage? or in the actual make stage?

I have not downloaded the source for gnucash nor tried compiling it so cannot visualize where the error is occurring. Maybe if you posted a large enough part of the make output that shows the error and some preceding data it may help us to assist.

Also note that with a failed compile it is usually best to do a ‘make clean’ after the failure before trying to run the make again.

glib is 2.72 in F36, so we definitely have a new enough version.

I’d suggest looking at the rpm spec file, which is quite literally instructions for successfully building the package on Fedora Linux. Make sure all the build requirements are in place, check out any of the patches and see if they’re relevant, and look at the %build section for workarounds and clues.


The name of the “.pc” file is /usr/lib64/pkgconfig/glib-2.0.pc and is provides by glib2-devel

1 Like


Guess I need to do a better job of noting typos. My error.

Thanks. Still a bit stumped on the glib-2.0 issue, but from looking at the rpm spec file you linked i realized I can workaround by:

  • install gnucash from dnf, since the spec file does include python bindings
  • finding where the gnucash python bindings get installed ( in this case /usr/lib64/python3.11/site-packages/gnucash )
  • temporarily running the appropriately versioned python (i tend to use pyenv/linuxbrew) and importing the site-packages library that includes gnucash (e.g. in python: import sys; sys.path.insert(0, "/usr/lib64/python3.11/site-packages/gnucash"))

(again, this is digressing from the original question of compiling gnucash and dealing with the glib-2.0 error, and not the cleanest way to use python libraries, but good enough for my current needs).

Thanks again,

On Stack Exchange, they call this an “x y problem” — you’re asking about “x”, but really trying to do “y”. We could probably come up with a better answer for “x”, [1] but probably can actually help you best if we all step back and you tell us what problem you are trying to solve by building yourself in the first place.

  1. in your case here, what’s going on with gnucash’s build defaults and why aren’t they finding the library on your system ↩︎


Based on this statement, I ran

 dnf repoquery --requires --srpm gnucash

which shows glib2-devel not in the listing so I assume you skipped the check. Run and compare the listing with your system. Although you’re using source [GNU (I assume) and not source rpm (srpm)], it might be beneficial to download the srpm as a reference. Then you could run any commands on it to find info. Once you download srpm, a similar command to above is

rpm -qp --requires gnucash...src.rpm

This is a large and complex subject making it hard to provide an answer without thinking, “I’m going to step in a big pile on this.” Therefore, I applaud mattdm’s reply with a click on heart.

The packages needed to build a package is specified by the BuildRequires: entries in the spec file. You can use dnf-builddep to automatically install those dependencies.