Skip to content

Instantly share code, notes, and snippets.

@7468696e6b
Last active November 2, 2024 06:41
Show Gist options
  • Save 7468696e6b/ec8fa5d6cdb4e80633b9df95869b70c0 to your computer and use it in GitHub Desktop.
Save 7468696e6b/ec8fa5d6cdb4e80633b9df95869b70c0 to your computer and use it in GitHub Desktop.
how to install Okular viewer on macOS Big Sur, using M1/Apple Silicon/arm64
  1. Install homebrew from https://brew.sh/ (follow the instructions there)
  2. tap the https://invent.kde.org/packaging/homebrew-kde/ repo, brew tap kde-mac/kde https://invent.kde.org/packaging/homebrew-kde.git
  3. brew edit okular, workaround now is to comment out or delete the line depends_on "chmlib" (won't compile on macos arm64 for now as of 2021-08-18), then save (if using vim you need to first press i to insert/type, when saving then <esc> then :wq then <enter>.
  4. brew install okular, wait for stuff to compile and/or install
  5. It may ask for keychain credentials (to sign the binaries? because of mac arm64 security policy https://eclecticlight.co/2021/01/26/when-you-dont-have-permission-to-run-an-app-on-an-m1-mac/)
  6. $(brew --repo kde-mac/kde)/tools/do-caveats.sh
  7. Now okular is in your $HOME/Applications/KDE folder, and will show up in Launchpad! You can view pdf, djvu, etc documents.
@MrLego8-9
Copy link

It's a pain to fix but I managed to make it work. You have to get the .tar.xz archive containing the source and the CMakeLists.txt (it should be in brew's cache if I remember)
Edit the CMakeLists.txt :
Change
set(CMAKE_CXX_STANDARD 14) ==> set(CMAKE_CXX_STANDARD 17)
and
set(CMAKE_CXX_EXTENSIONS OFF) ==> set(CMAKE_CXX_EXTENSIONS ON)
Once it's done, rearchive this, and get the SHA256 for the .tar.xz archive, and put it as as the hash in the homebrew formula for okular (l.7)
Replace the archive in it's original folder.
Now it should compile

@ferdiga
Copy link

ferdiga commented Jul 7, 2023

thanks this works fine for me

@ferdiga
Copy link

ferdiga commented Jul 7, 2023

I can now open okular and okular can open a pdf file.

nevertheless I can not assigne okular as the default pdf app.

It looks like that aps stored in /Users/<username>/Applications (where okular.app is stored) can not be selected and set as default as described using the "Get Info" - "Open with" settings

@Zayd-Jamadar
Copy link

Zayd-Jamadar commented Aug 17, 2023

Hey, I get this error on Macbook M2, how can I solve this?

Installing okular from kde-mac/kde
==> Patching
==> cmake -G Ninja -B build -S . -D BUILD_QCH=ON -D BUILD_TESTING=ON -D BUILD_TESTS=ON -D BUILD_UNITTESTS=ON -D CMAKE_INSTALL_BUNDLEDIR
==> cmake --build build
Last 15 lines from /Users/zayd/Library/Logs/Homebrew/okular/02.cmake:
^
/opt/homebrew/opt/poppler-qt5/include/poppler/qt5/poppler-export.h:25:50: note: expanded from macro 'POPPLER_QT5_DEPRECATED'

define POPPLER_QT5_DEPRECATED attribute ((deprecated))

                                             ^

1 warning and 1 error generated.

If reporting this issue please do so to (not Homebrew/brew or Homebrew/homebrew-core):
kde-mac/kde

/opt/homebrew/Library/Homebrew/utils/github/api.rb:337:in raise_error': Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] (GitHub::API::ValidationFailedError) from /opt/homebrew/Library/Homebrew/utils/github/api.rb:263:in open_rest'
from /opt/homebrew/Library/Homebrew/utils/github.rb:178:in search' from /opt/homebrew/Library/Homebrew/utils/github.rb:182:in search_results_items'
from /opt/homebrew/Library/Homebrew/utils/github.rb:36:in search_issues' from /opt/homebrew/Library/Homebrew/utils/github.rb:62:in issues_for_formula'
from /opt/homebrew/Library/Homebrew/exceptions.rb:502:in fetch_issues' from /opt/homebrew/Library/Homebrew/exceptions.rb:497:in issues'
from /opt/homebrew/Library/Homebrew/exceptions.rb:553:in dump' from /opt/homebrew/Library/Homebrew/brew.rb:151:in rescue in

'
from /opt/homebrew/Library/Homebrew/brew.rb:139:in <main>' /opt/homebrew/Library/Homebrew/formula.rb:2741:in block in system': Failed executing: cmake --build build (BuildError)
from /opt/homebrew/Library/Homebrew/formula.rb:2677:in open' from /opt/homebrew/Library/Homebrew/formula.rb:2677:in system'
from /opt/homebrew/Library/Taps/kde-mac/homebrew-kde/Formula/okular.rb:44:in install' from /opt/homebrew/Library/Homebrew/build.rb:177:in block (3 levels) in install'
from /opt/homebrew/Library/Homebrew/extend/kernel.rb:499:in with_env' from /opt/homebrew/Library/Homebrew/build.rb:139:in block (2 levels) in install'
from /opt/homebrew/Library/Homebrew/formula.rb:1420:in block in brew' from /opt/homebrew/Library/Homebrew/formula.rb:2908:in block (2 levels) in stage'
from /opt/homebrew/Library/Homebrew/extend/kernel.rb:499:in with_env' from /opt/homebrew/Library/Homebrew/formula.rb:2907:in block in stage'
from /opt/homebrew/Library/Homebrew/resource.rb:128:in block (2 levels) in unpack' from /opt/homebrew/Library/Homebrew/download_strategy.rb:118:in chdir'
from /opt/homebrew/Library/Homebrew/download_strategy.rb:118:in chdir' from /opt/homebrew/Library/Homebrew/download_strategy.rb:105:in stage'
from /opt/homebrew/Library/Homebrew/resource.rb:124:in block in unpack' from /opt/homebrew/Library/Homebrew/mktemp.rb:75:in block in run'
from /opt/homebrew/Library/Homebrew/mktemp.rb:75:in chdir' from /opt/homebrew/Library/Homebrew/mktemp.rb:75:in run'
from /opt/homebrew/Library/Homebrew/resource.rb:228:in stage_resource' from /opt/homebrew/Library/Homebrew/resource.rb:123:in unpack'
from /opt/homebrew/Library/Homebrew/resource.rb:97:in stage' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/forwardable.rb:230:in stage'
from /opt/homebrew/Library/Homebrew/formula.rb:2887:in stage' from /opt/homebrew/Library/Homebrew/formula.rb:1413:in brew'
from /opt/homebrew/Library/Homebrew/build.rb:133:in block in install' from /opt/homebrew/Library/Homebrew/extend/kernel.rb:499:in with_env'
from /opt/homebrew/Library/Homebrew/build.rb:128:in install' from /opt/homebrew/Library/Homebrew/build.rb:229:in '

@beyondlesliezl
Copy link

I get this error, how I can do for it?
this is error was occurred when I do brew install okular

 Installing okular from kde-mac/kde
==> Patching
==> cmake -G Ninja -B build -S . -D BUILD_QCH=ON -D BUILD_TESTING=ON -D BUILD_TESTS=ON -D BUILD_UNITTESTS=ON -D CMAKE_INSTALL_BUNDLEDIR=/opt/homebrew/Cellar/okular/22.12.1/bin -D KDE_INSTALL_LIBDIR=lib -D KDE_INSTA
==> cmake --build build
Last 15 lines from /Users/zhouliang/Library/Logs/Homebrew/okular/02.cmake:
/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler/pdfsettingswidget.cpp:27:18: warning: 'hasNSSSupport' is deprecated [-Wdeprecated-declarations]
    if (Poppler::hasNSSSupport()) {
                 ^
/opt/homebrew/opt/poppler-qt5/include/poppler/qt5/poppler-form.h:945:6: note: 'hasNSSSupport' has been explicitly marked deprecated here
bool POPPLER_QT5_DEPRECATED POPPLER_QT5_EXPORT hasNSSSupport();
     ^
/opt/homebrew/opt/poppler-qt5/include/poppler/qt5/poppler-export.h:25:50: note: expanded from macro 'POPPLER_QT5_DEPRECATED'
#  define POPPLER_QT5_DEPRECATED __attribute__ ((__deprecated__))
                                                 ^
1 warning and 1 error generated.
[146/448] /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -DHAVE_SPEECH -DKCOREADDONS_LIB -DKF_DEPRECATED_WARNINGS_SINCE=0x054400 -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x050C00 -DQT_GUI_LIB -DQT_MAC_USE_COCOA -DQT_NETWORK_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_PRINTSUPPORT_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"okular_poppler\" -DWITH_KJS=1 -DWITH_KWALLET=1 -D_DARWIN_C_SOURCE -D_LARGEFILE64_SOURCE -DokularGenerator_poppler_EXPORTS -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/poppler -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/poppler/okularGenerator_poppler_autogen/include -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1 -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/core/synctex -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/core -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler/../.. -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build -I/opt/homebrew/include/phonon4qt5 -I/opt/homebrew/include/phonon4qt5/KDE -isystem /opt/homebrew/include/KF5/KCoreAddons -isystem /opt/homebrew/include/KF5 -iframework /opt/homebrew/opt/qt@5/lib -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers -isystem /opt/homebrew/opt/qt@5/./mkspecs/macx-clang -isystem /opt/homebrew/include/KF5/KXmlGui -isystem /opt/homebrew/opt/qt@5/lib/QtXml.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtWidgets.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtGui.framework/Headers -isystem /opt/homebrew/include/KF5/KConfig -isystem /opt/homebrew/include/KF5/KConfigCore -isystem /opt/homebrew/include/KF5/KConfigWidgets -isystem /opt/homebrew/include/KF5/KWidgetsAddons -isystem /opt/homebrew/include/KF5/KConfigGui -isystem /opt/homebrew/include/KF5/KCodecs -isystem /opt/homebrew/include/KF5/KAuthWidgets -isystem /opt/homebrew/include/KF5/KAuthCore -isystem /opt/homebrew/include/KF5/KAuth -isystem /opt/homebrew/opt/qt@5/lib/QtDBus.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtPrintSupport.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10 -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10/QtCore -isystem /opt/homebrew/include/KF5/KI18n -isystem /opt/homebrew/include/KF5/KCompletion -isystem /opt/homebrew/include/KF5/KIOWidgets -isystem /opt/homebrew/include/KF5/KIOGui -isystem /opt/homebrew/include/KF5/KIOCore -isystem /opt/homebrew/include/KF5/KIO -isystem /opt/homebrew/include/KF5/KService -isystem /opt/homebrew/opt/qt@5/lib/QtNetwork.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtConcurrent.framework/Headers -isystem /opt/homebrew/include/KF5/KWindowSystem -isystem /opt/homebrew/include/KF5/KJobWidgets -isystem /opt/homebrew/include/KF5/Solid -isystem /opt/homebrew/opt/poppler-qt5/include/poppler/qt5 -isystem /opt/homebrew/opt/poppler-qt5/include/poppler -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -fdiagnostics-color=always -O3 -DNDEBUG -std=c++14 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -MD -MT generators/poppler/CMakeFiles/okularGenerator_poppler.dir/annots.cpp.o -MF generators/poppler/CMakeFiles/okularGenerator_poppler.dir/annots.cpp.o.d -o generators/poppler/CMakeFiles/okularGenerator_poppler.dir/annots.cpp.o -c /tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler/annots.cpp
[147/448] /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -DHAVE_SPEECH -DKCOREADDONS_LIB -DKF_DEPRECATED_WARNINGS_SINCE=0x054400 -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x050C00 -DQT_GUI_LIB -DQT_MAC_USE_COCOA -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_PRINTSUPPORT_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"okular_ghostview\" -DWITH_KJS=1 -DWITH_KWALLET=1 -D_DARWIN_C_SOURCE -D_LARGEFILE64_SOURCE -DokularGenerator_ghostview_EXPORTS -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/spectre -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/spectre -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/spectre/okularGenerator_ghostview_autogen/include -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1 -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/core/synctex -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/core -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build -I/opt/homebrew/include/phonon4qt5 -I/opt/homebrew/include/phonon4qt5/KDE -isystem /opt/homebrew/include/KF5/KCoreAddons -isystem /opt/homebrew/include/KF5 -iframework /opt/homebrew/opt/qt@5/lib -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers -isystem /opt/homebrew/opt/qt@5/./mkspecs/macx-clang -isystem /opt/homebrew/include/KF5/KXmlGui -isystem /opt/homebrew/opt/qt@5/lib/QtXml.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtWidgets.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtGui.framework/Headers -isystem /opt/homebrew/include/KF5/KConfig -isystem /opt/homebrew/include/KF5/KConfigCore -isystem /opt/homebrew/include/KF5/KConfigWidgets -isystem /opt/homebrew/include/KF5/KWidgetsAddons -isystem /opt/homebrew/include/KF5/KConfigGui -isystem /opt/homebrew/include/KF5/KCodecs -isystem /opt/homebrew/include/KF5/KAuthWidgets -isystem /opt/homebrew/include/KF5/KAuthCore -isystem /opt/homebrew/include/KF5/KAuth -isystem /opt/homebrew/opt/qt@5/lib/QtDBus.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtPrintSupport.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10 -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10/QtCore -isystem /opt/homebrew/include/KF5/KI18n -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -fdiagnostics-color=always -O3 -DNDEBUG -std=c++14 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -MD -MT generators/spectre/CMakeFiles/okularGenerator_ghostview.dir/generator_ghostview.cpp.o -MF generators/spectre/CMakeFiles/okularGenerator_ghostview.dir/generator_ghostview.cpp.o.d -o generators/spectre/CMakeFiles/okularGenerator_ghostview.dir/generator_ghostview.cpp.o -c /tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/spectre/generator_ghostview.cpp
[148/448] cd /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build && /opt/homebrew/Cellar/cmake/3.27.5/bin/cmake -E cmake_autogen /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/CMakeFiles/okularpart_autogen.dir/AutogenInfo.json Release && /opt/homebrew/Cellar/cmake/3.27.5/bin/cmake -E touch /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/okularpart_autogen/timestamp && /opt/homebrew/Cellar/cmake/3.27.5/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /tmp/okular-20230916-58919-q5381o/okular-22.12.1 /tmp/okular-20230916-58919-q5381o/okular-22.12.1 /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/okularpart_autogen/deps /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/CMakeFiles/d/041f932c41e42bb880b7d3204dfe91f69e5b292f7a9d523b854d083c2c360bf8.d
ninja: build stopped: subcommand failed.


If reporting this issue please do so to (not Homebrew/brew or Homebrew/homebrew-core):
  kde-mac/kde

/opt/homebrew/Library/Homebrew/utils/github/api.rb:352:in `raise_error': Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] (GitHub::API::ValidationFailedError)

@beyondlesliezl
Copy link

I get this error, how I can do for it? this is error was occurred when I do brew install okular

 Installing okular from kde-mac/kde
==> Patching
==> cmake -G Ninja -B build -S . -D BUILD_QCH=ON -D BUILD_TESTING=ON -D BUILD_TESTS=ON -D BUILD_UNITTESTS=ON -D CMAKE_INSTALL_BUNDLEDIR=/opt/homebrew/Cellar/okular/22.12.1/bin -D KDE_INSTALL_LIBDIR=lib -D KDE_INSTA
==> cmake --build build
Last 15 lines from /Users/zhouliang/Library/Logs/Homebrew/okular/02.cmake:
/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler/pdfsettingswidget.cpp:27:18: warning: 'hasNSSSupport' is deprecated [-Wdeprecated-declarations]
    if (Poppler::hasNSSSupport()) {
                 ^
/opt/homebrew/opt/poppler-qt5/include/poppler/qt5/poppler-form.h:945:6: note: 'hasNSSSupport' has been explicitly marked deprecated here
bool POPPLER_QT5_DEPRECATED POPPLER_QT5_EXPORT hasNSSSupport();
     ^
/opt/homebrew/opt/poppler-qt5/include/poppler/qt5/poppler-export.h:25:50: note: expanded from macro 'POPPLER_QT5_DEPRECATED'
#  define POPPLER_QT5_DEPRECATED __attribute__ ((__deprecated__))
                                                 ^
1 warning and 1 error generated.
[146/448] /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -DHAVE_SPEECH -DKCOREADDONS_LIB -DKF_DEPRECATED_WARNINGS_SINCE=0x054400 -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x050C00 -DQT_GUI_LIB -DQT_MAC_USE_COCOA -DQT_NETWORK_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_PRINTSUPPORT_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"okular_poppler\" -DWITH_KJS=1 -DWITH_KWALLET=1 -D_DARWIN_C_SOURCE -D_LARGEFILE64_SOURCE -DokularGenerator_poppler_EXPORTS -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/poppler -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/poppler/okularGenerator_poppler_autogen/include -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1 -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/core/synctex -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/core -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler/../.. -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build -I/opt/homebrew/include/phonon4qt5 -I/opt/homebrew/include/phonon4qt5/KDE -isystem /opt/homebrew/include/KF5/KCoreAddons -isystem /opt/homebrew/include/KF5 -iframework /opt/homebrew/opt/qt@5/lib -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers -isystem /opt/homebrew/opt/qt@5/./mkspecs/macx-clang -isystem /opt/homebrew/include/KF5/KXmlGui -isystem /opt/homebrew/opt/qt@5/lib/QtXml.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtWidgets.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtGui.framework/Headers -isystem /opt/homebrew/include/KF5/KConfig -isystem /opt/homebrew/include/KF5/KConfigCore -isystem /opt/homebrew/include/KF5/KConfigWidgets -isystem /opt/homebrew/include/KF5/KWidgetsAddons -isystem /opt/homebrew/include/KF5/KConfigGui -isystem /opt/homebrew/include/KF5/KCodecs -isystem /opt/homebrew/include/KF5/KAuthWidgets -isystem /opt/homebrew/include/KF5/KAuthCore -isystem /opt/homebrew/include/KF5/KAuth -isystem /opt/homebrew/opt/qt@5/lib/QtDBus.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtPrintSupport.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10 -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10/QtCore -isystem /opt/homebrew/include/KF5/KI18n -isystem /opt/homebrew/include/KF5/KCompletion -isystem /opt/homebrew/include/KF5/KIOWidgets -isystem /opt/homebrew/include/KF5/KIOGui -isystem /opt/homebrew/include/KF5/KIOCore -isystem /opt/homebrew/include/KF5/KIO -isystem /opt/homebrew/include/KF5/KService -isystem /opt/homebrew/opt/qt@5/lib/QtNetwork.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtConcurrent.framework/Headers -isystem /opt/homebrew/include/KF5/KWindowSystem -isystem /opt/homebrew/include/KF5/KJobWidgets -isystem /opt/homebrew/include/KF5/Solid -isystem /opt/homebrew/opt/poppler-qt5/include/poppler/qt5 -isystem /opt/homebrew/opt/poppler-qt5/include/poppler -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -fdiagnostics-color=always -O3 -DNDEBUG -std=c++14 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -MD -MT generators/poppler/CMakeFiles/okularGenerator_poppler.dir/annots.cpp.o -MF generators/poppler/CMakeFiles/okularGenerator_poppler.dir/annots.cpp.o.d -o generators/poppler/CMakeFiles/okularGenerator_poppler.dir/annots.cpp.o -c /tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/poppler/annots.cpp
[147/448] /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -DHAVE_SPEECH -DKCOREADDONS_LIB -DKF_DEPRECATED_WARNINGS_SINCE=0x054400 -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x050C00 -DQT_GUI_LIB -DQT_MAC_USE_COCOA -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_PRINTSUPPORT_LIB -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"okular_ghostview\" -DWITH_KJS=1 -DWITH_KWALLET=1 -D_DARWIN_C_SOURCE -D_LARGEFILE64_SOURCE -DokularGenerator_ghostview_EXPORTS -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/spectre -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/spectre -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/generators/spectre/okularGenerator_ghostview_autogen/include -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1 -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/core/synctex -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/core -I/tmp/okular-20230916-58919-q5381o/okular-22.12.1/build -I/opt/homebrew/include/phonon4qt5 -I/opt/homebrew/include/phonon4qt5/KDE -isystem /opt/homebrew/include/KF5/KCoreAddons -isystem /opt/homebrew/include/KF5 -iframework /opt/homebrew/opt/qt@5/lib -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers -isystem /opt/homebrew/opt/qt@5/./mkspecs/macx-clang -isystem /opt/homebrew/include/KF5/KXmlGui -isystem /opt/homebrew/opt/qt@5/lib/QtXml.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtWidgets.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtGui.framework/Headers -isystem /opt/homebrew/include/KF5/KConfig -isystem /opt/homebrew/include/KF5/KConfigCore -isystem /opt/homebrew/include/KF5/KConfigWidgets -isystem /opt/homebrew/include/KF5/KWidgetsAddons -isystem /opt/homebrew/include/KF5/KConfigGui -isystem /opt/homebrew/include/KF5/KCodecs -isystem /opt/homebrew/include/KF5/KAuthWidgets -isystem /opt/homebrew/include/KF5/KAuthCore -isystem /opt/homebrew/include/KF5/KAuth -isystem /opt/homebrew/opt/qt@5/lib/QtDBus.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtPrintSupport.framework/Headers -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10 -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Versions/5/Headers/5.15.10/QtCore -isystem /opt/homebrew/include/KF5/KI18n -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -fdiagnostics-color=always -O3 -DNDEBUG -std=c++14 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -MD -MT generators/spectre/CMakeFiles/okularGenerator_ghostview.dir/generator_ghostview.cpp.o -MF generators/spectre/CMakeFiles/okularGenerator_ghostview.dir/generator_ghostview.cpp.o.d -o generators/spectre/CMakeFiles/okularGenerator_ghostview.dir/generator_ghostview.cpp.o -c /tmp/okular-20230916-58919-q5381o/okular-22.12.1/generators/spectre/generator_ghostview.cpp
[148/448] cd /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build && /opt/homebrew/Cellar/cmake/3.27.5/bin/cmake -E cmake_autogen /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/CMakeFiles/okularpart_autogen.dir/AutogenInfo.json Release && /opt/homebrew/Cellar/cmake/3.27.5/bin/cmake -E touch /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/okularpart_autogen/timestamp && /opt/homebrew/Cellar/cmake/3.27.5/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /tmp/okular-20230916-58919-q5381o/okular-22.12.1 /tmp/okular-20230916-58919-q5381o/okular-22.12.1 /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/okularpart_autogen/deps /tmp/okular-20230916-58919-q5381o/okular-22.12.1/build/CMakeFiles/d/041f932c41e42bb880b7d3204dfe91f69e5b292f7a9d523b854d083c2c360bf8.d
ninja: build stopped: subcommand failed.


If reporting this issue please do so to (not Homebrew/brew or Homebrew/homebrew-core):
  kde-mac/kde

/opt/homebrew/Library/Homebrew/utils/github/api.rb:352:in `raise_error': Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}] (GitHub::API::ValidationFailedError)

MacBook Pro M1 Pro

@hsedd
Copy link

hsedd commented Oct 17, 2023

It's a pain to fix but I managed to make it work. You have to get the .tar.xz archive containing the source and the CMakeLists.txt (it should be in brew's cache if I remember) Edit the CMakeLists.txt : Change set(CMAKE_CXX_STANDARD 14) ==> set(CMAKE_CXX_STANDARD 17) and set(CMAKE_CXX_EXTENSIONS OFF) ==> set(CMAKE_CXX_EXTENSIONS ON) Once it's done, rearchive this, and get the SHA256 for the .tar.xz archive, and put it as as the hash in the homebrew formula for okular (l.7) Replace the archive in it's original folder. Now it should compile

Thank you. Indeed this can similarly done without re-archiving. Instead, the CMakeLists.txt can be patched by the homebrew installer. Just modify the okular.rb file with brew edit okular: Add below +++ b/CMakeLists.txt the following lines:

@@ -93,9 +93,9 @@ elseif(WIN32)
     set(ENV{QT_PLUGIN_PATH} "$ENV{QT_PLUGIN_PATH};${KDE_INSTALL_FULL_QTPLUGINDIR}")
 endif()
 
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
-set(CMAKE_CXX_EXTENSIONS OFF)
+set(CMAKE_CXX_EXTENSIONS ON)
 
 ecm_setup_version(${PROJECT_VERSION}
                   VARIABLE_PREFIX OKULAR

@hsedd
Copy link

hsedd commented Oct 17, 2023

Let me add that currently, the compilation fails on running qmake. This is related to https://bugreports.qt.io/browse/QTBUG-117225, which is solved by patching the qt5 toolchain file:

  1. download and unzip https://codereview.qt-project.org/changes/qt%2Fqtbase~503172/revisions/3/patch?zip&path=mkspecs%2Ffeatures%2Ftoolchain.prf
  2. This yields the patch file ~/Downloads/cdf64b0.diff
  3. patch toolchain with patch -u -b /opt/homebrew/opt/qt@5/mkspecs/features/toolchain.prf -I ~/Downloads/cdf64b0.diff

@sunflsks
Copy link

sunflsks commented Dec 5, 2023

it looks like brew's been updated to serve qt6 for the qt formula; this is making a bunch of errors pop up. anyone else, or is it just me?

EDIT: i looked further and its the kf5-kwallet package in particular that's causing issues. i'll try to see what specifically is going on

EDIT 2: looks like it was because qca was updated to use qt-6 about 2 days ago. using the formula from before the commit solves the problem

@armanivvv
Copy link

This is the error on QCA-qt5 I am getting.

Last 15 lines from /Users/xxxx/Library/Logs/Homebrew/kf5-kwallet/01.cmake:
  CMake did not find one.

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

    Qca-qt5Config.cmake
    qca-qt5-config.cmake

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


-- Configuring incomplete, errors occurred!

@Jason5Lee
Copy link

using the formula from before the commit solves the problem

Could you provide more detailed instructions on how I can use it?

@makotosakuraijp
Copy link

makotosakuraijp commented Mar 2, 2024

Could you provide more detailed instructions on how I can use it?

I guess that one can introduce QCA before qt6 by the followings:

  1. cd /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/q
    (It depends on your environment.)

  2. git log --oneline qca.rb

  3. We will use 7b85965596e qca: update 2.3.7 bottle.

  4. So, git checkout 7b85965596e qca.rb

  5. brew install qca.rb and it's done.

By the way, kf5-kwallet (or kf5-kconfigwidgets, ki18n, kdoctools and so on) cannot be introduced after the update. They urged to use HEAD repository. I don't know what to do with it. The messages are as follows:

Installing in /opt/homebrew/Cellar/kf5-kconfigwidgets/5.111.0. Run /tmp/kf5-kconfigwidgets-20240301-71318-dufw2s/kconfigwidgets-5.111.0/build/prefix.sh to set the environment for KConfigWidgets.
-- Looking for GLIBC
-- Looking for GLIBC - not found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Performing Test BSYMBOLICFUNCTIONS_AVAILABLE
-- Performing Test BSYMBOLICFUNCTIONS_AVAILABLE - Failed
-- Could not set up the appstream test. appstreamcli is missing.
CMake Warning at CMakeLists.txt:54 (find_package):
By not providing "FindKF5DocTools.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"KF5DocTools", but CMake did not find one.
Could not find a package configuration file provided by "KF5DocTools"
(requested version 5.111.0) with any of the following names:
KF5DocToolsConfig.cmake
kf5doctools-config.cmake
Add the installation prefix of "KF5DocTools" to CMAKE_PREFIX_PATH or set
"KF5DocTools_DIR" to a directory containing one of the above files. If
"KF5DocTools" provides a separate development package or SDK, be sure it
has been installed.
CMake Error at CMakeLists.txt:56 (find_package):
By not providing "FindKF5I18n.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "KF5I18n", but
CMake did not find one.
Could not find a package configuration file provided by "KF5I18n"
(requested version 5.111.0) with any of the following names:
KF5I18nConfig.cmake
kf5i18n-config.cmake
Add the installation prefix of "KF5I18n" to CMAKE_PREFIX_PATH or set
"KF5I18n_DIR" to a directory containing one of the above files. If
"KF5I18n" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
HOMEBREW_VERSION: 4.2.10-75-g99baaf3
ORIGIN: https://github.com/Homebrew/brew
HEAD: 99baaf350d30075480597b901a6c73bad9e56bf4
Last commit: 3 hours ago
Core tap HEAD: b4f3ba0ad644069acb51a7adc02d26fd45e148a7
Core tap last commit: 6 hours ago
Core tap JSON: 01 Mar 08:10 UTC
Core cask tap JSON: 01 Mar 08:11 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.bBk4Fb3U0f/org.xquartz:0
HOMEBREW_EDITOR: /opt/homebrew/bin/gedit
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_BOOTSNAP: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 13.5-arm64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.2
Rosetta 2: false

@aspauldingcode
Copy link

I am getting these issues too.

By not providing "FindKF5I18n.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "KF5I18n", but
CMake did not find one.
Could not find a package configuration file provided by "KF5I18n"
(requested version 5.111.0) with any of the following names:
KF5I18nConfig.cmake
kf5i18n-config.cmake
Add the installation prefix of "KF5I18n" to CMAKE_PREFIX_PATH or set
"KF5I18n_DIR" to a directory containing one of the above files. If
"KF5I18n" provides a separate development package or SDK, be sure it has
been installed.

@Sposito
Copy link

Sposito commented Mar 28, 2024

You guys having trouble tried installing without building? getting the pre built binaries? like in
brew install --cask okular

@makotosakuraijp
Copy link

The cask option didn't work for me.

@aspauldingcode
Copy link

not working for me either.
I did many things to try and work this through. KF5I18n package seems to not be found when trying to install Okular... Like KF5I18n uses KF5, but the KF5I18n package in homebrew actually installs KF6I18n, which is Version 6.0.0 and I have a feeling that makes it harder to find when looking for the dependency while building with homebrew.

@ptoche
Copy link

ptoche commented May 13, 2024

Could not find a package configuration file provided by "KF5I18n"
(requested version 5.111.0) with any of the following names:

KF5I18nConfig.cmake
kf5i18n-config.cmake

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

@allshaks
Copy link

Could not find a package configuration file provided by "KF5I18n" (requested version 5.111.0) with any of the following names:

KF5I18nConfig.cmake
kf5i18n-config.cmake

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

I'm getting this exact same error, including:

Warning: Unable to query GitHub for recent issues on the tap
Validation Failed: [{"message"=>"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}]

@RobertCrummett
Copy link

I have the same error with "KF5I18n". Unable to install at this time.

@ZivaOuPas
Copy link

Exactly the same error:

Could not find a package configuration file provided by "KF5I18n"
(requested version 5.111.0) with any of the following names:

KF5I18nConfig.cmake
kf5i18n-config.cmake

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

-- Configuring incomplete, errors occurred!

@AlexanderPerez23
Copy link

Im having the same issue with KF5I18n, did anyone manage to figure that out?

thanks!

@tarungka
Copy link

+1 on the same error with KF5I18n.

@aspauldingcode
Copy link

I think the only real way I’ve been able to install Okular on Mac was from precompiled binary located at this link:

https://apps.kde.org/okular/

Under “Nightly Installers”

@tarungka
Copy link

Thank you, I did try searching for the precompiled binary, wasn't easy to find, the link works :)

This method works for me, but here was an error "okular" can’t be opened because Apple cannot check it for malicious software. Which I had to override.

@aspauldingcode
Copy link

I’m probably going to make a nix derivation for it sometime.
so I can install on mac too.

@ferdiga
Copy link

ferdiga commented Sep 11, 2024

I’m probably going to make a nix derivation for it sometime. so I can install on mac too.

installs on macbook and works so far

@makotosakuraijp
Copy link

But I cannot print PDF files...

@makotosakuraijp
Copy link

I downgraded followings.

$ brew doctor

Uncommitted files:
M Formula/k/karchive.rb
M Formula/k/kdoctools.rb
M Formula/k/ki18n.rb
M Formula/q/qca.rb
M Formula/t/threadweaver.rb

karchive 5.111.0
kdoctools 5.111.0
ki18n 5.115.0
qca 2.3.7
threadweaver 5.115.0

kf5-kactivities.rb 5.111.0
kf5-kbookmarks.rb 5.102.0
kf5-kconfigwidgets.rb 5.102.0
kf5-khtml.rb 5.102.0
kf5-kio.rb 5.102.0
kf5-knotifications.rb 5.111.0
kf5-kparts.rb 5.102.0
kf5-kwallet.rb 5.102.0
kf5-kxmlgui.rb 5.102.0

Then, I could install okular 23.08.2. But the print preview is too small and I cannot print PDF files...

Is there someone help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment