alerque / aur

Package sources for all the AUR packages I either maintain, co-maintain, or fork.
https://wiki.archlinux.org/index.php/Unofficial_user_repositories#alerque
45 stars 26 forks source link

moonray #52

Closed adro79 closed 1 year ago

adro79 commented 1 year ago

Hi there,

After successfully building USD, now I'm currently trying to build Moonray. These are the changes I made so it can pass the build files.

As usual there's a lot of work to do, I'm thinking of opening an issue in the Moonray's Github so we can progress further.

alerque commented 1 year ago

I just tried to build usd to check this out and ran into trouble with the current PKGBUILD posted on the AUR.

-- Found PySide6 but NOT pyside-uic binary
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find PySide (missing: PYSIDE_AVAILABLE PYSIDEUICBINARY)

Have you been able to build it in a clean chroot?

adro79 commented 1 year ago

I forgot I used pyenv with usd sorry. This binary seems to be missing in the pyside6 arch package.

After this you should be able to build usd

alerque commented 1 year ago

@adro79 It looks like that binary is deprecated and that the USD project knows about it and has a work around in 23.05: https://bugs.archlinux.org/task/78367

Maybe the PKGBUILD needs to backport that or somehow trigger support for the updated usage.

alerque commented 1 year ago

Any progress on getting USD to build in a chroot? I'd love to get this merged and keep moving on...

adro79 commented 1 year ago

Hi @alerque,

Sorry for the delay, I've been busy with work. I managed to build usd in a clean chroot, the uic problem was fixed. There's a new version in the USD AUR package.

I am looking forward to see your moonray package!

alerque commented 1 year ago

I just tried a couple times and USD still doesn't build in a clean chroot. I tried both with my chroot that has my user repo (which will eventually have USD in it so we can build moonray) and also with the generic arch image with just extra enabled (since USD has no AUR dependencies) and the issue is always the same, eventually it dies with a ninja subcommand failed error.

This shouldn't be so inconsistent. I suspect you aren't using a clean chroot. Either you've injected files/dependencies into it or it is old with old GCC versions or something. When was the last time you created it cleanly? Do you have the current devtools package installed? Blow away your chroots directory (/var/lib/archbuild) and use extra-x86_64-build which will recreate it. Do you get the same result?

adro79 commented 1 year ago

That's weird, I tried it in a new VM and it builts. May I see the errors you're getting?

Maybe it's better to lower the CPU cores used when building.

alerque commented 1 year ago

Using a VM is definitely not the same thing as using Arch's chroot based build tools. A base Arch system will have different build flags / user environment stuff setup than the default build tooling.

My builds after about step 1836/4832 start spewing warnings, most of which seem irrelevant. I haven't found the actual relevant error in all the warnings, but the ending point always looks about the same.

Here is a console log from start to finish: build.log.txt

adro79 commented 1 year ago

After looking at your log seems that I forgot to include qt5-base, which contains the /usr/bin/uic file.

I included it in the new version, check it out.

alerque commented 1 year ago

That's better, now it actually builds in a clean chroot with only named dependencies. The successful fully built packages is now hosted in my user repository. That gives us something to work on getting moonray going with, thanks!

BTW to do chroot builds with access to my user repository for dependencies you can:

$ mkarchchroot ~/tmp/path/to/yourchroot/root base-devel

Then edit ~/tmp/path/to/yourchroot/root/etc/pacman.conf and add this after the [extra] repository

[alerque]
Server = https://arch.alerque.com/$arch

Then to build packages against that chroot, cd into where the PKGBUILD file is then use:

$ makechrootpkg -c -u -r ~/tmp/path/to/yourchroot

Since my package signing keys are in Arch systems by default that should be all you need to do.

alerque commented 1 year ago

And now we're on to pxr issues. Well one step forward.

I'm going to go ahead and merge this so people on the AUR can see their is progress and maybe jump in and contribute towards the next problem... the whole thing was pushed prematurely but since it is there might as well get it up to speed with where we are at.

More PRs welcome!

adro79 commented 1 year ago

Several things I encountered when trying to build moonray:

See https://github.com/dreamworksanimation/openmoonray/issues/101 for more info on my journey.

And here's a diff to the first error I encountered:

diff --git a/arras/arras4_core/arras4_log/lib/arras4_log/SyslogLogger.cc b/arras/arras4_core/arras4_log/lib/arras4_log/SyslogLogger.cc
index 3f5a648..8b59e0f 100644
--- a/arras/arras4_core/arras4_log/lib/arras4_log/SyslogLogger.cc
+++ b/arras/arras4_core/arras4_log/lib/arras4_log/SyslogLogger.cc
@@ -33,7 +33,7 @@ static int sPriorities[] = {

 void SyslogLogger::log(Level level, const char *message)
 {
-    syslog(sPriorities[level], message);
+    syslog(sPriorities[level], "%s", message);
 }

 }

