This repository has been archived by the owner. It is now read-only.

Qt4 on Mavericks (CLOSED) #23793

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
@cliffrowley
Contributor

cliffrowley commented Oct 30, 2013

NOTE BEFORE PROCEEDING

All of these changes have now been merged and neither --HEAD nor the custom formula are now required. Simply brew install qt and you're good to go.

If you have any other issues related to Qt or formulae that use it and are broken, please open a new issue - this one is closed!

All of the below is defunct and deprecated


Description

Some API changes in Mavericks (10.9) prevent Qt4 from compiling. This PR incorporates code that is currently undergoing review and development in the Qt code review system, and from the WebKit trac system. Since Qt is such a widely used dependency and in many cases absolutely essential it made sense to gather the code and patch the Homebrew Qt formula to get it building again in lieu of the next upstream Qt4 release. This formula also enables building Qt with libc++ on Mavericks (thanks @balr0g!), which is required to build a fair number of formula that in turn depend on Qt.

Using this patch

brew install https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD

References

Incorporated Qt patches:

Incorporated WebKit patches:

Relevant Qt bug reports:

Haswell & SSSE3 build failure

Despite supporting SSSE3, the newer (2013) Haswell based Macs seem to have issues compiling Qt with SSSE3 optimisation switched on. If you have one of these machines, and this formula does not compile for you then you probably saw this message:

It appears you have a Haswell based CPU. It seems that Qt fails to build on some newer (2013) Haswell based machines.
Try building again but adding --without-ssse3 to the end of the command line, and let us know if this worked for you.

If you have tried adding --without-ssse3 to the command line and the build still fails, then add -v to the command line and run the build once more. Then when it fails, find the error in your terminal buffer and add a comment to this pull request along with the output of sysctl -a and we'll see if we can work it out.

I've submitted a bit report with Qt regarding this issue here, but it's still waiting for more info from users who have an affected machine. I do not have one, so I cannot assist further.

@mistydemeo

View changes

Library/Formula/qt.rb Outdated
@@ -44,7 +49,8 @@ def install
# locations and with Xcode-only.
if superenv?
args << '-no-3dnow'
args << '-no-ssse3' if MacOS.version <= :snow_leopard
args << '-no-ssse3' if (MacOS.version <= :snow_leopard) || (!build.with? 'ssse3')

This comment has been minimized.

@mistydemeo

mistydemeo Oct 30, 2013

Contributor
build.without? 'ssse3'

Though rather than scoping this on the OS version and an option, we can query the CPU directly:

args << '-no-ssse3' unless Hardware::CPU.ssse3?

This comment has been minimized.

@tecnobrat

tecnobrat Oct 30, 2013

Contributor

Doesn't look like Hardware::CPU.ssse3? exists. Hardware::CPU.sse3? does ...

This comment has been minimized.

@mistydemeo

mistydemeo Oct 30, 2013

Contributor

Good catch, that needs a new helper.

This comment has been minimized.

@tecnobrat

tecnobrat Oct 30, 2013

Contributor

I'll make a PR.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

Ah thanks, I didn't think to look for without? for some reason. As a Ruby developer that's a little embarrassing, so let's put it down to doing too many things at once :-P

This comment has been minimized.

@tecnobrat

tecnobrat Oct 30, 2013

Contributor

#23796 for adding Add Hardware::CPU.ssse3?

A REALLY hacky work around to ensure it "works" is to use:

args << '-no-ssse3' unless Hardware::CPU.send(:sysctl_bool, "hw.optional.supplementalsse3")

Its the same behaviour, and should definitely be swapped out when the above PR is merged.

@mistydemeo

View changes

Library/Formula/qt.rb Outdated
@@ -80,6 +86,8 @@ def install
end
args << '-developer-build' if build.include? 'developer'
system "curl -o src/3rdparty/webkit/WebKitLibraries/libWebKitSystemInterfaceMavericks.a http://trac.webkit.org/export/157771/trunk/WebKitLibraries/libWebKitSystemInterfaceMavericks.a"

This comment has been minimized.

