Support automated CI build for MacOS/MacPorts or MacOS/Brew
I have been trying to support the build in a GitHub workflow ( https://github.com/giuspen/cherrytree/blob/master/.github/workflows/macos-macports.yml ) but as visible in the log of the run ( https://github.com/giuspen/cherrytree/actions/workflows/macos-macports.yml ) I am getting
an issue linking to gtkmm-3.0 ( ld: library 'gtkmm-3.0' not found )
That surprises me as pkg-config gtkmm-3.0 --cflags --libs seems correct:
pkg-config gtkmm-3.0 --cflags --libs
ls -la /opt/local/lib | grep fmt
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/opt/local/lib/libfmt9/pkgconfig"
cmake -S . -B build \
-DBUILD_TESTING=''
cmake --build build
cmake --install build
shell: /opt/local/bin/bash -e {0}
-I/opt/local/include/gtkmm-3.0 -I/opt/local/lib/gtkmm-3.0/include -I/opt/local/include/atkmm-1.6 -I/opt/local/include/gtk-3.0/unix-print -I/opt/local/include/gdkmm-3.0 -I/opt/local/lib/gdkmm-3.0/include -I/opt/local/include/giomm-2.4 -I/opt/local/lib/giomm-2.4/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/at-spi2-atk/2.0 -I/opt/local/include/at-spi-2.0 -I/opt/local/include -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/gio-unix-2.0 -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pangomm-1.4 -I/opt/local/lib/pangomm-1.4/include -I/opt/local/include/glibmm-2.4 -I/opt/local/lib/glibmm-2.4/include -I/opt/local/include/cairomm-1.0 -I/opt/local/lib/cairomm-1.0/include -I/opt/local/include/sigc++-2.0 -I/opt/local/lib/sigc++-2.0/include -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/pango-1.0 -I/opt/local/include/fribidi -I/opt/local/include -I/opt/local/include/harfbuzz -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -L/opt/local/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lgtk-3 -lgdk-3 -latk-1.0 -lcairo-gobject -lgio-2.0 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl
drwxr-xr-x 7 root wheel 224 May 24 21:21 libfmt10
drwxr-xr-x 7 root admin 224 May 24 21:21 libfmt9
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode_15.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
...
-- CT_VERSION = 1.4.0
Build tests OFF
-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'gtkmm-3.0'
-- Found gtkmm-3.0, version 3.24.9
-- Checking for module 'gtksourceview-4'
-- Found gtksourceview-4, version 4.8.4
...
-- Build files have been written to: /Users/runner/work/cherrytree/cherrytree/build
[ 1%] Generating /Users/runner/work/cherrytree/cherrytree/data/cherrytree.1.gz
[ 1%] Built target man_pages
[ 1%] Building C object src/7za/CMakeFiles/7za_static.dir/C/7zCrc.c.o
...
[ 99%] Building CXX object src/ct/CMakeFiles/cherrytree.dir/ct_main.cc.o
[100%] Building CXX object src/ct/CMakeFiles/cherrytree.dir/icons.gresource.cc.o
[100%] Linking CXX executable ../../cherrytree
ld: warning: ignoring duplicate libraries: '-latk-1.0', '-lcairo', '-lcairo-gobject', '-lcairomm-1.0', '-lcurl', '-lenchant-2', '-lfmt', '-lfribidi', '-lgdk-3', '-lgdk_pixbuf-2.0', '-lgio-2.0', '-lgspell-1', '-lgtk-3', '-lgtksourceview-4', '-lharfbuzz', '-lpango-1.0', '-lpangocairo-1.0', '-lpangomm-1.4', '-lpthread', '-lspdlog', '-lsqlite3', '-luchardet', '-lvte-2.91', '-lxml++-2.6', '-lxml2'
ld: library 'gtkmm-3.0' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [cherrytree] Error 1
make[1]: *** [src/ct/CMakeFiles/cherrytree.dir/all] Error 2
make: *** [all] Error 2
Maybe the cherrytree maintainer for MacPorts @mascguy ( https://github.com/macports/macports-ports/blob/master/editors/cherrytree/Portfile ) or a user familiar with MacOs can help me?
NOTE: the exact same issue happens with Homebrew and I raised an issue asking for their help with no luck ( https://github.com/Homebrew/homebrew-core/issues/224598 - the Homebrew workflow is https://github.com/giuspen/cherrytree/blob/master/.github/workflows/macos-brew.yml )