Skip to content

Fix QT4 build for mac#10944

Merged
scheibelp merged 9 commits intospack:developfrom
sethrj:fix-qt4-mac
Aug 1, 2019
Merged

Fix QT4 build for mac#10944
scheibelp merged 9 commits intospack:developfrom
sethrj:fix-qt4-mac

Conversation

@sethrj
Copy link
Copy Markdown
Contributor

@sethrj sethrj commented Mar 20, 2019

This PR:

  • adds support for the "latest" QT 4,
  • fixes an error in the package script that manifests on mac+clang builds,
  • fixes the build for High Sierra,
  • allows more components of QT to be disabled to improve chance of success
  • adds "+static" variant so it can be (in theory) built statically

Fixes #12139

Copy link
Copy Markdown
Member

@michaelkuhn michaelkuhn left a comment

Choose a reason for hiding this comment

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

Looks good to me (I touched the system-* stuff recently). However, I cannot say anything about the Mac-specific parts since I do not have one to test them.

Edit: Could you please take care of the flake8 warnings?

var/spack/repos/builtin/packages/qt/package.py:11: [E302] expected 2 blank lines, found 1
var/spack/repos/builtin/packages/qt/package.py:14: [E302] expected 2 blank lines, found 1
var/spack/repos/builtin/packages/qt/package.py:250: [E128] continuation line under-indented for visual indent
var/spack/repos/builtin/packages/qt/package.py:251: [E128] continuation line under-indented for visual indent
var/spack/repos/builtin/packages/qt/package.py:252: [E128] continuation line under-indented for visual indent
var/spack/repos/builtin/packages/qt/package.py:281: [E122] continuation line missing indentation or outdented
var/spack/repos/builtin/packages/qt/package.py:282: [E122] continuation line missing indentation or outdented
var/spack/repos/builtin/packages/qt/package.py:298: [E128] continuation line under-indented for visual indent
var/spack/repos/builtin/packages/qt/package.py:299: [E128] continuation line under-indented for visual indent
var/spack/repos/builtin/packages/qt/package.py:389: [E123] closing bracket does not match indentation of opening bracket's line

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Mar 26, 2019

Great! My bad regarding the flake issues (and multiple successive CI-triggering pushes on a PR). I'll get that done ASAP.

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Mar 29, 2019

@michaelkuhn I had to make several more changes (the initial PR worked on the 10.13 SDK, then I added support for 10.14 SDK with clang-9, now it works with 10.14 SDK with clang-10).

I've also taken care of the flake8 warnings, sorry about that.

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

I have a few questions. I'll have a chance to look through this more on 4/1

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Apr 3, 2019

@scheibelp After building some downstream code on my mac (which uses Fortran that links against wrapped QT code, ugh) I realized that there are more changes that need to be made to make the Mac QT4 install "ideal". Frankly, it would be ideal to "port" over all the patches and configuration logic used by MacPorts -- what are the licensing implications of doing this?

@sethrj sethrj mentioned this pull request Apr 5, 2019
@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Apr 5, 2019

@scheibelp Never mind about macports; I realized that all I needed to do to make the downstream happier was to install qt not as a framework. So I added the +framework variant: the default now is to install on all systems in lib/ and include/, and to install in Frameworks/ only when the variant is enabled. To restore the original behavior (install by default as a framework on mac) then we'll have to change the default from False to sys.platform == 'darwin'.

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Jul 28, 2019

As per the contribution guidelines I've rebased the commits I can and squashed the more complex changes. @scheibelp Would you please take another look? There are no substantial changes since I addressed your last review feedback. Thanks!

Copy link
Copy Markdown
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

There are a lot of changes in this PR, and I certainly didn't look at all of them in detail, but I'm willing to give this PR a spin and see if it fixes #12139. I think the only open PR I have that modifies Qt is #12138, but I think you already fixed this bug here, right?

Copy link
Copy Markdown
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

