macOS Qt5 plan and status

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

macOS Qt5 plan and status

Post by blacey »

It seems the homebrew folks (i.e. macOS ports system) have dropped support for QT4 completely defaulting the ports repo and packages to QT5. This is causing the macOS builds to fail to build... I know @f3nix and @wmayer have recently made numerous changes to support QT4 but what is the plan to switch FreeCAD 0.17 dev to QT5? Bottom-line, is the QT5 support sufficiently complete that we can safely switch the macOS builds to QT5 now? If not, I will need to find a way to continue to support QT4 that will inevitably be obviated by QT5 support so I would like to avoid any extra QT4 work.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: QT5 status and plan?

Post by wmayer »

FreeCAD is already ported to Qt5. There might still be some issues here and there but it should work sufficiently well.
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: QT5 status and plan?

Post by blacey »

Great. At first blush, it seems there are some platform-specific library naming nuances that will cause some work to bring up QT5 on macOS.

Code: Select all

-- Found Eigen3: /usr/local/include/eigen3 (Required is at least version "2.91.0") 
CMake Warning at CMakeLists.txt:738 (find_package):
  By not providing "FindQt5Network.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Network", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Network" with
  any of the following names:

    Qt5NetworkConfig.cmake
    qt5network-config.cmake

  Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
  "Qt5Network_DIR" to a directory containing one of the above files.  If
  "Qt5Network" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:739 (find_package):
  By not providing "FindQt5Xml.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Xml", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Xml" with any
  of the following names:

    Qt5XmlConfig.cmake
    qt5xml-config.cmake

  Add the installation prefix of "Qt5Xml" to CMAKE_PREFIX_PATH or set
  "Qt5Xml_DIR" to a directory containing one of the above files.  If "Qt5Xml"
  provides a separate development package or SDK, be sure it has been
  installed.


CMake Warning at CMakeLists.txt:741 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:742 (find_package):
  By not providing "FindQt5PrintSupport.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5PrintSupport", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5PrintSupport"
  with any of the following names:

    Qt5PrintSupportConfig.cmake
    qt5printsupport-config.cmake

  Add the installation prefix of "Qt5PrintSupport" to CMAKE_PREFIX_PATH or
  set "Qt5PrintSupport_DIR" to a directory containing one of the above files.
  If "Qt5PrintSupport" provides a separate development package or SDK, be
  sure it has been installed.


CMake Warning at CMakeLists.txt:743 (find_package):
  By not providing "FindQt5OpenGL.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5OpenGL", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5OpenGL" with
  any of the following names:

    Qt5OpenGLConfig.cmake
    qt5opengl-config.cmake

  Add the installation prefix of "Qt5OpenGL" to CMAKE_PREFIX_PATH or set
  "Qt5OpenGL_DIR" to a directory containing one of the above files.  If
  "Qt5OpenGL" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:744 (find_package):
  By not providing "FindQt5Svg.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Svg", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Svg" with any
  of the following names:

    Qt5SvgConfig.cmake
    qt5svg-config.cmake

  Add the installation prefix of "Qt5Svg" to CMAKE_PREFIX_PATH or set
  "Qt5Svg_DIR" to a directory containing one of the above files.  If "Qt5Svg"
  provides a separate development package or SDK, be sure it has been
  installed.


CMake Warning at CMakeLists.txt:745 (find_package):
  By not providing "FindQt5UiTools.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5UiTools", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5UiTools" with
  any of the following names:

    Qt5UiToolsConfig.cmake
    qt5uitools-config.cmake

  Add the installation prefix of "Qt5UiTools" to CMAKE_PREFIX_PATH or set
  "Qt5UiTools_DIR" to a directory containing one of the above files.  If
  "Qt5UiTools" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:746 (find_package):
  By not providing "FindQt5Network.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Network", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Network" with
  any of the following names:

    Qt5NetworkConfig.cmake
    qt5network-config.cmake

  Add the installation prefix of "Qt5Network" to CMAKE_PREFIX_PATH or set
  "Qt5Network_DIR" to a directory containing one of the above files.  If
  "Qt5Network" provides a separate development package or SDK, be sure it has
  been installed.


CMake Warning at CMakeLists.txt:747 (find_package):
  By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Concurrent", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Concurrent"
  with any of the following names:

    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake

  Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
  "Qt5Concurrent_DIR" to a directory containing one of the above files.  If
  "Qt5Concurrent" provides a separate development package or SDK, be sure it
  has been installed.


CMake Warning at CMakeLists.txt:750 (find_package):
  By not providing "FindQt5WebKitWidgets.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5WebKitWidgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5WebKitWidgets"
  with any of the following names:

    Qt5WebKitWidgetsConfig.cmake
    qt5webkitwidgets-config.cmake

  Add the installation prefix of "Qt5WebKitWidgets" to CMAKE_PREFIX_PATH or
  set "Qt5WebKitWidgets_DIR" to a directory containing one of the above
  files.  If "Qt5WebKitWidgets" provides a separate development package or
  SDK, be sure it has been installed.


CMake Error at CMakeLists.txt:755 (MESSAGE):
  ========================

  Qt5 libraries not found.

  ========================
The libraries are there, just named differently (i.e. the same as the QT4 libraries are named).

Code: Select all

$ find /usr/local/Cellar/qt5/5.7.1_1/ -name 'Qt*Network*'
/usr/local/Cellar/qt5/5.7.1_1//Frameworks/QtNetwork.framework
/usr/local/Cellar/qt5/5.7.1_1//include/QtNetwork
/usr/local/Cellar/qt5/5.7.1_1//lib/cmake/Qt5Network
/usr/local/Cellar/qt5/5.7.1_1//lib/cmake/Qt5Network/Qt5Network_QCoreWlanEnginePlugin.cmake
/usr/local/Cellar/qt5/5.7.1_1//lib/cmake/Qt5Network/Qt5Network_QGenericEnginePlugin.cmake
/usr/local/Cellar/qt5/5.7.1_1//lib/cmake/Qt5Network/Qt5NetworkConfig.cmake
/usr/local/Cellar/qt5/5.7.1_1//lib/cmake/Qt5Network/Qt5NetworkConfigVersion.cmake
/usr/local/Cellar/qt5/5.7.1_1//lib/pkgconfig/Qt5Network.pc
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/QtNetwork
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/QtNetwork.prl
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/Versions/5/Headers/5.7.1/QtNetwork
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/Versions/5/Headers/QtNetwork
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/Versions/5/Headers/QtNetworkDepends
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/Versions/5/Headers/QtNetworkVersion
/usr/local/Cellar/qt5/5.7.1_1//lib/QtNetwork.framework/Versions/5/QtNetwork
Does anyone have a suggested "best" strategy to address this macOS platform-specific QT5 difference? Change CMakeLists.txt, rename macOS lib names (yuck) to match other platforms? Has anyone (e.g. @sgrogan) built FreeCAD dev against QT5 on Windows?

For now, I will go down the tailor CMake path to handle macOS-specific nuances unless someone has a better way to handle this difference.
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: QT5 status and plan?

Post by f3nix »

Hi @blacey.

I think running cmake with:

Code: Select all

-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.7.1_1/lib/cmake
should do the trick.

Do You have PySide2 built againt 5.7.1 available? I am not able to compile it on Linux right now.

So far I have tested building against Qt5.3.2, Qt 5.4.2, Qt 5.5.1, Qt 5.6.2.

It works with 5.7.1 (PySide2 built againt 5.6.2). But this mismatch causes some runtime problems (small, but still...).

Cheers,
Mateusz
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: QT5 status and plan?

Post by blacey »

@f3nix, thanks for the pointer...
f3nix wrote: Do You have PySide2 built againt 5.7.1 available? I am not able to compile it on Linux right now.
I'm actually working through pyside2 as I type... I am using clang 6.1 but pyside2 complains that my compiler is not C++11 compliant yet it is.

