I can add that this advice resolved the fatal error: QtCore file not found error for me on macOS Monterey 12.6.8. I'm building gnuplot-6.0.0 from source. I had to run export PKG_CONFIG_PATH=/usr/local/opt/qt@5/lib/pkgconfig/, which was not working without export. I then configured with ./configure --with-qt=qt5. Thanks for the helpful thread.