gnuplot
can both support qt
and x11
terminal, but if install gnuplot via
homebrew
, only qt
terminal is supported, and the option --with-x11
seems is removed (see Homebrew/brew not taking options when installing gnuplot), so I decide to build gunplot
from source. But although I can successfully install and run qt
version's gnuplot
, I failed to build qt
version's gnuplot
from source. Exactly, I tried to compile gnuplot
via$ ./configure --with-qt=qt5
$ make
then meet error message
qtterminal/qt_term.cpp:51:10: fatal error: 'QtCore' file not found
#include <QtCore>
^~~~~~~~
1 error generated.
make[4]: *** [qtterminal/qt_term.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
However, I'm sure qt@5
is already installed via homebrew
.
$ brew install qt@5
Warning: qt@5 5.15.5_3 is already installed and up-to-date.
To reinstall 5.15.5_3, run:
brew reinstall qt@5
Sorry I do not familiar with the MacOS.
The error you have met is your fault for qt install for develepment.
Error does not come from the bug of gnuplot.
At any platform and any program , you have to install proper 'development laibraries (libraries and header files)' of deprendencies when you build the application from source.
My writing in the above may be invalid.
Please up load your config.log file.
Last edit: Tatsuro MATSUOKA 2023-02-27
Thanks for your reply! The following attachment is my
config.log
after run the following command (as same as the former one)(In addition, as earlier mentioned, I noticed that qt-version can be correctly installed from
homebrew
, here is its.rb
file homebrew-core/Formula/gnuplot.rb. I suspect perhaps the command insidedef install
will be helpful. However, neither C/C++ project or the rule ofhomebrew
's.rb
file are unfamiliar for me, so this is just a vary subjective comment. I hope it won't make a misleading if the judgement is incorrect.)Last edit: Qubicand 2023-02-27
I have never used homebrew so I can't offer much help, only guesses. Is it possible that homebrew installs qt5 as one big package rather than breaking it into the separate pieces Qt5Core Qt5Gui etc that gnuplot's configure script is looking for? If that is the case it may be correct that gnuplot will build successfully even though there are errors reported by the configure script when it doesn't find separate packages by those names. The homebrew recipe link you gave for gnuplot doesn't seem to show anything special required to configure and build it.
Did your
make
actually produce a gnuplot executable? If so you are probably fine. If it failed, please upload the output from$ make >& make.log
You might get useful help from a homebrew forum.
Using a text editor, I checked a word 'qt' in config.log.
./configure detects qt five and mention
However,
However, requried pacakges, Qt5core, Qt5Gui, Qt5Network, Qt5PrintSupport and Qt5Svg were not found.
I think that ./configure should report qt was "no".
This might be a bug for configuration system of gnuplot.
BTW, perhaps your installation of Qt is for users.
If you want to build gnuplot from source, all depedencies libraries should be installed for developpers.
On Ubuntu, qtbase5-dev, libqt5svg5-dev and qttools5-dev are required for building gnuplot.
Corresponding tools for MacOS should be required.
Sorry I have never used the mac computers, the aboves are all I can tell you.
Last edit: Tatsuro MATSUOKA 2023-02-27
Thanks for your suggestion! It seems I need more time to learn how to use
qt
on macOS. If later I found any new discovers, I will post them here.Hi Ethan.
configure result configure:18571: result: Qt terminal: yes (qt5),
while Qt5core, Qt5Gui, Qt5Network, Qt5PrintSupport and Qt5Svg were not found. ???
Is this a bug?
It may be a bug in the configure script. I do not have a Mac system to use for testing. I guess the problem would be that if the command is
./configure --with-qt
it will setqt5
if that is the system default,qt4
if that is the system default, and will fail if there is no system default and it cannot find eitherqt4
orqt5
. If you tell it--with-qt=qt5
that sets theqt5
flag to start with and the bug is that the flag is not cleared when it cannot find the libraries. I will see if I can reproduce the problem on a linux system.I have never used homebrew myself, but I see that the homebrew site https://formulae.brew.sh/formula/qt@5 lists the following dependencies for building programs with qt support:
I would start by making sure that the packages
qt@5
node
pkg-config
andpython@3.10
are installed before running the gnuplot configure script.It may be that pkg-config does not recognize qt5 installed with homebrew (I don't know why).
Please, try the following command,
CXXFLAGS above is necessary in my environment, but I don't know if it is necessary in yours.
Thanks for your help, the command is does work! It seems the solution is just help
gnuplot
find those packages. However, since my directory ofqt5/lib/pkgconfig
is different from yours (which is installed viahomebrew
), I changed it into the actual path in my computer as followingNow
qt
can be detected even didn't explicitly tellqt
's version like--with-qt=qt5
. The following shows one part of the output from above commandThen I can run the build command without the previous
'QtCore' file not found
errorFinally, after building, I run
./src/gnuplot
and check its supported terminaland the output is as following
which shows both
qt
andx11
is supported.(In addition, I checked the path
qt5/lib/pkgconfig
, find the file such asQt5Core.pc
,Qt5Gui.pc
are inside it, but those packages can't be found inmake
process.)Now this issues seems can be closed.
Great news that you're up and running.
Would you be willing to write a brief summary that I could add to the INSTALL file explaining what you did to build + install on homebrew? It might save time the next time this comes up; even if the person who runs into a problem doesn't find the summary in INSTALL at least I'll know where to point them if they ask here or on the mailing list.
Was it just
or was there more to it (perhaps other stuff you had already found and installed earlier)?
Yes, no problem. I'm very please to share my experience to help more people.
I split the whole process as two parts: install dependencies and compile.
gnuplot
by myself, I've already installedgnuplot
viahomebrew
, therefore also installed its dependence. Althoughqt@5
is necessarily needed to install, I'm not sure if one can successfully compilegnuplot
without others. Therefore, I strongly suggest also install those dependences before starting to compile. Fromhomebrew
One can either manually install those dependencies by
or just simply install
gnuplot
viahomebrew
, in this time the dependencies will automatically installedin the time I write this text,
gnuplot
installed byhomebrew
is compiled withqt
by default, but no option can allow compiling withx11
. Therefore, if one just wish to usegnuplot
withqt
but don't care if it can run withx11
, it's enough to install viahomebrew
and no need to compile by oneself. However, if one wishes to hold both features, it seems compilinggnuplot
by oneself is unavoidable.2. Compile
gnuplot
withqt
: If no extra option, run./configure
andmake
will automatically compilegnuplot
withx11
support. However, if wish compile withqt
, one need to add option--with-qt
(detailed descriptions about these options can be found by./configure -h
). However, it seems ifqt5
is installed viahomebrew
,gnuplot
can't automatically detect it*, and then runmake
command one will meet problem likefatal error: 'QtCore' file not found
(detailed discussion see #2591 meet'QtCore' file not found
problem when build from source on macOS). To solve the problem, one need to add an extra command before./configure --with-qt
to tell where to find lib likeQtCore
Note if your
qt5/lib/pkgconfig
is installed otherwhere, one need to change the path inside the above command (one example see here). After that, one can then compilegnuplot
as usualNote for macOS, the
sudo
prefix at the last line is seems necessary, which may due to there is some file operations which requiredsudo
permission.Last edit: Qubicand 2023-03-02
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 withoutexport
.I then configured with
./configure --with-qt=qt5
.Thanks for the helpful thread.