Hope it helps, if you know any solution to the cppunit error let me know!

adro79 commented 1 year ago

Hi there,

These days I have been trying to build Moonray, this is the progress I have made:

Based on https://github.com/dreamworksanimation/openmoonray/issues/45, I have edited the code to build in Arch Linux.

Here's the patch : moonray.patch.txt

I have managed to compile 15% of the code, this is where I get stuck:

[ 15%] Building CXX object arras/arras_render/client/CMakeFiles/arras_render.dir/arras_render_autogen/mocs_compilation.cpp.o
In file included from /mnt/ssd/arch/build/arras/arras_render/client/arras_render_autogen/mocs_compilation.cpp:2:
In file included from /mnt/ssd/arch/build/arras/arras_render/client/arras_render_autogen/EWIEGA46WW/moc_ImageView.cpp:10:
In file included from /mnt/ssd/arch/build/arras/arras_render/client/arras_render_autogen/EWIEGA46WW/../../../../../../openmoonray/arras/arras_render/client/ImageView.h:30:
In file included from /mnt/ssd/arch/openmoonray/moonray/scene_rdl2/include/scene_rdl2/scene/rdl2/BinaryWriter.h:10:
In file included from /mnt/ssd/arch/openmoonray/moonray/scene_rdl2/include/scene_rdl2/scene/rdl2/Attribute.h:10:
In file included from /mnt/ssd/arch/openmoonray/moonray/scene_rdl2/include/scene_rdl2/scene/rdl2/Types.h:20:
In file included from /mnt/ssd/arch/openmoonray/moonray/scene_rdl2/include/scene_rdl2/render/util/Alloc.h:5:
In file included from /mnt/ssd/arch/openmoonray/moonray/scene_rdl2/include/scene_rdl2/render/util/Arena.h:14:
In file included from /mnt/ssd/arch/openmoonray/moonray/scene_rdl2/include/scene_rdl2/render/util/SList.h:20:
In file included from /usr/include/tbb/spin_mutex.h:17:
In file included from /usr/include/tbb/../oneapi/tbb/spin_mutex.h:23:
/usr/include/tbb/../oneapi/tbb/profiling.h:229:15: error: expected member name or ';' after declaration specifiers
    void emit() { }
    ~~~~      ^
1 error generated.
make[2]: *** [arras/arras_render/client/CMakeFiles/arras_render.dir/build.make:76: arras/arras_render/client/CMakeFiles/arras_render.dir/arras_render_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:10353: arras/arras_render/client/CMakeFiles/arras_render.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

I also updated your PKGBUILD with the changes I made:

# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: adro79 <adro79@users.noreply.github.com>

_tbbmajorver=2020
_tbbpkgminorver=2

pkgbase=moonray
pkgname=($pkgbase moonray-gui)
_pkgname=openmoonray
pkgver=1.1.0.0
pkgrel=0
pkgdesc='DreamWorks’ production MCRT renderer'
arch=(x86_64)
license=(Apache2)
url="https://$_pkgname.org"
_url="https://github.com/dreamworksanimation"
depends=(curl
         lua53
         python
         clang
         optix)
makedepends=(boost
             cmake
             cppunit
             cuda
             libmicrohttpd
             openimageio
             openssl
             git
             qt5-base
             qt5-script)
optdepends=('usd: hydra plugins and USD geometry objects')
source=("$_pkgname::git+$_url/$_pkgname#tag=v$pkgver"
        "$_pkgname+arras+arras4_core::git+$_url/arras4_core.git#commit=2157c5103156f652b0966f23e32b97597b7ff16f"
        "$_pkgname+arras+arras_render::git+$_url/arras_render.git#commit=729c4039a72e2dacb810c17fd529eaa0308435f6"
        "$_pkgname+arras+distributed+arras4_node::git+$_url/arras4_node.git#commit=b02183bcab92f52d3041c254922c24fe9fc39e54"
        "$_pkgname+arras+distributed+minicoord::git+$_url/minicoord.git#commit=b80aee65186dc36a81c1a682a471456014c6c5ec"
        "$_pkgname+cmake_modules::git+$_url/cmake_modules.git#commit=3ebea9665cadadf67a76387f21c0548dd82d1bac"
        "$_pkgname+moonray+hydra+hdMoonray::git+$_url/hdMoonray.git#commit=8fc04a550a80e819cc17f48dccced7a976ab1ee7"
        "$_pkgname+moonray+hydra+moonray_sdr_plugins::git+$_url/moonray_sdr_plugins.git#commit=01a274e5d14b0b8ba4a6d1b6cfaa5ca538e74938"
        "$_pkgname+moonray+mcrt_denoise::git+$_url/mcrt_denoise.git#commit=710ca0bf75552b2f81e4a79f5ab614173a4c468c"
        "$_pkgname+moonray+moonray::git+$_url/moonray.git#commit=ba155b14779586254212c6973421ac2e7fcb47e9"
        "$_pkgname+moonray+moonray_arras+mcrt_computation::git+$_url/mcrt_computation.git#commit=2e778a66ae685c7df11d61278f6f159cb9efab65"
        "$_pkgname+moonray+moonray_arras+mcrt_dataio::git+$_url/mcrt_dataio.git#commit=6c84f98dc6341d6d414228bc573c8d2b5d745240"
        "$_pkgname+moonray+moonray_arras+mcrt_messages::git+$_url/mcrt_messages.git#commit=3e050e36e3db25433d27d7da75e34c5715e302d6"
        "$_pkgname+moonray+moonray_dcc_plugins::git+$_url/moonray_dcc_plugins.git#commit=ce861215cf2c4fec77c8decdabd96755917ae742"
        "$_pkgname+moonray+moonray_gui::git+$_url/moonray_gui.git#commit=606b411880cecab5a38392ee46a2edad7e652a7f"
        "$_pkgname+moonray+moonshine::git+$_url/moonshine.git#commit=faa2940107c04676d4dd2537a8c60b62a2ec504b"
        "$_pkgname+moonray+moonshine_usd::git+$_url/moonshine_usd.git#commit=efe09ee4b75d678005061d121cf832fc3f2d9a9a"
        "$_pkgname+moonray+render_profile_viewer::git+$_url/render_profile_viewer.git#commit=44bb5d66aa5295cc1176823d04a12cc4cd009e76"
        "$_pkgname+moonray+scene_rdl2::git+$_url/scene_rdl2.git#commit=fb0c969026b1e5a3c16cc75ee3ec9ff7df85ad98"
        "moonray.patch"
        "optix.patch")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')
# git submodule status | cut -c2- | awk '{s=$2; gsub("/", "+", s); gsub(".*/", "", $2); print "\"$_pkgname+" s "::git+$_url/" $2 ".git#commit=" $1 "\"" }'

prepare() {
    cd "$_pkgname"
    git submodule init
    for s in ${source[@]%%::*}; do
        case "$s" in
            $_pkgname+*)
                local module=${s#$_pkgname+}
                local path=${module//+//}
                git config submodule.$path.url "$srcdir/$s"
                ;;
        esac
    done
    git -c protocol.file.allow=always submodule update
#   cp ../CMakePresets.json .

    export CC=clang
    export CXX=clang++

    patch --directory="${srcdir}/openmoonray" --forward --strip=1 --input="${srcdir}/moonray.patch"
    patch --directory="${srcdir}/openmoonray/moonray/mcrt_denoise/lib/denoiser" --forward --strip=1 --input="${srcdir}/optix.patch"

      }

build() {
    cd "${srcdir}"
    mkdir -p build

    CMAKE_PREFIX_PATH=/usr/lib/cmake/OpenImageIO:/opt/optix cmake -S openmoonray -B build

    make -C build
    make install -C build
}

package_moonray() {
    cd "$_pkgname"
}

package_moonray-gui() {
    depends+=($pkgbase
              qt6-base)
    cd "$_pkgname"
}

It's weird but the PKGBUILD gets stuck at 4% when linking arras4test.

I hope this will help you to advance, let me know if you need more help!

alerque commented 1 year ago

Thanks for the progress report. I am neck deep in some other work and can't give this much love, but I'll definitely post this to the AUR to move the ball along for anybody else trying to use it as a starting point.

Wild guess from looking at your PKGBUILD your build percentage issue probably has to do with the fact that you exported the compiler vars to indicate clang in prepare() not build() where they will be needed. I'll correct that when posting.

Please do open new issues or PRs for anything related to this. You can mention this one but following threads in closed PRs is a bit of overhead.

alerque commented 1 year ago

I need the optix.patch file you reference in this PKGBUILD in order to post.

adro79 commented 1 year ago

I need the optix.patch file you reference in this PKGBUILD in order to post.

Yeah sorry, here it is:

diff --git a/OptixDenoiserImpl.cc.orig b/OptixDenoiserImpl.cc
index e9b4302..57f2fba 100644
--- a/OptixDenoiserImpl.cc.orig
+++ b/OptixDenoiserImpl.cc
@@ -107,7 +107,7 @@ OptixDenoiserImpl::OptixDenoiserImpl(int width,
     }

     mDenoiserParams = {};                 // zero initialize
-    mDenoiserParams.denoiseAlpha = 0;     // don't denoise alpha
+    mDenoiserParams.denoiseAlpha = OPTIX_DENOISER_ALPHA_MODE_COPY;     // don't denoise alpha
     mDenoiserParams.hdrIntensity = 0;     // optional average log intensity image of input image, 
                                           //  helps with very dark/bright images
     mDenoiserParams.blendFactor = 0.f;    // show the denoised image only