Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#32975 closed defect (fixed)

qt4-mac: wrong pkg-config cflags

Reported by: mojca (Mojca Miklavec) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: Qt4 pkg-config cflags Cc: mkae (Marko Käning)
Port: qt4-mac

Description

When calling

> pkg-config --cflags "QtCore >= 4.5 QtGui >= 4.5 QtNetwork >= 4.5 QtSvg >= 4.5"

with qt4-mac installed, I get

-DQT_SHARED -I/opt/local/include -I/opt/local/include/QtCore -I/opt/local/include/QtGui -I/opt/local/include/QtNetwork -I/opt/local/include/QtSvg 

but /opt/local/include/QtCore doesn't really exist. It should probably be /opt/local/lib/QtCore.framework/Headers or /opt/local/lib/QtCore.framework/Versions/4/Headers instead.

The problem seems to be in /opt/local/lib/pkgconfig/QtCore.pc which includes

includedir=${prefix}/include/QtCore
...
Cflags: -DQT_SHARED -I/opt/local/include -I${includedir}

which is wrong. In particular, /opt/local should probably not be hardcoded in Cflags and includedir should be changed. An alternative is to make a symlink like Homebrew does

/opt/homebrew/Cellar/qt/4.8.0/include/QtCore -> /opt/homebrew/Cellar/qt/4.8.0/lib/QtCore.framework/Versions/4/Headers

I didn't try it out yet, but I speculate that qt4-mac-devel might have the same problem.

Out of curiosity and independent of the bug - why aren't QtCore.framework and other frameworks put under ${prefix}/Library/Frameworks (${frameworks_dir}) instead of ${prefix}/lib like they are for AquaTerm, Python etc.?

Change History (10)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: michaelld removed
Owner: changed from macports-tickets@… to michaelld@…
Summary: pkg-config returns wrong cflags for qt4-macqt4-mac: wrong pkg-config cflags

qt4-mac doesn't install any frameworks for me. Shall I assume you're using the +framework variant? If so, and it's putting them in ${prefix}/lib, then I would agree they belong in ${frameworks_dir} instead.

comment:2 Changed 12 years ago by mojca (Mojca Miklavec)

