Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 751580 - media-libs/osl-1.10.13 version bump
Summary: media-libs/osl-1.10.13 version bump
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Adrian
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-10-28 11:35 UTC by Helmut Jarausch
Modified: 2020-12-01 11:24 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
diff media-libs/osl/osl-1.10.10.ebuild osl-1.10.13.ebuild (osl-1.10.10-to-1.10.13.diff,459 bytes, patch)
2020-11-18 23:59 UTC, mehw
Details | Diff
media-libs/osl-1.10.13.ebuild (version bump) (osl-1.10.13.ebuild,1.93 KB, text/plain)
2020-11-19 00:00 UTC, mehw
Details
media-libs/osl/Manifest (with v1.10.13 only) (Manifest,306 bytes, text/plain)
2020-11-19 00:02 UTC, mehw
Details
osl-1.10.13.ebuild (file_751580.txt,2.01 KB, text/plain)
2020-11-19 06:20 UTC, Adrian
Details
simple_shader.osl (file_751580.txt,280 bytes, text/plain)
2020-11-19 06:21 UTC, Adrian
Details
test_osl.blend (test_osl.blend,829.14 KB, application/x-blender)
2020-11-19 06:22 UTC, Adrian
Details
blender-crash.log (file_751580.txt,574 bytes, text/plain)
2020-11-19 08:15 UTC, Adrian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Jarausch 2020-10-28 11:35:21 UTC
media-libs/osl-1.10.10 which is currently in the tree
fails to compile with media-libs/openimageio-2.2.7.0 which is in the tree.

Version 1.10.13 builds just fine (just rename the ebuild)
Comment 1 Adrian 2020-11-16 23:30:46 UTC
This fixes the osl compilation error for me, but I now have an error compiling opencolorio relating to osl functions changing from void to unique ptr. Once I can confirm it is not caused by this version bump, or fix opencolorio, I will submit a PR for this and look into 1.11
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-11-16 23:35:12 UTC
(In reply to Adrian from comment #1)
> This fixes the osl compilation error for me, but I now have an error
> compiling opencolorio relating to osl functions changing from void to unique
> ptr. Once I can confirm it is not caused by this version bump, or fix
> opencolorio, I will submit a PR for this and look into 1.11

I reckon it's bug 754909, can you try the workaround there?
Comment 3 mehw 2020-11-18 23:59:04 UTC
Created attachment 672682 [details, diff]
diff media-libs/osl/osl-1.10.10.ebuild osl-1.10.13.ebuild

media-libs/osl-1.10.13 compiles fine with sys-devel/llvm:10.



Summary of media-libs/osl-1.10.13.ebuild amendments compared to media-libs/os-1.10.10.ebuild (see also the attached diff):

Allow max sys-devel/llvm-10 and add -DCMAKE_CXX_STANDARD=14 (thanks to cyrillic https://bugs.gentoo.org/735750#c2).

Follow the suggestions of Joonas Niilola https://bugs.gentoo.org/747475#c2 and also use -DLLVM_STATIC=OFF rather than -DLLVM_STATIC=ON.



Sidenotes:

With media-libs/osl-1.10.10 and two sys-devel/llvm slots installed at the same time (one was llvm:9, and osl was compiled with a previous slot of llvm), I was getting the following error when starting media-gfx/blender-2.83*[osl]:

 : CommandLine Error: Option 'help-list' registered more than once!
 LLVM ERROR: inconsistency in registered CommandLine options

So, I had to remove the oldest slot of sys-devel/llvm and recompile media-libs/osl-1.10.10 with the newest one to allow blender to start without the above error.
Comment 4 mehw 2020-11-19 00:00:02 UTC
Created attachment 672685 [details]
media-libs/osl-1.10.13.ebuild (version bump)

Version bump.
Comment 5 mehw 2020-11-19 00:02:02 UTC
Created attachment 672688 [details]
media-libs/osl/Manifest (with v1.10.13 only)

Manifest file just for media-libs/osl-1.10.13.
Comment 6 Adrian 2020-11-19 01:21:20 UTC
Thanks Sam, it was indeed bug 754909 and upgrading to opencolorio 1.1.1 fixed it, so the renamed ebuild works.

I will recheck now with the C++14/LLVM10 changes from mewh, and also with 1.11.9 using the ebuild from bug 747475
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-11-19 01:48:10 UTC
(In reply to Adrian from comment #6)
> Thanks Sam, it was indeed bug 754909 and upgrading to opencolorio 1.1.1
> fixed it, so the renamed ebuild works.
> 
> I will recheck now with the C++14/LLVM10 changes from mewh, and also with
> 1.11.9 using the ebuild from bug 747475

Excellent. Can you check if it works with LLVM 11 too, if possible, as that just went stable?
Comment 8 Adrian 2020-11-19 02:00:38 UTC
Osl 1.11 apparently does support LLVM 11 according to upstream, but 1.10.13 only supports LLVM 10 (See https://github.com/imageworks/OpenShadingLanguage/blob/RB-1.10/INSTALL.md)

But does anyone still need 1.10 rather than just upgrade to 1.11? It might be best to submit unstable 1.10.13 with LLVM 10 support as a bug fix for compiling against openimageio-2.2.7+, and deprecate it when we submit and stabilise 1.11.9 with LLVM 11.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-11-19 02:16:42 UTC
(In reply to Adrian from comment #8)
> Osl 1.11 apparently does support LLVM 11 according to upstream, but 1.10.13
> only supports LLVM 10 (See
> https://github.com/imageworks/OpenShadingLanguage/blob/RB-1.10/INSTALL.md)
> 
> But does anyone still need 1.10 rather than just upgrade to 1.11? It might
> be best to submit unstable 1.10.13 with LLVM 10 support as a bug fix for
> compiling against openimageio-2.2.7+, and deprecate it when we submit and
> stabilise 1.11.9 with LLVM 11.

We can add both but that sounds like a plan to me.
Comment 10 Adrian 2020-11-19 06:16:33 UTC
With osl 1.10.13 ebuild above using C++14/LLVM10 blender segfaults when I try to render using osl shaders. If I use the ebuild with C++11/LLVM9 it renders OK.

I will attach the ebuild that works for me, and the blend and osl files for the test case, and the blender crash log if anyone else wants to try it out.

To make it fail:
emerge osl-1.10.13.ebuild above (from mehw)
emerge -1v blender (I am not entirely sure if this is necessary)
save the test_osl.blend and sample_material.osl in the current directory
blender test_osl.blend
Press F12 to render

It should display a uv sphere with a green colour modulated by some random noise, but for me I get a segfault.

To make it work:
emerge osl-1.10.13.ebuild above (from Adrian)
emerge -1v blender (I am not entirely sure if this is necessary)
save the test_osl.blend and sample_material.osl in the current directory
blender test_osl.blend
Press F12 to render

The shader is from the docs at https://docs.blender.org/manual/en/latest/render/shader_nodes/osl.html

I will compile llvm 11 overnight and run the same tests on it tomorrow.
Comment 11 Adrian 2020-11-19 06:20:24 UTC
Created attachment 672706 [details]
osl-1.10.13.ebuild
Comment 12 Adrian 2020-11-19 06:21:05 UTC
Created attachment 672709 [details]
simple_shader.osl
Comment 13 Adrian 2020-11-19 06:22:36 UTC
Created attachment 672712 [details]
test_osl.blend
Comment 14 Adrian 2020-11-19 06:25:53 UTC
I just rechecked the diff betweeen the ebuilds and found that I also have LLVM_STATIC=ON in the working ebuild and OFF in the failing ebuild.
Comment 15 Adrian 2020-11-19 08:15:48 UTC
Created attachment 672727 [details]
blender-crash.log

It is odd, I can no longer reproduce my original error, which was overwritten but was something about a failure in blender's osl.py line 30 where it calls _cycles.osl_compile().

Now when using c++14/llvm10 it renders the image, but after blender is closed gives this backtrace.
Comment 16 Adrian 2020-11-20 05:28:50 UTC
Building osl-1.10.13 with LLVM 11 fails with
/var/tmp/portage/media-libs/osl-1.10.13-r2/work/OpenShadingLanguage-Release-1.10.13/src/liboslexec/llvm_util.cpp:601:43: error: conversion from ‘llvm::StringRef’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
  601 |         std::string symname = sym->getName();
      |                               ~~~~~~~~~~~~^~
/var/tmp/portage/media-libs/osl-1.10.13-r2/work/OpenShadingLanguage-Release-1.10.13/src/liboslexec/llvm_util.cpp: In member function ‘llvm::Value* OSL_v1_10::pvt::LLVM_Util::call_function(llvm::Value*, llvm::Value**, int)’:
/var/tmp/portage/media-libs/osl-1.10.13-r2/work/OpenShadingLanguage-Release-1.10.13/src/liboslexec/llvm_util.cpp:1096:92: error: no matching function for call to ‘OSL_v1_10::pvt::LLVM_Util::IRBuilder::CreateCall(llvm::Value*&, llvm::ArrayRef<llvm::Value*>)’
 1096 |     llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args, nargs));
      |                                                                                            ^
In file included from /var/tmp/portage/media-libs/osl-1.10.13-r2/work/OpenShadingLanguage-Release-1.10.13/src/liboslexec/llvm_util.cpp:49:
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2332:13: note: candidate: ‘llvm::CallInst* llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&, llvm::MDNode*)’
 2332 |   CallInst *CreateCall(FunctionType *FTy, Value *Callee,
      |             ^~~~~~~~~~
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2332:38: note:   no known conversion for argument 1 from ‘llvm::Value*’ to ‘llvm::FunctionType*’
 2332 |   CallInst *CreateCall(FunctionType *FTy, Value *Callee,
      |                        ~~~~~~~~~~~~~~^~~
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2343:13: note: candidate: ‘llvm::CallInst* llvm::IRBuilderBase::CreateCall(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&, llvm::MDNode*)’
 2343 |   CallInst *CreateCall(FunctionType *FTy, Value *Callee, ArrayRef<Value *> Args,
      |             ^~~~~~~~~~
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2343:13: note:   candidate expects 6 arguments, 2 provided
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2354:13: note: candidate: ‘llvm::CallInst* llvm::IRBuilderBase::CreateCall(llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&, llvm::MDNode*)’
 2354 |   CallInst *CreateCall(FunctionCallee Callee, ArrayRef<Value *> Args = None,
      |             ^~~~~~~~~~
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2354:39: note:   no known conversion for argument 1 from ‘llvm::Value*’ to ‘llvm::FunctionCallee’
 2354 |   CallInst *CreateCall(FunctionCallee Callee, ArrayRef<Value *> Args = None,
      |                        ~~~~~~~~~~~~~~~^~~~~~
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2360:13: note: candidate: ‘llvm::CallInst* llvm::IRBuilderBase::CreateCall(llvm::FunctionCallee, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&, llvm::MDNode*)’
 2360 |   CallInst *CreateCall(FunctionCallee Callee, ArrayRef<Value *> Args,
      |             ^~~~~~~~~~
/usr/lib/llvm/11/include/llvm/IR/IRBuilder.h:2360:13: note:   candidate expects 5 arguments, 2 provided
/var/tmp/portage/media-libs/osl-1.10.13-r2/work/OpenShadingLanguage-Release-1.10.13/src/liboslexec/llvm_util.cpp: In member function ‘bool OSL_v1_10::pvt::LLVM_Util::ptx_compile_group(llvm::Module*, const string&, std::string&)’:
/var/tmp/portage/media-libs/osl-1.10.13-r2/work/OpenShadingLanguage-Release-1.10.13/src/liboslexec/llvm_util.cpp:1588:21: error: expected type-specifier
 1588 |     mod_pm.add (new llvm::TargetLibraryInfoWrapperPass (llvm::Triple (target_triple)));
      |                     ^~~

It looks like an api change in the private utility functions between LLVM 10 and 11 to me. I am not going to chase LLVM 11 any further for this ebuild, but will ensure that osl-1.11 supports LLVM 9 to 11.

So the status of LLVM for osl 1.10.13 is
LLVM 9 - works
LLVM 10 - works (but produces segfaults in blender)
LLVM 11 - does not compile

Unless someone specifically needs osl 1.10 with LLVM 10 (please comment), I think it is best to stick to LLVM 9 alone for this ebuild and add LLVM 10 and 11 support for osl-1.11, which I will work on now.
Comment 17 Adrian 2020-11-26 22:43:08 UTC
I fixed the segfault by adding #include "/usr/include/OSL/shaders/stdosl.h"
to the start of my shader. So it appears that osl-1.10.13 works with blender using up to and including LLVM 10.
Comment 18 Larry the Git Cow gentoo-dev 2020-12-01 11:24:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=beb901a124bd4b8b9c85e074ef3f607c81004c55

commit beb901a124bd4b8b9c85e074ef3f607c81004c55
Author:     Adrian Grigo <agrigo2001@yahoo.com.au>
AuthorDate: 2020-11-26 23:09:30 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2020-12-01 11:22:04 +0000

    media-libs/osl: Version bump to 1.10.13
    
    This version works with openimageio 2 (fixes build failure of 1.10.10)
    
    Add support for LLVM 10, which requires C++14
    
    Enable shared libraries
    Add github page as second homepage
    
    Added subslot operator otherwise upgrading to 1.11 will leave behind
    preserved libraries (blender is the only current client in the tree)
    
    Thanks to Mehw, Cyrillic, Peter Karlsson, Reggie, Luke A Guest, and
    Joonas Niilola for their contributions to the bugs mentioned below
    which forms the bulk of this update.
    
    Signed-off-by: Adrian Grigo <agrigo2001@yahoo.com.au>
    Closes: https://bugs.gentoo.org/735750
    Closes: https://bugs.gentoo.org/751580
    Package-Manager: Portage-3.0.9, Repoman-3.0.2
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 media-libs/osl/Manifest           |  1 +
 media-libs/osl/osl-1.10.13.ebuild | 87 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)