@mistydemeo

mistydemeo Oct 30, 2013

Contributor

Make this a resource rather than invoking curl during the install method.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

Ah excellent, that's what I was wondering. I will look into that. I've not created a formula this complex before.

@mistydemeo

View changes

Library/Formula/qt.rb Outdated
@@ -25,6 +26,10 @@ class Qt < Formula
odie 'qt: --with-qtdbus has been renamed to --with-d-bus' if build.include? 'with-qtdbus'
odie 'qt: --with-demos-examples is no longer supported' if build.include? 'with-demos-examples'
odie 'qt: --with-debug-and-release is no longer supported' if build.include? 'with-debug-and-release'
def patches

This comment has been minimized.

@mistydemeo

mistydemeo Oct 30, 2013

Contributor

Need to document where these patches come from and what they do.

This comment has been minimized.

@MikeMcQuaid

MikeMcQuaid Oct 30, 2013

Member

Also, if we can link directly to those from Qt code review we should do that instead.

This comment has been minimized.

@MikeMcQuaid

MikeMcQuaid Oct 30, 2013

Member

Let's also make these patches Mavericks-only.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

I'm not sure it's possible to link directly to the Qt code review. I couldn't even download the patches without fetching the source and extracting them. I'll see what I can do though.

@adamv

This comment has been minimized.

Contributor

adamv commented Oct 30, 2013

SSSE3 Not to be confused with SSE3.

@arxpoetica

This comment has been minimized.

arxpoetica commented Oct 30, 2013

Another one for the books: https://gist.github.com/americanyak/0c3d76e89c3ba81d4e98

Edit: trying now with brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD --without-ssse3

@tecnobrat

This comment has been minimized.

Contributor

tecnobrat commented Oct 30, 2013

@americanyak looks like you are having issues with ssse3?, Are you on a new macbook pro / air?

Try --without-ssse3 (as mentioned at the top).

They are trying to get this to happen automatically by detecting your CPU.

@arxpoetica

This comment has been minimized.

arxpoetica commented Oct 30, 2013

@tecnobrat I edited my comment: trying it w/ --without-ssse3 now. And yes, brand new Mac Book Pro w/ Mavericks.

@mistydemeo

This comment has been minimized.

Contributor

mistydemeo commented Oct 30, 2013

This is failing on 10.9 due to duplicate symbols when building libqtiff.

@arxpoetica

This comment has been minimized.

arxpoetica commented Oct 30, 2013

w00t! It built with brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD --without-ssse3

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@mistydemeo hmm, I'm a bit baffled by that one.. I've seen that error come and go. I added a dependency on libtiff to get rid of it, however then I had issues with libstdc++ vs libc++. After trying to resolve that for a while, I reverted and it now builds. Did you add --HEAD?

@mistydemeo

This comment has been minimized.

Contributor

mistydemeo commented Oct 30, 2013

I didn't add anything, this was the bot. It builds with the default options.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

Thanks for all the input btw, this is a great learning exercise for me. I've created and submitted formula before, but they've never been any more complicated than make install.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@mistydemeo ah, that'll be why then. Stable doesn't seem to build. I started using --HEAD on the recommendation of one of the Qt guys because it has other Mavericks related fixes.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

I've made the necessary changes according to the feedback received already, including:

  • Automatically detecting and disabling SSSE3
  • Using a resource to download libWebKitSystemInterfaceMavericks.a rather than using curl directly
  • Making these changes Mavericks only

I'm just waiting for the build to complete on my iMac for sanity and then I'll squash and push.

resource 'libWebKitSystemInterfaceMavericks' do
url 'http://trac.webkit.org/export/157771/trunk/WebKitLibraries/libWebKitSystemInterfaceMavericks.a'
sha1 'fc5ebf85f637f9da9a68692df350e441c8ef5d7e'
version '157771'

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

I'm not sure what to use for the version number here since the file doesn't have one, otherwise it fails audit..

This comment has been minimized.

@adamv

adamv Oct 30, 2013

Contributor

It is ok for resources to fail audit for now.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