It worked! I was able to successfully install Qt 4.8.7 on macOS 10.14.5 with Clang 10.0.1. Thanks for digging into such a complicated package!

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Jul 29, 2019

Excellent! Yes, sorry it ended up being rather large -- it's basically a rewrite of the package definition for QT 4.

@scheibelp
Copy link
Copy Markdown
Member

Apologies but when I merged #12138 it generated a conflict here. Do you think you'll have an opportunity to sync it with develop in the near future?

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Jul 30, 2019

@scheibelp No worries, rebased and fixed.

@scheibelp
Copy link
Copy Markdown
Member

I am not seeing the changes we discussed at #10944 (comment) - did something change where you thought that was no longer necessary? To expand on #10944 (comment), I think it would be more straightforward to explicitly disable cocoa by replacing

if ac_fn_c_try_compile "$LINENO"; then :
  glib_have_cocoa=yes
fi

with

glib_have_cocoa=no

(since it appears the test fails even for compilers that support cocoa)

sethrj added 5 commits July 31, 2019 07:08
There's no reason not to store the 'minor' mac version number or to use
the convenience methods of the `Version` object.
The _localemodule.c file fails to link due to missing symbols from
libintl, which is provided by `gettext`.
Adding `gettext` as an explicit dependency required an update to
specify the names of the libraries it builds.
- Add QT 4.8.7 version
- Add option to disable QT build as a framework on mac
- Add patches for Clang 10 and OSX SDK up to 10.15
- Add variant to disable QT4 tools
- Add variant to disable SSL support
- Break QT installation into configure/build/install phases
- Moved dependency declaration in python package
- As per a previous discussion about libuuid, removing the 'conflict'
for untested versions of MacOS.
- Fixed typo and clarified conflict message
In accordance with "innocent until proven guilty" policy
@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Jul 31, 2019

Sorry @scheibelp! I lost track of your previous comment. You're correct, even for mac clang it appears that it's still configuring with

checking for Mac OS X Cocoa support... no

Since that change to glib was because I was playing with building out a macOS GCC8 toolchain, and I no longer have that configuration set up, I'm just reverting the changes to glib. (Having these unrelated changes isn't exactly in line with the newish spack "one PR, one package" policy either.)

Copy link
Copy Markdown
Member

@scheibelp scheibelp left a comment

Choose a reason for hiding this comment

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

I have a few additional requests/questions which I think are minor.

@scheibelp scheibelp merged commit 46027be into spack:develop Aug 1, 2019
@scheibelp
Copy link
Copy Markdown
Member

Thanks!

@sethrj
Copy link
Copy Markdown
Contributor Author

sethrj commented Aug 1, 2019

Glad to! Thanks for the merge :)

@sethrj sethrj deleted the fix-qt4-mac branch August 1, 2019 17:50
dev-zero pushed a commit to dev-zero/spack that referenced this pull request Aug 13, 2019
This updates the Spack QT package to enable building qt version 4 on
MacOS. 

This includes the following changes to the qt package:

* add version 4.8.7
* add option to build with or without shared libs
* add options to disable tools, ssl, sql, and freetype support
* add qt4-tools patch when building qt@4+tools
* add option to build as a framework (only available on MacOS)
* replace qt4-el-capitan patch with qt4-mac patch (which includes the
  edits from qt4-el-capitan)
* apply qt4-pcre-include-conflict.patch only for version 4.8.6
  (rather than all 4.x versions)
* apply qt4-gcc-and-webkit.patch for 4.x versions before 4.8.7 and
  create a separate qt4-gcc-and-webkit-487.patch for version 4.8.7
* update patch function for qt@4 on MacOS to update configure
  variables relevant to Spack (e.g. PREFIX)
* add option to build freetype with Spack, as a vendored dependency
  of QT, or not at all (default is to build with Spack)

This includes the following edits outside of the qt package:

* Update MacOS version utility function to return all parts of the
  Mac version (rather than just the first two)
* gettext package: implement "libs"
* python package: add gettext as a dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installation issue: Qt 4 on macOS

4 participants