Opened 9 years ago

Closed 9 years ago

#49299 closed defect (fixed)

akonadi build fails after qt4-mac update

Reported by: jwhowse4 Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: michaelld (Michael Dickens)
Port: akonadi

Description

I am using an Intel Mac Pro running Mac OS 10.8.5 and XCode 5.1.1. After the upgrade of the qt4-mac package to 4.8.7_2 macports tried to rebuild the package akonadi because of a linking error. That build process fails and produces the attached error log.

Attachments (3)

akonadi_main.log (1.1 MB) - added by jwhowse4 9 years ago.
error log
akonadi_use_c++11.diff (1.6 KB) - added by michaelld (Michael Dickens) 9 years ago.
akonadi_gcc-5_main.log (1.9 MB) - added by jwhowse4 9 years ago.
gcc5 log file

Change History (16)

Changed 9 years ago by jwhowse4

Attachment: akonadi_main.log added

error log

comment:1 Changed 9 years ago by mf2k (Frank Schima)

Cc: nicos@… removed
Owner: changed from macports-tickets@… to nicos@…

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

Here's the error:

:info:build In file included from /Volumes/User_Disk/opt/macports/libexec/qt4/include/QtCore/qobject.h:50:
:info:build /Volumes/User_Disk/opt/macports/libexec/qt4/include/QtCore/qlist.h:55:10: fatal error: 'initializer_list' file not found
:info:build #include <initializer_list>
:info:build          ^

I think that the issue is that qt4-mac was build with support for c++11 (directly via the +cxx11 variant or even just internally somehow), while akonadi is trying to build using c++0x; shouldn't make a difference, but clearly it does. "initializer_list" is c++11 or newer.

What does "port installed qt4-mac" return for you? Did you update to Xcode 5.1 recently, such as after qt4-mac was last built?

comment:3 in reply to:  2 Changed 9 years ago by jwhowse4

Replying to michaelld@…:

Here's the error:

:info:build In file included from /Volumes/User_Disk/opt/macports/libexec/qt4/include/QtCore/qobject.h:50:
:info:build /Volumes/User_Disk/opt/macports/libexec/qt4/include/QtCore/qlist.h:55:10: fatal error: 'initializer_list' file not found
:info:build #include <initializer_list>
:info:build          ^

I think that the issue is that qt4-mac was build with support for c++11 (directly via the +cxx11 variant or even just internally somehow), while akonadi is trying to build using c++0x; shouldn't make a difference, but clearly it does. "initializer_list" is c++11 or newer.

What does "port installed qt4-mac" return for you? Did you update to Xcode 5.1 recently, such as after qt4-mac was last built?

"port installed qt4-mac" returns "qt4-mac @4.8.7_2+odbc (active)". I installed XCode 5.1.1 some time ago, long before I updated the qt4-mac port.

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

Do you have MacPorts gcc48 or newer installed? I think gcc5 is pretty much the standard by now for your OS. Could you try the following:

sudo port clean akonadi
sudo port install akonadi configure.compiler=macports-gcc-5

(or "macports-gcc-4.8" for that version).

If I recall, the default build on OS X 10.8 is to use libstdc++, which (for better or worse) when using clang as the compiler also uses Apple's installed gcc 4.2 C++ stuff. Which is not really c++0x compliant. Moving to using a reasonably modern GCC should do the trick here, I think. Should not really matter if qt4-mac was built using c++11 (+cxx11) or not.

Last edited 9 years ago by michaelld (Michael Dickens) (previous) (diff)

Changed 9 years ago by michaelld (Michael Dickens)

Attachment: akonadi_use_c++11.diff added

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

If you're comfortable patching, then give this one a try. On your system it will use MacPorts GCC5 port for building. On my system, it forces the use of a C++11 Clang compiler, which in this case is just the Xcode clang. Here's what you'd need to do for testing:

sudo port clean akonadi
cd $(port dir akonadi)
sudo patch -p0 < PATH_TO/akonadi_use_c++11.diff
sudo port install akonadi

and see if it works. The "PATH_TO" is a path to the patch file. If it does, please report back & we'll figure out the best way to add something in that forces C++11. You can remove the patch via:

cd $(port dir akonadi)
sudo patch -R -p0 < PATH_TO/akonadi_use_c++11.diff

comment:6 in reply to:  4 Changed 9 years ago by jwhowse4

Replying to michaelld@…:

Do you have MacPorts gcc48 or newer installed? I think gcc5 is pretty much the standard by now for your OS. Could you try the following:

sudo port clean akonadi
sudo port install akonadi configure.compiler=macports-gcc-5

(or "macports-gcc-4.8" for that version).

If I recall, the default build on OS X 10.8 is to use libstdc++, which (for better or worse) when using clang as the compiler also uses Apple's installed gcc 4.2 C++ stuff. Which is not really c++0x compliant. Moving to using a reasonably modern GCC should do the trick here, I think. Should not really matter if qt4-mac was built using c++11 (+cxx11) or not.

On my system the build using macports-gcc-5 fails but a build using macports-gcc-4.9 succeeds. I do not have gcc-4.8 installed currently. If you like I can attach the error log for the gcc-5 build later today.

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

Interesting. Thanks for the feedback. Yes, if you could attach the GCC5 log that would be interesting. I wish there were a better way to get C++11 support. I'm glad this path seems to be working for this issue.

comment:8 in reply to:  7 Changed 9 years ago by jwhowse4

Replying to michaelld@…:

Interesting. Thanks for the feedback. Yes, if you could attach the GCC5 log that would be interesting. I wish there were a better way to get C++11 support. I'm glad this path seems to be working for this issue.

I have attacked the gcc5 log above.

Changed 9 years ago by jwhowse4

Attachment: akonadi_gcc-5_main.log added

gcc5 log file

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

Thanks! Looks like one needs to build Boost with "configure.compiler=macports-gcc-5" to get this to work (as a guess). Well, so long as GCC4.8 works then it shows what needs to be done.

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

Nicos: Can you take a look at my patch that tries to force C++11 building? It's what I use with other ports & seems to work pretty well.

comment:11 Changed 9 years ago by NicosPavlov

Thanks for having looked at that, I would have probably been slightly lost.

If I follow correctly, your patch is overriding the behaviour of the cxx11 portgroup in case of using libstdc++ to enable compilation anyway. Could not this lead to issues with runtime dependencies? Akonadi is then potentially used by several ports, in particular KDE ones.

comment:12 in reply to:  11 Changed 9 years ago by michaelld (Michael Dickens)

Replying to nicos@…:

Thanks for having looked at that, I would have probably been slightly lost.

NP. I thought this issue was qt4-mac related, but it's something I've dealt with before so it's not a big deal.

If I follow correctly, your patch is overriding the behaviour of the cxx11 portgroup in case of using libstdc++ to enable compilation anyway. Could not this lead to issues with runtime dependencies? Akonadi is then potentially used by several ports, in particular KDE ones.

The cxx11 PortGroup errors out when using libstdc++. But, folks using 10.8 and prior will have libstdc++ by default & the GCC 4.8+ compilers can handle c++11 pretty easily on that setup. My fix is not particularly robust, but it generally works well enough & keeps things working on those older OSs. on 10.9+, just use the cxx11 PortGroup & that's good enough. Pretty simple overall.

comment:13 Changed 9 years ago by NicosPavlov

Resolution: fixed
Status: newclosed

Thanks for the answer. Committed in r141746.

Note: See TracTickets for help on using tickets.