woelper / oculante

A fast and simple image viewer / editor for many operating systems
https://github.com/woelper/oculante
MIT License
872 stars 41 forks source link

Please remove the dependency on the crate glsl-to-spirv because it is unmaintained and abandoned #221

Open yurivict opened 1 year ago

yurivict commented 1 year ago

See here.

woelper commented 1 year ago

I did a quick check and notan (the engine I am using) has glsl-to-spirv as a dependency, so I can't remove it. I have to wait until that crate updates and removes this dependency as far as I see it.

yurivict commented 1 year ago

https://github.com/Nazariglez/notan/issues/287

Nazariglez commented 1 year ago

Hello! Saw this following the issue on notan. As a possible solution I think we can add to oculante the feature shaderc which enables notan/shaderc. This will disable glsl-to-spriv and use shaderc instead. Just a warning, shaderc takes a while to compile the first time, so it may be good to not set it as the default.

woelper commented 1 year ago

Thank you so much @Nazariglez! I read your comment over at notan and was thinking something similar. I will give it a try! This is "just" compile time and has no impact on runtime performance, right?

Nazariglez commented 1 year ago

That's right, people consuming your app without having to compile it will see no difference.

woelper commented 1 year ago

Thanks!

I've started work on this and enabled shaderc. Getting it to run on CI/CD is a little nightmare though and might take some time (the library is not trivial to build on platforms such as NetBSD and arm)

woelper commented 12 months ago

This proves to be very hard for armv7-unknown-linux-gnueabihf as the build fails in the docker image, claiming that python 2.7 is installed, needing 3.

NetBSD is similar with

thread 'main' panicked at 'Build requires one of `python3` or `python`', 
0323pin commented 11 months ago

@woelper I'm kicking a build from https://github.com/woelper/oculante/commit/291b65502b8d1b337e356c338ff04cf03c66d663 linking against python 3.11 right now, lets see what happens.

0323pin commented 11 months ago

Nah, not a good idea to shift to it ...

error: failed to run custom build command for `shaderc-sys v0.8.2`

Caused by:
  process didn't exit successfully: `/usr/pkgsrc/wip/oculante/work/oculante-291b65502b8d1b337e356c338ff04cf03c66d663/target/release/build/shaderc-sys-fb483146c091bab4/build-script-build` (exit status: 101)
  --- stdout
  cargo:warning=shaderc: searching for native shaderc libraries on system;  use '--features build-from-source' to force building from source code
  cargo:warning=shaderc: cannot find native shaderc library on system; falling back to build from source
  CMAKE_TOOLCHAIN_FILE_x86_64-unknown-netbsd = None
  CMAKE_TOOLCHAIN_FILE_x86_64_unknown_netbsd = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_PREFIX_PATH_x86_64-unknown-netbsd = None
  CMAKE_PREFIX_PATH_x86_64_unknown_netbsd = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-unknown-netbsd = None
  CMAKE_x86_64_unknown_netbsd = None
  HOST_CMAKE = None
  CMAKE = None
  running: cd "/usr/pkgsrc/wip/oculante/work/oculante-291b65502b8d1b337e356c338ff04cf03c66d663/target/release/build/shaderc-sys-67c627d10c5fc8f6/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/usr/pkgsrc/wip/oculante/work/vendor/shaderc-sys-0.8.2/build" "-G" "Ninja" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" "-DENABLE_SPVREMAPPER=OFF" "-DENABLE_GLSLANG_BINARIES=OFF" "-DSHADERC_SKIP_TESTS=ON" "-DSPIRV_SKIP_EXECUTABLES=ON" "-DSPIRV_WERROR=OFF" "-DCMAKE_INSTALL_PREFIX=/usr/pkgsrc/wip/oculante/work/oculante-291b65502b8d1b337e356c338ff04cf03c66d663/target/release/build/shaderc-sys-67c627d10c5fc8f6/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -pipe -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm" "-DCMAKE_C_COMPILER=/usr/pkgsrc/wip/oculante/work/.cwrapper/bin/gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -pipe -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm" "-DCMAKE_CXX_COMPILER=/usr/pkgsrc/wip/oculante/work/.cwrapper/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -pipe -I/usr/pkg/include -I/usr/include -I/usr/X11R7/include -I/usr/pkg/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/harfbuzz -I/usr/X11R7/include/libdrm" "-DCMAKE_ASM_COMPILER=/usr/pkgsrc/wip/oculante/work/.cwrapper/bin/gcc" "-DCMAKE_BUILD_TYPE=Release"
  -- The C compiler identification is GNU 10.5.0
  -- The CXX compiler identification is GNU 10.5.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/pkgsrc/wip/oculante/work/.cwrapper/bin/gcc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/pkgsrc/wip/oculante/work/.cwrapper/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Building SPIRV-Header examples
  -- Installing SPIRV-Header
  -- Configuring incomplete, errors occurred!

  --- stderr
  CMake Deprecation Warning at CMakeLists.txt:6 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  CMake Deprecation Warning at spirv-headers/CMakeLists.txt:31 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  CMake Error at spirv-tools/CMakeLists.txt:67 (message):
    Your platform 'NetBSD' is not supported!

  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /usr/pkgsrc/wip/oculante/work/vendor/cmake-0.1.50/src/lib.rs:1098:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
*** Error code 101

Stop.
woelper commented 3 months ago

This is now configurable behind the shaderc or spirv feature flags.

0323pin commented 3 months ago

@woelper Would you like me to try shaderc on NetBSD once more? I might have some time in the coming days.

woelper commented 3 months ago

If you can, that would be fantastic 😍!

0323pin commented 3 months ago

If you can, that would be fantastic 😍!

Back to you in a few days than 😉

0323pin commented 3 months ago

@woelper I had a look at shaderc and,

shaderc-rs needs the C++ shaderc library. It's shipped inside the Vulkan SDK. You may be able to install it directly on some Linux distro's using the package manager. The C++ shaderc project provides artifacts downloads. You can also build it from source. The order of preference in which the build script attempts to obtain native shaderc can be controlled by several options, which are passed through to shaderc-sys when building shaderc-rs...

This is bad news on NetBSD as nobody has accepted the challenge, in other words, there's no vulkan support.

woelper commented 3 months ago

Thank you for looking at it! I also managed to install it on the more common OSes like Windows and 64 bit linux on CI (sometimes there was even a github action for it!) but the support seems minimal on other distributions / OSes. Maybe we should accept the challenge then? :)

0323pin commented 3 months ago

Maybe we should accept the challenge then? :)

The only problem is ... this is over my skills level. I'm not a programmer, just someone hacking code by similarity. 😞

woelper commented 3 months ago

Ok, I read the information you provided - although it says

This project involves making modifications to the Mesa Vulkan and OpenCL libraries in order to allow them to work on NetBSD (this part requires basic knowledge of the C programming language and Unix APIs), ideally submitting them upstream, until Vulkan and OpenCL support can be built on NetBSD, and then integrating the relevant components into the NetBSD build system using only BSD Make.

This probably also means that you need to have some kind of knowledge of NetBSD, so this does not seem like a super easy task.

0323pin commented 3 months ago

so this does not seem like a super easy task

Correct. There're a few people on NetBSD that could do it but, if they haven't in two years, it won't happen now.

I can internally, though I don't think it will help.

yurivict commented 3 months ago

But what information are you looking for?

oculante fails to compile when Clang is used as a C++ compiler. I am not sure, but NetBSD might use GCC so it isn't relevant to this problem.