Code: Select all

-- The C compiler identification is AppleClang 6.1.0.6020053
-- The CXX compiler identification is AppleClang 6.1.0.6020053

Code: Select all

In file included from /usr/local/lib/QtCore.framework/Headers/qglobal.h:83:
/usr/local/lib/QtCore.framework/Headers/qcompilerdetection.h:562:6: error: Qt requires a C++11 compiler and yours does not seem to be that.
#    error Qt requires a C++11 compiler and yours does not seem to be that.
     ^
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: QT5 status and plan?

Post by f3nix »

I do not have access to an Apple machine. But maybe some cmake flags are not set right in pyside.

I would also suggest staying with Qt 5.6.2 if it is an option.

Are you using pyside2-setup? Or compiling each component? I have always had more success with the second approach. shiboken2 -> pyside2 -> pyside2-tools

Cheers,
Mateusz
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: QT5 status and plan?

Post by blacey »

f3nix wrote:I do not have access to an Apple machine. But maybe some cmake flags are not set right in pyside.

I would also suggest staying with Qt 5.6.2 if it is an option.

Are you using pyside2-setup? Or compiling each component? I have always had more success with the second approach. shiboken2 -> pyside2 -> pyside2-tools

Cheers,
Mateusz
Hi Mateusz,

I took your advise and dropped back to QT5.5, the only version available other than 5.7.1. I was able to build pyside2 using pyside2-setup.

Code: Select all

Installing pyside2-uic script to /usr/local/bin

Installed /usr/local/lib/python2.7/site-packages/PySide2-2.0.0.dev0-py2.7-macosx-10.10-x86_64.egg
Processing dependencies for PySide2==2.0.0.dev0
Finished processing dependencies for PySide2==2.0.0.dev0
However now cmake complains that it can't find shiboken2 even though it is installed...

Code: Select all

$ find /usr/local -name 'shiboken2*'
/usr/local/lib/python2.7/site-packages/PySide2-2.0.0.dev0-py2.7-macosx-10.10-x86_64.egg/PySide2/include/shiboken2
/usr/local/lib/python2.7/site-packages/PySide2-2.0.0.dev0-py2.7-macosx-10.10-x86_64.egg/PySide2/shiboken2
/usr/local/lib/python2.7/site-packages/PySide2-2.0.0.dev0-py2.7-macosx-10.10-x86_64.egg/PySide2/shiboken2.so
Here is a GitHub gist of the pyside2-setup output and associated attempt to build FreeCAD with QT5...

Perhaps I will look at installing each element individually or at least shiboken2 ;) Do you mind providing the installation command-line arguments that you are using on Linux?

Also, if you would like access to an Apple Machine, I can provide that... I can create a VM and install all the necessary ports and provide you with ssh access if you would like (I would only need a preferred username and associated public rsa key from you).

Cheers,
Bruce
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: QT5 status and plan?

Post by f3nix »

Setting this:
-DShiboken2_Dir=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/lib/cmake/Shiboken2-2.0.0
-DPySide2_DIR=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/lib/cmake/PySide2-2.0.0

should hopefully allow you to move forward :)
blacey wrote: Also, if you would like access to an Apple Machine, I can provide that... I can create a VM and install all the necessary ports and provide you with ssh access if you would like (I would only need a preferred username and associated public rsa key from you).
Thank You. This is a very generous offer. But I wouldn't want to waste your time on this. I don't know nothing about this environment... :oops:

Cheers,
Mateusz
blacey
Posts: 370
Joined: Tue Dec 08, 2015 11:28 pm

Re: QT5 status and plan?

Post by blacey »

f3nix wrote:Setting this:
-DShiboken2_Dir=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/lib/cmake/Shiboken2-2.0.0
-DPySide2_DIR=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/lib/cmake/PySide2-2.0.0

should hopefully allow you to move forward :)
I tried the above but no joy. It finds shiboken2 but not pyside2 tools...

Code: Select all

$ cmake -DBUILD_FEM_NETGEN=ON -DFREECAD_USE_EXTERNAL_KDL=ON -DFREECAD_CREATE_MAC_APP=ON -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_QT5=ON -DShiboken2_DIR=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/lib/cmake/Shiboken2-2.0.0 -DPySide2_DIR=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/lib/cmake/PySide2-2.0.0 ..
-- prefix: /usr/local
-- datadir: data
-- docdir: doc
-- includedir: include
-- libdir: /usr/local/lib
-- Detected Homebrew install at /usr/local
-- Boost version: 1.62.0
-- Found the following Boost libraries:
--   filesystem
--   program_options
--   regex
--   signals
--   system
--   thread
--   chrono
--   date_time
--   atomic
-- Found Xerces-C: /usr/local/lib/libxerces-c.dylib
-- PyCXX found:
--   Headers:  /Users/blacey/FreeCAD-MacOS-CI/src
--   Sources:  /Users/blacey/FreeCAD-MacOS-CI/src/CXX
-- -- Found OCE/OpenCASCADE version: 7.0.0
-- -- OCE/OpenCASCADE include directory: /usr/local/include/opencascade
-- -- OCE/OpenCASCADE shared libraries directory: /usr/local/lib
-- VTK components: not found or used
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- Check for medfile (libmed and libmedc) ...
-- Found NETGEN version 5.3, calculated: 328448
-- Could NOT find Spnav (missing:  SPNAV_LIBRARY SPNAV_INCLUDE_DIR) 
-- libshiboken built for Release
CMake Error at cMake/FindPySide2Tools.cmake:88 (message):
  PySide2 tools could not be found, but are required.
Call Stack (most recent call first):
  CMakeLists.txt:854 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/blacey/FreeCAD-MacOS-CI/build/CMakeFiles/CMakeOutput.log".
See also "/Users/blacey/FreeCAD-MacOS-CI/build/CMakeFiles/CMakeError.log".

Code: Select all

$ cat /Users/blacey/FreeCAD-MacOS-CI/build/CMakeFiles/CMakeError.log
Determining if the include file GL/gl.h exists failed with the following output:
Change Dir: /Users/blacey/FreeCAD-MacOS-CI/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_46ac7/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_46ac7.dir/build.make CMakeFiles/cmTC_46ac7.dir/build
Building C object CMakeFiles/cmTC_46ac7.dir/CheckIncludeFile.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc     -o CMakeFiles/cmTC_46ac7.dir/CheckIncludeFile.c.o   -c /Users/blacey/FreeCAD-MacOS-CI/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/Users/blacey/FreeCAD-MacOS-CI/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: 'GL/gl.h' file not found
#include <GL/gl.h>
         ^
1 error generated.
make[1]: *** [CMakeFiles/cmTC_46ac7.dir/CheckIncludeFile.c.o] Error 1
make: *** [cmTC_46ac7/fast] Error 2
I find it a bit unconventional that the ports are installed in /usr/local and I used --prefix=/usr/local on the python setup command but the cmake files reside in the source/build directory and not somewhere under /usr/local

Do you have the commands you used to build and install the pyside2 components?
User avatar
f3nix
Posts: 346
Joined: Sat May 30, 2015 11:58 am

Re: QT5 status and plan?

Post by f3nix »

blacey wrote:Do you have the commands you used to build and install the pyside2 components?
Sorry. No.
I have "installed" the files by hand ;) I'm too lazy.

But

-DPYSIDE2UICBINARY=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/bin/pyside2-uic
-DPYSIDE2RCCBINARY=/Users/blacey/pyside2-setup/pyside_install/py2.7-qt5.5.1-64bit-release/bin/pyside2-rcc

should do it for now.

Cheers,
Mateusz
Post Reply