简体   繁体   中英

Octave configure cannot find Qt library on OS X

I have installed QT 4.8 library on my OS X through direct install with.dmg file downloaded from qt-project.org. It seems a framework version. And so far, a lot of tools recognises it well. But when I am building octave on this computer, it gives a warning of "Qt libraries not found". I wonder why. And what can I do to make it recognise the qt lib on my machine.

The command I used for configure is

./configure --prefix=/usr/local --enable-shared F77=gfortran-4.2 LDFLAGS='-L/usr/local/lib'

(further information)

I did tried to find the installation of QT with

find find /Library/ -name QtGui

Returning result being

/Library//Frameworks/QtGui.framework/QtGui
/Library//Frameworks/QtGui.framework/Versions/4/Headers/QtGui
/Library//Frameworks/QtGui.framework/Versions/4/QtGui

Along with the fact that ipython notebook --matplotlib=qt is working well on my system, I assume my Qt Library is successfully installed.

But when performing the check with pkg-config , both pkg-config --cflag QtGui and pkg-config --libs QtGui return no positive result.

Make sure your Qt installation is working. I'll assume it was correctly installed and is visible to the operating system you're using.

The configure command you have pasted accepts two environment variables, QT_CFLAGS and QT_LIBS . Use the pkg-config tool to determine their appropriate values:

pkg-config --cflags QtGui
pkg-config --libs QtGui

and add this information to the command line:

./configure QT_CFLAGS='foo' QT_LIBS='bar' # other stuff...

I think I know the answer now. qt-4.8 installed through .dmg file is a framework version. There is no Qt*.pc file, thus is not able to be found by pkg-config . So, in order to use pkg-config to find qt installed in the system, you need to build qt from source(source downloadable from qt-project.org), specifying that a -no-framework version is to be built:

./configure -no-framework --foo --bar
make
sudo make install

After building and installing, qt would be located in(by default)

/usr/local/Trolltech/Qt-4.8.6/lib/pkgconfig/

Thus adding a line to ~/.bashrc

export PKG_CONFIG_PATH="/usr/local/Trolltech/Qt-4.8.6/lib/pkgconfig/:${PKG_CONFIG_PATH}"

would help pkg-config locating the qt in your system.

If you have installed QT by.run file, you might find pkgconfig folder. For me, I have installed QT to "/opt/qt5.15.x/" and I find this path "/opt/qt5.15.x/5.15.2/gcc_64/lib/pkgconfig". Referencing pkg-config-path-environment-variable , I add it to PKG_CONFIG_PATH by

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/qt5.15.x/5.15.2/gcc_64/lib/pkgconfig/

And then, Octave configure find Qt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM