Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building texworks on OSX Ventura / Apple Silicon #998

Open
jlaurens opened this issue Mar 13, 2023 · 4 comments
Open

Building texworks on OSX Ventura / Apple Silicon #998

jlaurens opened this issue Mar 13, 2023 · 4 comments
Labels

Comments

@jlaurens
Copy link
Collaborator

Bug description:

Following instructions of Building-on-macOS-(Homebrew).

Downloading seems OK, cmake -B build -S . -DQT_DEFAULT_MAJOR_VERSION=6 stops with output

CMake Error at /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Hunspell (missing: HUNSPELL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  CMake/Modules/FindHunspell.cmake:50 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:325 (FIND_PACKAGE)

I am not very familiar with cmake, I eventually found a fix by adding /opt/homebrew in various PATHS sections in FindHunspell.cmake. The hunspell problem is solved.

But then the problem goes with poppler, and I could not solve it on my own:

warning: target 'Poppler_LIBRARY-NOTFOUND' is not absolute...
warning: target 'Poppler_LIBRARY-NOTFOUND' does not exist...
-- Could NOT find Poppler_qt6 (missing: Poppler_qt6_LIBRARY Poppler_qt6_INCLUDE_DIR) 
CMake Error at /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Poppler (missing: Poppler_LIBRARY qt6)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  modules/QtPDF/CMake/Modules/FindPoppler.cmake:192 (find_package_handle_standard_args)
  modules/QtPDF/CMakeLists.txt:166 (FIND_PACKAGE)
@jlaurens jlaurens added the bug label Mar 13, 2023
@stloeffler
Copy link
Member

Thanks for testing and reporting. It seems there are several (potential) issues at play here:

  • hunspell
    if you ran brew install hunspell, the library should be installed and found - at least by homebrew's CMake. However, by default, I would have assumed it is installed in /usr/local/Cellar/ rather than /opt/homebrew. At least that would be consistent with the paths in the automatic GitHub Actions build, and with your cmake path.
  • poppler
    There seem to be several related issues here. First of all, homebrew's poppler seems to no longer ship with the Qt bindings by default. Instead, the the Qt "wrapper" is "outsourced" into its own formula, named poppler-qt5. As the name suggests, it is built with Qt5 instead of Qt6. AFAICT, there is no poppler-qt6 yet. So the correct packages to install should be brew install poppler-qt5 qt@5. Consequently, you'd have to build with -DQT_DEFAULT_MAJOR_VERSION=5.

Please have a look at the source code for automatic builds on GitHub Actions. It might include some workarounds for the specific GitHub environment (which has a bunch of things pre-installed), but generally it runs (and succeeds) regularly (currently on macOS 12.6.3, though).

When we find working homebrew instructions I will happily update the wiki page, of course.

@jlaurens
Copy link
Collaborator Author

jlaurens commented Mar 14, 2023

It seems there is a recent problem with poppler and qt6 on macOS X.
See this TeXstudio issue

@jlaurens jlaurens changed the title Building texworks on OSX Ventura Building texworks on OSX Ventura / Apple Silicon Mar 14, 2023
@jlaurens jlaurens linked a pull request Mar 14, 2023 that will close this issue
@jlaurens
Copy link
Collaborator Author

After comments on the draft PR, here is what works to build arm64 binaries with actual sources
From a standard terminal

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install hunspell poppler-qt5 lua qt@5
brew link --force poppler-qt5

From the local texworks root directory

mkdir build
cd build
cmake -DQT_DEFAULT_MAJOR_VERSION=5 -DQt5_DIR=/opt/homebrew/Cellar/qt@5/5.15.8_2/lib/cmake/Qt5 -DCMAKE_PREFIX_PATH=/opt/homebrew -DCMAKE_OSX_ARCHITECTURES=arm64 ..
make -j

I could not get rid of the exact Qt version, and this is a problem. If I remove this definition, I get next error running cmake

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

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

    Qt5Config.cmake
    qt5-config.cmake

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

The only file available on my whole HD is

/opt/homebrew/Cellar/qt@5/5.15.8_2/lib/cmake/Qt5/Qt5Config.cmake

There is a second problem concerning universal binaries. It would be great if texworks was also available as an arm64 application. Usually Mac applications are universal in the sense that they contain both the x86_64 and arm64 binaries. Unfortunately, it seems that this cannot be achieved with actual source code, whatever command line option is used.

@jlaurens
Copy link
Collaborator Author

In order to build universal macOS binaries, there might be a gihub action macos-universal-binary-action)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants