Nominate our 2022 Qt Champions!

Cannot compile Qt 5 on Mac OS ML

  • Hi.
    I'm trying to compile Qt 5.0 from git on Mac OS Mountain Lion with Xcode 4.5.2 installed and the process stops with error in compiling PCRE.
    I configured the compilation with:

    /configure -developer-build -opensource -nomake examples -nomake tests -framework

    following the instructions in the page ( added the -framework switch )

    When running "make" I get a series of errors while compiling PCRE. The first is:

    @tools/qregularexpression.cpp:796:5: error: unknown type name 'pcre16_extra'; did you mean 'pcre_extra'?
    pcre16_extra *optimizePattern();

    Another is:

    @tools/qregularexpression.cpp:822:5: error: unknown type name 'pcre16_extra'; did you mean 'pcre_extra'?
    pcre16_extra *studyData;@

    I'll appreciate any help in this matter, thank you.

  • I had the same issue at first but it went away when I changed my toolchain to the Apple provided clang. Change the environment variables CC=clang and CXX=clang in /etc/launchd.conf and restart.
    They were originally set for gcc and g++

    If you need to make the CC and CXX variables persist for sudoers then you need to follow the instructions here also:

    After all that I get a lot further but I can't get dbus to compile and it seems to ignore the -no-dbus option and try to compile it anyway, but that's a different issue!

  • Hi.
    Thank you for the suggestion but I was already compiling with clang. I applied your suggestion anyway but I got the same error at the same point.


  • I'm having the same problem. Did you ever get this fixed?

  • Re-tried today with Qt 5.1, Mavericks a XCode 5, still the same issue. Is it possible that nobody can give a usable workflow to compile Qt 5 on Mac?

  • I found the issue. There was an older version of pcre.h in my system. It was in /opt/local/include and Qt found it and used it instead of the one included in the Qt source. Do a system-wide search and you'll be able to find the problem.

    Hope this helps.

Log in to reply