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

qt failed to build on 10.10 #29837

Closed
unixmonkey opened this issue Jun 3, 2014 · 33 comments
Closed

qt failed to build on 10.10 #29837

unixmonkey opened this issue Jun 3, 2014 · 33 comments

Comments

@unixmonkey
Copy link

$ brew install qt
==> Downloading http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywh
Already downloaded: /Library/Caches/Homebrew/qt-4.8.6.tar.gz
==> ./configure -prefix /usr/local/Cellar/qt/4.8.6 -system-zlib -qt-libtiff -qt-libpng -
==> make
1 error generated.
make[2]: *** [.obj/release-shared/qcocoaapplicationdelegate_mac.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [release] Error 2
make: *** [sub-gui-make_default-ordered] Error 2

Same issue with --developer and --HEAD options

As a workaround, since I had already built QT under 10.9 Mavericks, I moved the old qt directory into /usr/local/Cellar/ and relinked like so:

cp -aR ~/homebrew_backup/Cellar/qt/ /usr/local/Cellar/qt
brew link qt

This appears to work. I was able to use qmake to build a rubygem that requires it.

Full report here:
https://gist.github.com/unixmonkey/9e0fc0518b0fffa43854

@jacknagel
Copy link
Contributor

We can't really provide support for 10.10 build failures at this point. Many, many things are bound to be broken. You'll likely have better luck if you take it straight to the project developers so they can work on 10.10 compatibility.

@anton-matosov
Copy link

I have faced the same problem and had to build it from sources manually.
The fix was really simple (patch below).
Root cause: NSApplication was updated to have delegate as a true property, not a getter/setter pair which implicitly behaves as a property. Because of this and because NSApp is of type 'id' not NSApplication_, the only definition of setDelegate: method visible to the compiler was from the NSFileManager. That is why it was complaining about incompatible types. Replacing the NSApp variable on [NSApplication sharedApplication] fixes the problem, because it returns a typed NSApplication_ instance of shared NSApplication.

Here is the patch:

--- ./qt-everywhere-opensource-src-4.8.6/src/gui/kernel/qcocoaapplicationdelegate_mac.mm    2014-06-12 10:20:38.000000000 +0300
+++ ./qt-everywhere-opensource-src-4.8.6/src/gui/kernel/qcocoaapplicationdelegate_mac.mm    2014-06-12 21:59:18.000000000 +0300
@@ -122,7 +122,7 @@
     [dockMenu release];
     [qtMenuLoader release];
     if (reflectionDelegate) {
-        [NSApp setDelegate:reflectionDelegate];
+        [[NSApplication sharedApplication] setDelegate:reflectionDelegate];
         [reflectionDelegate release];
     }
     [super dealloc];

@mistydemeo
Copy link
Member

Please report this to Qt; thanks!

@mistydemeo
Copy link
Member

That warning is not relevant to the build failure and comes from Homebrew, not qt. It's simply informative to say that that version of Xcode is not yet known by Homebrew, which is normal for prerelease Xcode versions.

@anton-matosov
Copy link

Posted the bug report to qt-project:
https://bugreports.qt-project.org/browse/QTBUG-39644

@emiscience
Copy link

I managed to get around it by manually downloading: Qt libraries 4.8.6 for Mac (185 MB) (Info) from the qt-project website and install them through there.
Worked fine on 10.10. BUT, if you aren't a developer (which you should be having 10.10), you need to turn off Gatekeeper. If you are a developer, just sign the
mpkg files with your "developer installer id" and you're good to go.

Then edit the formula you want to install (as it doesnt see that qt 4 is installed), and remove the qt dep...

Other than that, I see no immediate workaround.

@rahult
Copy link

rahult commented Jul 26, 2014

The patch @anton-matosov suggested worked great, thanks

@anton-matosov
Copy link

You are welcome :)

@zakelfassi
Copy link

+1 for @anton-matosov !
Here's a quick step-by-step on how to apply it and re-run Homebrew;

$ cd /Library/Caches/Homebrew
$ tar -zxvf qt-4.8.6.tar.gz
$ nano ./qt-everywhere-opensource-src-4.8.6/src/gui/kernel/qcocoaapplicationdelegate_mac.mm

Replace the line 125 ([NSApp setDelegate:reflectionDelegate];) by [[NSApplication sharedApplication] setDelegate:reflectionDelegate]; then ctrl+x to save.

$ mv qt-4.8.6.tar.gz qt-4.8.6.tar.gz_BAK
$ tar -zcvf qt-4.8.6.tar.gz qt-everywhere-opensource-src-4.8.6
$ openssl sha1 qt-4.8.6.tar.gz
  SHA1(qt-4.8.6.tar.gz)= de6ab0267560a12e25a4ce63f2aee027a59d07cb #should be exactly this.
$ nano /usr/local/Library/Formula/qt.rb

Then change the 6th line to sha1 "de6ab0267560a12e25a4ce63f2aee027a59d07cb".
Rerun brew install --force qt. You're good to go!
(I should also note that it w/could hours for make to run. Took me 2.)

@MikeMcQuaid
Copy link
Member

@zakelfassi Have you submitted that upstream to Qt/Digia? If not, please do so so they can fix it there.

@DomT4
Copy link
Member

DomT4 commented Aug 3, 2014

@zakelfassi I presume you mean line 125 instead of 122?

122 is [dockMenu release]; whereas 125 is [NSApp setDelegate:reflectionDelegate];.

@zakelfassi
Copy link

@MikeMcQuaid I supposed @anton-matosov already did? I'll check.
@DomT4 Yup thanks. Fixed it.

@derpepe
Copy link

derpepe commented Aug 12, 2014

Thank you all!

@firedev
Copy link

firedev commented Aug 24, 2014

$ openssl sha1 qt-4.8.6.tar.gz SHA1(qt-4.8.6.tar.gz)= de6ab0267560a12e25a4ce63f2aee027a59d07cb
zsh: no matches found: SHA1(qt-4.8.6.tar.gz)=

$ openssl sha1 qt-4.8.6.tar.gz SHA1(qt-4.8.6.tar.gz)=de6ab0267560a12e25a4ce63f2aee027a59d07cb
zsh: no matches found: SHA1(qt-4.8.6.tar.gz)=de6ab0267560a12e25a4ce63f2aee027a59d07cb

$ openssl sha1 qt-4.8.6.tar.gz SHA1(qt-4.8.6.tar.gz) = de6ab0267560a12e25a4ce63f2aee027a59d07cb
zsh: unknown file attribute: q

Please advise.

@zakelfassi
Copy link

@firedev the command you'd run is openssl sha1 qt-4.8.6.tar.gz - the next line SHA1(qt-4.8.6.tar.gz)= de6ab0267560a12e25a4ce63f2aee027a59d07cb is the result you should get (I just put it for verification purposes, as the hashes should match exactly.)

@firedev
Copy link

firedev commented Aug 25, 2014

Oh, thanks, my bad, sorry about that. Because line started with a space I have assumed this is indentation.

@imkarthikk
Copy link

@zakelfassi For some reason, my hash is different :/

@zakelfassi
Copy link

@imkarthikk Do you have the same version? (4.8.6) + please make sure you changed the correct line (and not used Tabs instead of spaces!)

@hryamzik
Copy link
Contributor

After success:

rm -v qt-4.8.6.tar.gz_BAK
rm -rvf qt-everywhere-opensource-src-4.8.6

PS: my sha was b14afa6e4e37dba0c3b82e0fc81341665e08bc1f.

@DomT4
Copy link
Member

DomT4 commented Aug 28, 2014

I've rolled the qt patch into a Homebrew format, and copied the entire source code to Github to boot. Downloading from Github is so much quicker than qt. Anyway, you can grab the Yosemite patched qt with brew install https://raw.github.com/DomT4/homebrew-qt/master/qt.rb --HEAD. I understand qt will be releasing the alpha stage of a new 4.8.7 build towards the end of September, so at that point we might start getting Yosemite-compatible builds from qt natively.

@MikeMcQuaid
Copy link
Member

I've got a few commits in Qt and I can tell you it's pretty unlikely this will be fixed unless it's submitted upstream to their Gerrit (https://codereview.qt-project.org). If someone can submit this upstream I'd be happy to help with that and we'll merge it into our formula. Thanks!

@mistydemeo
Copy link
Member

It's going through code review here: https://codereview.qt-project.org/#/c/87515/

It looks like a different patch will be merged eventually.

@DomT4
Copy link
Member

DomT4 commented Aug 30, 2014

Yikes. That patch is quite a big bigger than the one liner. I'll test it out and if successful merge it into my patched qt on here later today.

@ghost
Copy link

ghost commented Sep 3, 2014

@DomT4
Copy link
Member

DomT4 commented Sep 3, 2014

Interesting. brew install qt4 --HEAD should work then, theoretically. I'll remove my own patched qt and check it out.

@DomT4
Copy link
Member

DomT4 commented Sep 3, 2014

Yup. Can confirm. The --HEAD build for qt4 now works perfectly 👍. I wonder if they adopted the same change for qt5.

@MikeMcQuaid
Copy link
Member

If anyone submits a pull-request I'm happy to include the patch.

@DomT4
Copy link
Member

DomT4 commented Sep 3, 2014

Sure. I'll draft that up tonight.

@DomT4
Copy link
Member

DomT4 commented Sep 4, 2014

Slight hiccups in applying that patch. The patch was built against the current Qt4 trunk by the looks of it, and consequently it doesn't apply cleanly against the stable release of Qt4. I'll probably have to manually edit the diff to account for building against the stable release over the trunk & then patch it in as a :DATA. Should hopefully iron out the last few hiccups later today.

@MikeMcQuaid
Copy link
Member

@DomT4 I'd also be up for just applying the relevant other commits as patches instead if it means we can use more upstream commits.

@yurci
Copy link

yurci commented Sep 11, 2014

@zakelfassi I followed your directions about changing sha1. And when I try to install qt I am getting this error;

Error: SHA1 mismatch
Expected: de6ab0267560a12e25a4ce63f2aee027a59d07cb
Actual: 477287007a12f419e1ab54756245b42fdff7a638

Any ideas?

@zakelfassi
Copy link

@yurci the only explanations is that 1/ you used tabs instead of spaces 2/ wrong line changed.
Please double check.

@MikeMcQuaid
Copy link
Member

You shouldn't need that; if you brew update the latest version of qt works on 10.10.

eugene1g added a commit to eugene1g/phantomjs that referenced this issue Feb 1, 2015
nicks pushed a commit to Medium/phantomjs-1 that referenced this issue Feb 4, 2015
@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

No branches or pull requests