Ah ok great, I'll remove the version number then as it's meaningless.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

@adamv while I've got your attention, any ideas how I might tackle item 5 in the PR description?

This comment has been minimized.

@MikeMcQuaid

MikeMcQuaid Oct 30, 2013

Member

@adamv Stuff failing audit stops bottles being built.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

@MikeMcQuaid then seeing as this is a temporary measure while we wait for an official upstream patch, perhaps I should leave it as-is?

This comment has been minimized.

@cliffrowley

cliffrowley Oct 31, 2013

Contributor

FWIW because I do need to build a bottle (to save myself from having to rebuild Qt when I need it!) I've left the whacky version number in. It'll get removed later anyway because libWebKitSystemInterfaceMavericks.a will be incorporated into the Qt source.

@cliffrowley

View changes

Library/Formula/qt.rb Outdated
args << '-no-ssse3' if MacOS.version <= :snow_leopard
# Detect and disable supplemental SSE3 extensions on newer machines
args << '-no-ssse3' unless MacOS.version >= :lion && Hardware::CPU.send(:sysctl_bool, 'hw.optional.supplementalsse3')

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

It'd be really helpful if someone with a newer machine (e.g. someone who needed to compile with --without-ssse3) could try out this formula. This time, don't bother specifying the --without-ssse3, just use brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD.

This comment has been minimized.

@jabooth

jabooth Oct 30, 2013

Hmm just tried this for you now (copied the exact command provided and I have a 2013 rMBP) and still hit ssse3 related errors.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

Bum. Thank you for testing that.. I'll have another look and make sure I didn't goof something up.

This comment has been minimized.

@jabooth

jabooth Oct 30, 2013

Wait, forgive me if I'm wrong (0 Ruby knowledge!) but isn't this branch the wrong way round? As in, we want to disable SSSE3 on a few 2013 models because there is currently a bug, so we want something like:

args << '-no-ssse3' if MacOS.version <= :snow_leopard  || (is_problematic_2013_model && macOS.version >= :Mavericks)

Won't practically every machine building this have SSSE3 support making the other conditional a mute point?

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

@jabooth can you tell me what you get from sysctl hw.optional.supplementalsse3?

This comment has been minimized.

@cliffrowley

cliffrowley Oct 31, 2013

Contributor

@mistydemeo while I have your attention - is it possible to output an arbitrary message if the build fails? I was thinking that in the meantime, until I can solve this elegantly that it'd be good to recommend trying the build with --without-ssse3 if it fails. Though maybe that's redundant and instead I should just stick a prominent message in the PR description. Thoughts?

This comment has been minimized.

@mistydemeo

mistydemeo Oct 31, 2013

Contributor

Ah, you're right - need to add a new extmodel helper.

is it possible to output an arbitrary message if the build fails?

The system method in Formula raises a BuildError exception. You can catch the exception in a begin; rescue; end block and reraise a new exception with your own message.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 31, 2013

Contributor

Excellent, thanks. I figured that might be the case, but wasn't sure if there was a magic method :-)

Shall I add the extmodel helper, or should I leave that to someone who knows what they're doing? ;-)

This comment has been minimized.

@mistydemeo

mistydemeo Oct 31, 2013

Contributor

Added as Hardware::CPU.extmodel, but let me know if there's something more useful than an int to return.

This comment has been minimized.

@cliffrowley

cliffrowley Oct 31, 2013

Contributor

Star! An int is perfect. I shall now remove the hack I hoped I wouldn't have to commit ;-)

@cliffrowley

View changes

Library/Formula/qt.rb Outdated
@@ -119,3 +137,1419 @@ def caveats; <<-EOS.undent
EOS
end
end
__END__
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm

This comment has been minimized.

@cliffrowley

cliffrowley Oct 30, 2013

Contributor

If I can't find a way to link directly to the patches on the Qt code review system, should I extract these patches into a gist and reference that instead in order to get them out of the formula?

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Oct 30, 2013

With 5: raise if MacOS.version == :mavericks and not build.head?

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Oct 30, 2013

And don't worry about 6; seems to not be possible.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@MikeMcQuaid re 5 - awesome, thanks! and 6 - would you prefer I extract the patches to gist?

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Oct 30, 2013

Personally probably but Homebrew doesn't really mind either way. I guess two gists would be easier for splitting them up perhaps.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@MikeMcQuaid also, how would one entice the brew bot to compile using --HEAD on Mavericks?

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Oct 30, 2013

You can't, that's intentional. It's ok to just leave this broken on 10.9 for the bot for now.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@MikeMcQuaid I think that's everything covered. I just need to squash. It looks like the there is new code on the Qt code review but there are reports of it failing to build, so I'll try it but will hold fire on updating the PR until I know it works.

FWIW I also built a bottle to make it quicker for me to put Qt back again after experimenting, which is here: https://dl.dropboxusercontent.com/u/714833/Homebrew/Bottles/qt-4.8.5.mavericks.bottle.3.tar.gz

@stepheneb

This comment has been minimized.

Contributor

stepheneb commented Oct 30, 2013

fyi:

I just successfully built the following on my 10.9 system:

brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD --without-ssse3

Build started about 32 m ago and just completed.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@stepheneb Great! You shouldn't in theory need --without-ssse3 any more but it appears either the auto detection isn't working or something else is amiss. Unfortunately I don't have anything to test this on so I may have to defer to someone with access to a new machine to fix this one. Therefore if you remove your Qt again for whatever reason you may find you can't build it again. If that happens, just edit your formula and ensure that --no-ssse3 is added to the args (you'll see where).

@jonathantopf

This comment has been minimized.

jonathantopf commented Oct 30, 2013

i am also trying to build on mavericks, apologies in advance if this is a bit of a basic question but i don't use homebrew much yet. when i try

brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD --without-ssse3

i get the error Error: No head is defined for qt

do i need to have a local version of the qt source or something like that? if so where would it need to be?

Again, apologies for the basic qestion

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Oct 30, 2013

@jonathantopf I'm not sure why that is, are you absolutely sure you typed --HEAD (two dashes, no spaces) and not -HEAD (one dash, which is incorrect)

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Nov 25, 2013

Oh, also, see here for January release source: http://permalink.gmane.org/gmane.comp.lib.qt.devel/13812

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Nov 25, 2013

It might be better for this to be Mavericks only and leave other versions as they are. Might be paranoia on my part ;-)

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Nov 25, 2013

@cliffrowley Thoughts on us calling our "not really 4.8.4" version "4.8.4" on Mavericks?

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Nov 25, 2013

I’m not sure, what implications might that have later?

@mistydemeo

This comment has been minimized.

Contributor

mistydemeo commented Nov 25, 2013

Make a snapshot release and set that as stable for Mavericks only. It will need to be version 4.8.4 for bottles.

I really don't want qt4 to report a fake version number. Is there a revision we could pick that's stable enough for all platforms?

Leave the current situation as-is where nothing depending on Qt works on Mavericks without manual intervention and we don't have a bottle.

:/

@jensenb

This comment has been minimized.

Contributor

jensenb commented Nov 25, 2013

I would hold off on freezing at a specific revision for a short while longer. I have almost all of the critical changes for Mavericks through code review and approved, with only two changes remaining. I expect to have all of the changes except the WebKitSystemInferface for Mavericks at least be approved this week. Otherwise it will still be necessary to maintain a significant amount patches like it currently is.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Nov 25, 2013

It’s now been merged :-)

On 25 Nov 2013, at 18:03, Steven notifications@github.com wrote:

https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb
404 :(


Reply to this email directly or view it on GitHub.

@adamv

This comment has been minimized.

Contributor

adamv commented Nov 25, 2013

This issue is closed; please open a new one to restart discussion.

@adamv

This comment has been minimized.

Contributor

adamv commented Nov 25, 2013

Note, we STRONG RECOMMEND AGAINST linking random things into system folders, it will likely break things later when you least expect it.

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Nov 26, 2013

@adamv I'm going to delete/edit comments that say that from now on issues.

@MikeMcQuaid

This comment has been minimized.

Member

MikeMcQuaid commented Nov 26, 2013

yriveiro added a commit to yriveiro/homebrew that referenced this pull request Nov 26, 2013

qt: apply lots of patches to fix 10.9 HEAD build.
Closes Homebrew#23793.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>

@dgoodlad dgoodlad referenced this pull request Nov 26, 2013

Closed

Mavericks builds fail #4

@kartikthapar

This comment has been minimized.

kartikthapar commented Nov 29, 2013

Not sure what this error means:

> brew install qt --HEAD
==> Cloning git://gitorious.org/qt/qt.git
Updating /Library/Caches/Homebrew/qt--git
==> Checking out branch 4.8
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file src/3rdparty/clucene/src/CLucene/search/FieldCacheImpl.cpp
patching file src/3rdparty/webkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
Hunk #1 FAILED at 234.
Hunk #2 FAILED at 300.
Hunk #4 FAILED at 417.
Hunk #5 FAILED at 440.
Hunk #6 FAILED at 465.
Hunk #7 FAILED at 539.
6 out of 8 hunks FAILED -- saving rejects to file src/3rdparty/webkit/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp.rej
Error: Failure while executing: /usr/bin/patch -f -p1 -i 001-homebrew.diff
@jensenb

This comment has been minimized.

Contributor

jensenb commented Nov 29, 2013

That is because almost of all the patches have already been merged upstream. You no longer need to use HEAD for Qt, and this will solve the problem for you.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Nov 29, 2013

I've updated the PR description accordingly. Should anyone misinterpret now, I should kindly recommend a trip to spec savers ;-)

@kartikthapar

This comment has been minimized.

kartikthapar commented Nov 29, 2013

Ok, thanks for that. Qt installs perfectly as it was doing before. The issue is when install diffpdf —

==> Installing dependencies for diffpdf: libpng, freetype
...
patching file diffpdf.pro
==> lrelease diffpdf.pro
==> qmake -spec macx-g++ CONFIG-=app_bundle
==> make
Error: diffpdf dependency qt was built with the following
C++ standard library: libc++ (from clang)

This is incompatible with the standard library being used
to build diffpdf: libstdc++ (from clang)

Please reinstall qt using a compatible compiler.
hint: Check https://github.com/mxcl/homebrew/wiki/C++-Standard-Libraries

which lead me to following the same steps that are listed and reinstalling qt which doesn't really help at all.

@cliffrowley

This comment has been minimized.

Contributor

cliffrowley commented Nov 29, 2013

I'd recommending opening a new issue for this, this one is closed :-)

@tlvince tlvince referenced this pull request Dec 7, 2013

Closed

Qt fails to install on 10.9 #2

@arjun810

This comment has been minimized.

Contributor

arjun810 commented Dec 21, 2013

Is it still possible to build a qt on Mavericks that uses libstdc++ such that I can link against it using gcc-4.8? I need OpenMP, and going qt is on the giant list of dependencies. Since clang doesn't yet support openmp, this causes an issue.

@mistydemeo

This comment has been minimized.

Contributor

mistydemeo commented Dec 21, 2013

Yes, just build qt using the same compiler you want to use for your other software! e.g. brew install qt --cc=gcc-4.8, with gcc-4.8 installed via Homebrew.

The libstdc++ from gcc-4.8 isn't the same one as the system libstdc++, and they're not entirely compatible either.

@arjun810

This comment has been minimized.

Contributor

arjun810 commented Dec 22, 2013

Thanks. I wasn't aware that the libstdc++ from gcc-4.8 was incompatible with the system one. The problem is that gnu gcc won't build qt on OS X, at least not without commenting out lines in CoreFoundation temporarily, so it looks like I'm stuck working around this one. Thanks for the help though.

ehershey added a commit to ehershey/homebrew that referenced this pull request Apr 4, 2014

qt: apply lots of patches to fix 10.9 HEAD build.
Closes Homebrew#23793.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>

@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.