Skip to content

glib2 is not imported on macOS: amule.cpp: fatal error: glib.h: No such file or directory #641

Description

@barracuda156

CMakeLists requires glib2 only for Linux:

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
	find_package (PkgConfig QUIET)
	if (PkgConfig_FOUND)
		pkg_check_modules (GLIB QUIET glib-2.0)
	endif()

	if ((BUILD_MONOLITHIC OR BUILD_DAEMON OR BUILD_REMOTEGUI) AND NOT GLIB_FOUND)
		message (FATAL_ERROR
			"glib-2.0 development headers not found, but they are "
			"required to build amule (monolithic), amuled, or "
			"amulegui — these targets call g_set_prgname() to bind "
			"the Wayland wl_app_id / X11 WM_CLASS to the .desktop "
			"filename, which needs <glib.h>. "
			"Install one of:\n"
			"  - libglib2.0-dev   (Debian / Ubuntu / Mint)\n"
			"  - glib2-devel      (Fedora / RHEL / Rocky)\n"
			"  - dev-libs/glib    (Gentoo)\n"
			"  - glib             (Arch / Manjaro)\n"
			"…then re-run cmake AFTER deleting the build directory "
			"(`rm -rf build`); pkg_check_modules only runs at "
			"configure time, so installing the package on top of a "
			"cached configure won't help. pkg-config itself is also "
			"required — install `pkg-config` if cmake didn't find it.")
	endif()
endif()

However the build uses it then on macOS, and expectedly it fails:

[ 56%] Building CXX object src/CMakeFiles/amule.dir/amule.cpp.o
cd /opt/local/var/macports/build/amule-05862ffd/work/build/src && /opt/local/bin/g++-mp-14 -DAMULE_HAVE_LIBCURL=1 -DENABLE_IP2COUNTRY -DNDEBUG -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK3__ -D__WXGTK__ -I/opt/local/var/macports/build/amule-05862ffd/work/build -I/opt/local/var/macports/build/amule-05862ffd/work/build/src/libs/ec/cpp -I/opt/local/libexec/boost/1.88/include -I/opt/local/var/macports/build/amule-05862ffd/work/amule-377ec8d9d56618f1059d8705ae53a70fa4ffbe87/src/include -I/opt/local/var/macports/build/amule-05862ffd/work/amule-377ec8d9d56618f1059d8705ae53a70fa4ffbe87/src/libs -I/opt/local/var/macports/build/amule-05862ffd/work/amule-377ec8d9d56618f1059d8705ae53a70fa4ffbe87/src/icons -isystem /opt/local/include -isystem /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/3.2/lib/wx/include/gtk3-unicode-3.2 -isystem /opt/local/include/upnp -pipe -I/opt/local/libexec/boost/1.88/include -Os -framework CoreFoundation -framework CoreServices -framework ApplicationServices -framework IOKit -DNDEBUG -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/boost/1.88/include -I/opt/local/include -Damule_HAVE_LIBCURL -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/3.2/include/wx-3.2 -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/amule.dir/amule.cpp.o -MF CMakeFiles/amule.dir/amule.cpp.o.d -o CMakeFiles/amule.dir/amule.cpp.o -c /opt/local/var/macports/build/amule-05862ffd/work/amule-377ec8d9d56618f1059d8705ae53a70fa4ffbe87/src/amule.cpp
/opt/local/var/macports/build/amule-05862ffd/work/amule-377ec8d9d56618f1059d8705ae53a70fa4ffbe87/src/amule.cpp:55:10: fatal error: glib.h: No such file or directory
   55 | #include <glib.h>                       // g_set_prgname() — wl_app_id / WM_CLASS binding
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/amule.dir/amule.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/amule-05862ffd/work/build'
make[1]: *** [src/CMakeFiles/amule.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/amule-05862ffd/work/build'
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions