cartr / homebrew-qt4

Homebrew tap for Qt4 and dependent formulae on Sierra
BSD 2-Clause "Simplified" License
105 stars 42 forks source link

qt@4: Fix build on Mojave #63

Closed cartr closed 5 years ago

cartr commented 5 years ago

In Xcode 10/macOS Mojave, Apple moved some of the system header files around for whatever reason. The system clang is able to find the headers in the new locations, but it refuses to do so if your MACOSX_DEPLOYMENT_TARGET is lower than 10.9. It turns out that Qt was setting MACOSX_DEPLOYMENT_TARGET=10.4, which meant that clang wouldn't find the C++ standard library headers, which caused the build to fail.

This PR resolves this issue by patching Qt to set MACOSX_DEPLOYMENT_TARGET=10.9. This means that Qt applications compiled on a Mojave machine using this formula will no longer work on macOS versions older than Mavericks, which is probably not a huge loss.

Closes #62. @pjessesco, can you verify that this PR fixes your issue?

pjessesco commented 5 years ago

Thanks, how can I test this patch?

cartr commented 5 years ago

@pjessesco I usually test branches by cd-ing to Homebrew's copy of the repo and checking out the branch there. You can do that with the following commands:

$ cd /usr/local/Homebrew/Library/Taps/cartr/homebrew-qt4
$ git config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && git fetch
$ git checkout qt-mojave
$ brew install qt@4

(That git config line is needed because by default, Homebrew only fetches the master branch of a tap.)

pjessesco commented 5 years ago

Thanks. I'll try it as soon as possible, maybe few hours.

pjessesco commented 5 years ago

There are some typo in bottle download link.

2018-09-28 10 23 18 2018-09-28 10 24 19

qt4, pyqt4, pyside, and others for mojave. Otherwise it builds successfully.

cartr commented 5 years ago

@pjessesco Thanks for testing, and good catch on the bottle names! I've re-uploaded them with the correct names, so we should be good to go.

pjessesco commented 5 years ago

FYI : I found that Apple removed /usr/include as you said, and I could restore the path using installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / (it generates /usr/include like High Sierra)