Yes, it seems that I have +framework variant installed (and I don't have the slightest idea why I have chosen that one):

> port installed qt4-mac
  qt4-mac @4.7.3_0+quartz
  qt4-mac @4.7.4_1+framework+quartz+raster (active)

And yes, the frameworks are in /opt/local/lib/QtCore.framework.

comment:3 Changed 12 years ago by michaelld (Michael Dickens)

Yeah; there is a difference between framework and non-framework installs, though qmake -really- tries to ignore those as much as possible. Once upon a time, I tried to get Qt to install into ${frameworks_dir} -- real PITA. And, doing it as post-destroot is just another PITA. So, no great solutions at least for the 4.7 series. Maybe 4.8 will be better (haven't tried yet), and hopefully 5.0 will since the Qt folks are supposedly moving away from a single massive install to a bunch of smaller ones -- so, fixing the primary install should make the rest follow suite. I will take a look at this issue sooner or later, but don't expect a simple / quick fix anytime soon. Sorry.

comment:4 Changed 12 years ago by mojca (Mojca Miklavec)

One thing is fixing location of frameworks which I can imagine to be problematic. (What exactly went wrong when you tried to do it?)

However - wouldn't one of the other fixes (either creating a symlink to frameworks or fixing those few lines in *.pc files) be trivial enough to do it quickly?

I would like to make sure that gnuplot 4.6 would compile with Qt and fixing pkg-config is one of the essential steps in that direction.

comment:5 Changed 12 years ago by michaelld (Michael Dickens)

Sorry for the long delay. I'm now updating qt4-mac to 4.8.1, and revisiting tickets relevant to both qt4-mac and qt4-mac-devel.

The issue is that Qt uses a single $[libdir} as the install directory for both libraries and frameworks, and that the pkgconfig files do not reflect either entirely correctly. So, if I change ${libdir} to install frameworks correctly, then I have to move the libraries out of it and modify the various files that use or contain references to those. If I leave ${libdir} alone and move frameworks, I still have to modify lots of files. I suppose symlinks would be one solution for headers, but it won't solve the "combined libraries and frameworks" issue. I am looking into another way of doing this that's more robust; more after a bit more hacking!

comment:6 Changed 12 years ago by mkae (Marko Käning)

Cc: mk@… added

Cc Me!

comment:7 Changed 12 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: newclosed

This issue should be fIxed in r94241. Please do the following

sudo port clean qt4-mac
sudo port selfupdate

and then try to install or upgrade qt4-mac. I'm closing this ticket, since it now refers to an old version of qt4-mac. Please open a new ticket if this issue persists with the new qt4-mac.

comment:8 Changed 12 years ago by mojca (Mojca Miklavec)

Wow, thank you very much for upgrading Qt to 4.8.2. However, the problems are still present (even if the cause might be different) and I cannot compile my project.

There might be additional problems (I'll test later), but at least the following might be worth fixing:

> ll /opt/local/include/ | grep Qt
lrwxr-xr-x     1 root      admin      187 14 jun 11:29 Qt3Support -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/Qt3Support.framework/Headers
lrwxr-xr-x     1 root      admin      186 14 jun 11:29 QtCLucene -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtCLucene.framework/Headers
lrwxr-xr-x     1 root      admin      183 14 jun 11:29 QtCore -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtCore.framework/Headers
lrwxr-xr-x     1 root      admin      183 14 jun 11:29 QtDBus -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtDBus.framework/Headers
lrwxr-xr-x     1 root      admin      190 14 jun 11:29 QtDeclarative -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtDeclarative.framework/Headers
lrwxr-xr-x     1 root      admin      187 14 jun 11:29 QtDesigner -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtDesigner.framework/Headers
lrwxr-xr-x     1 root      admin      197 14 jun 11:29 QtDesignerComponents -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtDesignerComponents.framework/Headers
lrwxr-xr-x     1 root      admin      182 14 jun 11:29 QtGui -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtGui.framework/Headers
lrwxr-xr-x     1 root      admin      183 14 jun 11:29 QtHelp -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtHelp.framework/Headers
lrwxr-xr-x     1 root      admin      189 14 jun 11:29 QtMultimedia -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtMultimedia.framework/Headers
lrwxr-xr-x     1 root      admin      186 14 jun 11:29 QtNetwork -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtNetwork.framework/Headers
lrwxr-xr-x     1 root      admin      185 14 jun 11:29 QtOpenGL -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtOpenGL.framework/Headers
lrwxr-xr-x     1 root      admin      185 14 jun 11:29 QtScript -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtScript.framework/Headers
lrwxr-xr-x     1 root      admin      190 14 jun 11:29 QtScriptTools -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtScriptTools.framework/Headers
lrwxr-xr-x     1 root      admin      182 14 jun 11:29 QtSql -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtSql.framework/Headers
lrwxr-xr-x     1 root      admin      182 14 jun 11:29 QtSvg -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtSvg.framework/Headers
lrwxr-xr-x     1 root      admin      183 14 jun 11:29 QtTest -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtTest.framework/Headers
lrwxr-xr-x     1 root      admin      186 14 jun 11:29 QtUiTools -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtUiTools.framework/Headers
lrwxr-xr-x     1 root      admin      185 14 jun 11:29 QtWebKit -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtWebKit.framework/Headers
lrwxr-xr-x     1 root      admin      182 14 jun 11:29 QtXml -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtXml.framework/Headers
lrwxr-xr-x     1 root      admin      190 14 jun 11:29 QtXmlPatterns -> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_aqua_qt4-mac/qt4-mac/work/destroot/opt/local/Library/Frameworks/QtXmlPatterns.framework/Headers

As well as somewhat fishy list of files inside /opt/local/Library/Frameworks (those *.la files should not be there)

Qt3Support.framework
Qt3Support.la
QtCLucene.framework
QtCLucene.la
QtCore.framework
QtCore.la
QtDBus.framework
QtDBus.la
QtDeclarative.framework
QtDeclarative.la
QtDesigner.framework
QtDesigner.la
QtDesignerComponents.framework
QtDesignerComponents.la
QtGui.framework
QtGui.la
QtHelp.framework
QtHelp.la
QtMultimedia.framework
QtMultimedia.la
QtNetwork.framework
QtNetwork.la
QtOpenGL.framework
QtOpenGL.la
QtScript.framework
QtScript.la
QtScriptTools.framework
QtScriptTools.la
QtSql.framework
QtSql.la
QtSvg.framework
QtSvg.la
QtTest.framework
QtTest.la
QtUiTools.framework
QtUiTools.la
QtWebKit.framework
QtWebKit.la
QtXml.framework
QtXml.la
QtXmlPatterns.framework
QtXmlPatterns.la

Also, my Makefile now contains

-lQtGui -lQtNetwork -lQtCore 

instead of

-framework QtGui -framework QtNetwork -framework QtCore

but I still need to figure out why that happens.

comment:9 Changed 12 years ago by michaelld (Michael Dickens)

Aw crud; I thought I fixed that specific issue. Please open a new ticket with the above info, while I look into it.

comment:10 Changed 12 years ago by michaelld (Michael Dickens)

Sorry; just realized that you opened #34864. I'll move my comments there.

Note: See TracTickets for help on using tickets.