-
Notifications
You must be signed in to change notification settings - Fork 4
macOS build is broken #60
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
Comments
I'll try to get to this in the next couple of days. Thanks.
Sent with [Proton Mail](https://proton.me/mail/home) secure email.
…On Tuesday, March 25th, 2025 at 6:43 PM, noobie-iv ***@***.***> wrote:
***@***.***(https://github.com/gasparschott)
Build for Mojave is fixed. Need verification for Sequoia: [macos_build](https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental/tree/macos_build) branch.
Qt5:
- Configure:
export CMAKE_PREFIX_PATH
=
\
/
Users
/
user
/
Lib
/
boost
-
1.
87.0
:\
/
Users
/
user
/
Lib
/
eigen
-
3.
4.0
:\
/
Users
/
user
/
Lib
/
libjpeg
-
turbo
-
3.
1.0
:\
/
Users
/
user
/
Lib
/
libtiff
-
4.
7.0
:\
/
Users
/
user
/
Lib
/
Qt
-
5.
12.12
cmake\
-
S .
/
src\
-
B .
/
build\
-
G Ninja\
-
D OpenCL_INCLUDE_DIR
=/
Users
/
user
/
Lib
/
OpenCL
-
2024.
10.24
/
include\
-
D OpenCL_LIBRARY
=/
Users
/
user
/
Lib
/
OpenCL
-
2024.
10.24
/
lib
/
libOpenCL
.dylib
\
-
D ENABLE_OPENCL
=
ON\
-
D ENABLE_OPENGL
=
ON\
-
D ST_USE_QT6
=
OFF\
-
D ST_NO_TESTS
=
OFF
- Build
cmake\
--build
.
/
build\
--parallel
- Install
cmake\
--install
.
/
build\
--prefix
=
$(pwd)
/
install
- Pack
cpack\
-
B .
/
pkg\
--config
.
/
build
/
CPackConfig
.cmake
Qt6:
- Configure:
/Users/user/Lib/boost-1.87.0:\
/Users/user/Lib/eigen-3.4.0:\
/Users/user/Lib/libjpeg-turbo-3.1.0:\
/Users/user/Lib/libtiff-4.7.0:\
/Users/user/Lib/Qt-6.3.2
cmake\
-S ./src\
-B ./build\
-G Ninja\
-D OpenCL_INCLUDE_DIR=/Users/user/Lib/OpenCL-2024.10.24/include\
-D OpenCL_LIBRARY=/Users/user/Lib/OpenCL-2024.10.24/lib/libOpenCL.dylib\
-D ENABLE_OPENCL=ON\
-D ENABLE_OPENGL=ON\
-D ST_USE_QT6=ON\
-D ST_NO_TESTS=OFF
- Build
cmake\
--build
.
/
build\
--parallel
- Install
cmake\
--install
.
/
build\
--prefix
=
$(pwd)
/
install
- Pack
cpack\
-
B .
/
pkg\
--config
.
/
build
/
CPackConfig
.cmake
I can't check on a virtual machine if OpenCL works:
[OpenCL.png (view on web)](https://github.com/user-attachments/assets/1b59a017-5098-42aa-9d17-4dc0c4d92d0c)
—
Reply to this email directly, [view it on GitHub](#60), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AF2ESZA6R5ISZN5BTCPKBND2WIA23AVCNFSM6AAAAABZZB5CVSVHI2DSMVQWIX3LMV43ASLTON2WKOZSHE2DQMJXGEYTIMI).
You are receiving this because you were mentioned.Message ID: ***@***.***>
[noobie-iv]noobie-iv created an issue [(ImageProcessing-ElectronicPublications/scantailor-experimental#60)](#60)
***@***.***(https://github.com/gasparschott)
Build for Mojave is fixed. Need verification for Sequoia: [macos_build](https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental/tree/macos_build) branch.
Qt5:
- Configure:
export CMAKE_PREFIX_PATH
=
\
/
Users
/
user
/
Lib
/
boost
-
1.
87.0
:\
/
Users
/
user
/
Lib
/
eigen
-
3.
4.0
:\
/
Users
/
user
/
Lib
/
libjpeg
-
turbo
-
3.
1.0
:\
/
Users
/
user
/
Lib
/
libtiff
-
4.
7.0
:\
/
Users
/
user
/
Lib
/
Qt
-
5.
12.12
cmake\
-
S .
/
src\
-
B .
/
build\
-
G Ninja\
-
D OpenCL_INCLUDE_DIR
=/
Users
/
user
/
Lib
/
OpenCL
-
2024.
10.24
/
include\
-
D OpenCL_LIBRARY
=/
Users
/
user
/
Lib
/
OpenCL
-
2024.
10.24
/
lib
/
libOpenCL
.dylib
\
-
D ENABLE_OPENCL
=
ON\
-
D ENABLE_OPENGL
=
ON\
-
D ST_USE_QT6
=
OFF\
-
D ST_NO_TESTS
=
OFF
- Build
cmake\
--build
.
/
build\
--parallel
- Install
cmake\
--install
.
/
build\
--prefix
=
$(pwd)
/
install
- Pack
cpack\
-
B .
/
pkg\
--config
.
/
build
/
CPackConfig
.cmake
Qt6:
- Configure:
/Users/user/Lib/boost-1.87.0:\
/Users/user/Lib/eigen-3.4.0:\
/Users/user/Lib/libjpeg-turbo-3.1.0:\
/Users/user/Lib/libtiff-4.7.0:\
/Users/user/Lib/Qt-6.3.2
cmake\
-S ./src\
-B ./build\
-G Ninja\
-D OpenCL_INCLUDE_DIR=/Users/user/Lib/OpenCL-2024.10.24/include\
-D OpenCL_LIBRARY=/Users/user/Lib/OpenCL-2024.10.24/lib/libOpenCL.dylib\
-D ENABLE_OPENCL=ON\
-D ENABLE_OPENGL=ON\
-D ST_USE_QT6=ON\
-D ST_NO_TESTS=OFF
- Build
cmake\
--build
.
/
build\
--parallel
- Install
cmake\
--install
.
/
build\
--prefix
=
$(pwd)
/
install
- Pack
cpack\
-
B .
/
pkg\
--config
.
/
build
/
CPackConfig
.cmake
I can't check on a virtual machine if OpenCL works:
[OpenCL.png (view on web)](https://github.com/user-attachments/assets/1b59a017-5098-42aa-9d17-4dc0c4d92d0c)
—
Reply to this email directly, [view it on GitHub](#60), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AF2ESZA6R5ISZN5BTCPKBND2WIA23AVCNFSM6AAAAABZZB5CVSVHI2DSMVQWIX3LMV43ASLTON2WKOZSHE2DQMJXGEYTIMI).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
How can I build the latest version for MacOS? I'm running Sequoia 15.3.2. Are there build instructions for building the main branch? After installing the required dependencies, I ran the following commands in the
And then
But got the following error during the build phase: Build failure log
|
Try to add the path to OpenCL at configuration stage explicitly:
Xcode contains its own OpenCL framework, but outdated and incomplete. But for some reason cmake finds and uses it, if you don’t specify other paths during configuration. I don't know where homebrew keeps it, because only old macOS versions run on a virtual computer, and nomebrew does not support them. I compiled all the libraries manually, so replace the question marks with the correct path. |
Okay @noobie-iv (maybe @gasparschott for the future). Here are all the steps I took to get the installation to work with Qt 6. I'm using 0. Install prerequisites (one-time)brew install cmake ninja boost eigen libjpeg-turbo libtiff qt \
opencl-headers opencl-clhpp-headers opencl-icd-loader 1. Get the macOS-fixes branchgit clone --branch macos_build \
https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental.git
cd scantailor-experimental 2. Configure the buildrm -rf build # clean slate
set BREW /opt/homebrew/opt
cmake -S . -B build -G Ninja \
-D ST_USE_QT6=ON \
-D ENABLE_OPENCL=ON -D ENABLE_OPENGL=ON \
-D OpenCL_LIBRARY="$BREW/opencl-icd-loader/lib/libOpenCL.dylib" \
-D CMAKE_PREFIX_PATH="$BREW/qt;$BREW/boost;$BREW/eigen;$BREW/libjpeg-turbo;$BREW/libtiff" \
-D CMAKE_CXX_FLAGS="-isystem $BREW/opencl-headers/include -isystem $BREW/opencl-clhpp-headers/include" \
-D CMAKE_C_FLAGS="-isystem $BREW/opencl-headers/include" This adds both keg-only OpenCL header directories so every source sees 3. Compilecmake --build build --parallel 4. Fix Homebrew’s Qt plugin layout (one-time)set QT_PREFIX (brew --prefix qt) # /opt/homebrew/opt/qt
rm -rf $QT_PREFIX/plugins # remove any partial attempts
ln -sfn $QT_PREFIX/share/qt/plugins $QT_PREFIX/plugins For some reason I kept getting the following error, and the above lines fixed it:
5. Add Linux-style alias for the OpenCL pluginNot sure if you need this, but saw it somewhere as to be included ln -sfn build/src/acceleration/opencl/libopencl_plugin.dylib \
build/src/acceleration/opencl/libopencl_plugin.so 6. And last, stage the app bundle:cmake --install build --prefix (pwd)/install The resulting file is in |
Maybe the plugin libopencl_plugin.so can't load the libOpenCL.dylib library. We should try to copy it to scantailor-experimental.app/Contents/Frameworks. In my system the link from the plugin looks like this: @rpath/libOpenCL.1.dylib, so the path must be: scantailor-experimental.app/Contents/Frameworks/libOpenCL.1.dylib |
Hm, okay so I copied it over to the app like so:
Doing a quick test, I see that everything is there:
Relaunching the app, unfortunately the acceleration is still greyed-out. I think it would be worth trying to build all the libraries manually and redo the compilation, but that will take a second. Still, I'm super grateful you're taking the time to make macOS builds even possible. Have you by any chance looked at Github-hosted runners? It seems like they provide apple-silicon macos machines for which you can write actions to compile binaries. |
If I launch ST from terminal and go to settings, an error message appears in the terminal: OpenCL error: clGetPlatformIDs But if the OpenCL library is not available (not copied to Frameworks folder, and the original folder /Users/user/Lib/OpenCL-2024.10.24/lib/ is renamed, so that the library is definitely not detected), then the error message changes: OpenCL plugin failed to load: Library not loaded: @rpath/libOpenCL.1.dylib This means that the plugin finds the library in the Frameworks folder. But I can't fix broken OpenCL from under a virtual machine. Apparently, only a macOS programmer can fix it. All I can do is merge the branch to build the program without OpenCL. |
@noobie-iv , объединяй. Близится релиз 1.2025.05.05. Не стоит тянуть как с предыдущим. PS: Обрати внимание на порог N.I.C.K. Его реализация практически идентична Niblack, только зазор между "средним" и "пороговой картой" определяется не стандартным отклонением, а круговой составляющей из стандартного отклонения и среднего ( PS2: Либо можешь вообще в |
Date: Wed Apr 30 21:44:02 2025 +1000: 84d80e2 by @noobie-iv . PS: А +10 - это Владивосток? Круто. 👍 |
@zvezdochiot @noobie-iv as I understand you've merged this branch. I am happy to keep testing what needs to be tested, and in the meantime try to create some sort of build system for macOS. I already have a Once again, thank you guys for the amazing work on this project so far! |
@noobie-iv I was able to fix the issue! ![]() Looks like the root issue is that the pure Khronos loader is just a stub with no real drivers, so The current cmakelists treats OpenCL as a regular
But ideally, we hook it into
|
I feel like this is wrong, but I can't prove it 😄. It's strange that you need to connect some headers and use others. Also cmake sees that it linked with the framework, it is strange to add this to the command line parameters manually. It seems that in macos the headers are simply not installed, but everything else is. So, it is enough to specify the path to the headers (OpenCL_INCLUDE_DIR): export CMAKE_PREFIX_PATH=\
/Users/user/Lib/boost-1.87.0:\
/Users/user/Lib/eigen-3.4.0:\
/Users/user/Lib/libjpeg-turbo-3.1.0:\
/Users/user/Lib/libtiff-4.7.0:\
/Users/user/Lib/Qt-5.12.12
# Configure
cmake\
-S ./src\
-B ./build\
-G Ninja\
-D CPACK_GENETATOR=DragNDrop\
-D OpenCL_INCLUDE_DIR:PATH=/Users/user/Lib/OpenCL-2024.10.24/include\
-D ST_USE_QT6=ON\
-D ENABLE_OPENCL:BOOL=ON\
-D ENABLE_OPENGL:BOOL=ON\
-D ST_USE_QT6:BOOL=OFF\
-D ST_NO_TESTS=OFF
# Build
cmake\
--build ./build\
--parallel
# Install
cmake\
--install ./build\
--prefix=$(pwd)/install
# Pack
cpack\
-B ./pkg\
--config ./build/CPackConfig.cmake VitrtualBox OpenCL: Super Quick Exit with OpenCL 😄: |
@noobie-iv is there anything else left to do from my end? дай знать если я могу с чем нибудь помочь |
If OpenCL works, all that's left is to build the release (on the virtual machine OpenCL crashes and I can't test if it works on real hardware). Ideally, the installer still needs to be cleaned. Now it includes extra headers: scantailor-experimental.app/Contents/Frameworks/QtCore.framework/Headers/*.h
scantailor-experimental.app/Contents/Frameworks/QtGui.framework/Headers/*.h
... It's because of the line (in CMakeLists.txt): INSTALL(RUNTIME_DEPENDENCY_SET runtime ... Because of this, the installer is overweight. We need to leave dylib's only and delete headers. But without this line, you will have to search and copy all the files manually (this is how the Windows build is currently designed). I'm not a macos programmer and I have no idea how to fix this. For example, I don't know where the original files might be located when copying manually. It was just the first solution I found on Google. P.S. |
@gasparschott
Build for Mojave is fixed. Need verification for Sequoia: macos_build branch.
Qt5:
Qt6:
I can't check on a virtual machine if OpenCL works:
The text was updated successfully, but these errors were encountered: