Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Qt4 on Mavericks (CLOSED) #23793

Closed
wants to merge 1 commit into from
Closed

Qt4 on Mavericks (CLOSED) #23793

wants to merge 1 commit into from

Conversation

cliffrowley
Copy link
Contributor

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.

@@ -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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, that needs a new helper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#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.

@adamv
Copy link
Contributor

adamv commented Oct 30, 2013

SSSE3 Not to be confused with SSE3.

@arxpoetica
Copy link

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
Copy link
Contributor

@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
Copy link

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

@mistydemeo
Copy link
Member

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

@arxpoetica
Copy link

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

@cliffrowley
Copy link
Contributor Author

@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
Copy link
Member

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

@cliffrowley
Copy link
Contributor Author

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
Copy link
Contributor Author

@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
Copy link
Contributor Author

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'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok for resources to fail audit for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamv Stuff failing audit stops bottles being built.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MikeMcQuaid
Copy link
Member

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

@MikeMcQuaid
Copy link
Member

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

@cliffrowley
Copy link
Contributor Author

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

@MikeMcQuaid
Copy link
Member

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

@cliffrowley
Copy link
Contributor Author

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

@MikeMcQuaid
Copy link
Member

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

@cliffrowley
Copy link
Contributor Author

@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
Copy link
Contributor

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
Copy link
Contributor Author

@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
Copy link

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
Copy link
Contributor Author

@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
Copy link
Member

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

@cliffrowley
Copy link
Contributor Author

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

@MikeMcQuaid
Copy link
Member

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

@cliffrowley
Copy link
Contributor Author

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

@mistydemeo
Copy link
Member

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
Copy link
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.

@stevenbarragan
Copy link

@cliffrowley
Copy link
Contributor Author

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
Copy link
Contributor

adamv commented Nov 25, 2013

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

@adamv
Copy link
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
Copy link
Member

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

@MikeMcQuaid
Copy link
Member

@mistydemeo @cliffrowley PR at #24674.

yriveiro pushed a commit to yriveiro/homebrew that referenced this pull request Nov 26, 2013
Closes Homebrew#23793.

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

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
Copy link
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
Copy link
Contributor Author

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

@kartikthapar
Copy link

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
Copy link
Contributor Author

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

@arjun810
Copy link
Contributor

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
Copy link
Member

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
Copy link
Contributor

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 pushed a commit to ehershey/homebrew that referenced this pull request Apr 4, 2014
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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.