Issues building on MacOS 12.3.1 (Monterey)
Version, Operative system
OS: MacOS 12.3.1 (Monterey)
Using code from master branch as of today (last commit was 5dc7a5f).
Describe the bug
I followed to the letter the instructions provided in the README to compile the application on MacOS and got errors in the process. It seems related to gtkmm3, since I get ld: library not found for -lgtkmm-3.0 during ./build.sh.
To Reproduce Steps to reproduce the behavior (copied from the README):
brew install cmake ninja pkg-config python3 adwaita-icon-theme fmt gspell gtksourceviewmm3 libxml++ spdlog uchardet curl
brew install --cask basictex
sudo tlmgr update --self
sudo tlmgr install dvipng
git clone https://github.com/giuspen/cherrytree.git
cd cherrytree
git submodule update --init
./build.sh
Which returns the following output:
➜ cherrytree git:(master) ./build.sh
CMAKE_BUILD_TYPE=Debug
-- CT_VERSION = 0.99.47
Build tests ON, auto run ON
Using fmt, spdlog from: SHARED LIB
/Users/telmo/Development/Personal/cherrytree/src/ct/icons.gresource.cc up to date
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/telmo/Development/Personal/cherrytree/build
Starting ninja build with up to 8 parallel jobs...
[1/9] Linking CXX executable cherrytree
FAILED: cherrytree
: && /usr/bin/g++ -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names src/ct/CMakeFiles/cherrytree.dir/ct_main.cc.o src/ct/CMakeFiles/cherrytree.dir/icons.gresource.cc.o -o cherrytree -L/usr/local/lib -L/usr/local/opt/gettext/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/opt/gettext/lib src/ct/libcherrytree_shared.a -framework Foundation -framework AppKit -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 -lcairomm-1.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgtksourceviewmm-3.0 -lgtksourceview-3.0 -lgspell-1 -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 -lcairomm-1.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgtksourceviewmm-3.0 -lgtksourceview-3.0 -lgspell-1 -lenchant-2 -lxml++-2.6 -lxml2 -lsqlite3 -lcurl -luchardet -lpthread src/7za/lib7za_static.a -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lintl -lsigc-2.0 -lfmt -lspdlog -lfmt -lspdlog && :
ld: warning: directory not found for option '-L/usr/local/opt/gettext/lib'
ld: library not found for -lgtkmm-3.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[3/9] Building CXX object tests/googletest/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
ninja: build stopped: subcommand failed.
I do have gtkmm3 installed through Homebrew though:
➜ cherrytree git:(master) brew install gtkmm3
Warning: gtkmm3 3.24.5 is already installed and up-to-date.
To reinstall 3.24.5, run:
brew reinstall gtkmm3
So I don't know why lddoes not find it, I already tried reinstalling gtkmm3 but it didn't help.
I cannot reproduce even though my Monterey hasn't the very latest updates, I'll try to upgrade later. It happened to me in the past to have issues rebuilding after a "brew update"; I had to:
- close and open a new terminal
- "git clean -dfx" to remove all previous build files
- now ./build.sh Then it worked, try this too