Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 669508 - media-libs/osl-1.9.9 and 1.9.11 with media-libs/openexr-2.3.0 - CMake Error at src/cmake/modules/FindOpenEXR.cmake:59 (string): string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to command.
Summary: media-libs/osl-1.9.9 and 1.9.11 with media-libs/openexr-2.3.0 - CMake Error a...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: Adrian
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2018-10-24 15:11 UTC by Helmut Jarausch
Modified: 2019-11-12 02:25 UTC (History)
7 users (show)

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


Attachments
build log (osl-1.9.11.build,5.29 KB, text/plain)
2018-10-24 15:11 UTC, Helmut Jarausch
Details
patch for FindOpenEXR.cmake (osl-openexr.patch,1.31 KB, patch)
2018-10-28 15:00 UTC, Helmut Jarausch
Details | Diff
emerge-info.txt (emerge-info.txt,14.06 KB, text/plain)
2019-05-19 10:19 UTC, Bernd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Jarausch 2018-10-24 15:11:44 UTC
Created attachment 552702 [details]
build log

Building osl (1.9.9 or the recent 1.9.11) fails with openexr-2.3.0 installed with
CMake Error at src/cmake/modules/FindOpenEXR.cmake:59 (string):
  string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  src/cmake/externalpackages.cmake:34 (find_package)
  CMakeLists.txt:123 (include)

What am I missing?
Comment 1 Helmut Jarausch 2018-10-26 13:03:16 UTC
FindOpenEXR.cmake is broken:

# Try to figure out version number
if (EXISTS "${OPENEXR_INCLUDE_PATH}/OpenEXR/ImfMultiPartInputFile.h")
    # Must be at least 2.0
    file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_STRING .*$")
    string (REGEX MATCHALL "[0-9]+[.0-9]+" OPENEXR_VERSION ${TMP})
    file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MAJOR .*$")
    string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MAJOR ${TMP})
    file(STRINGS "${OPENEXR_INCLUDE_PATH}/OpenEXR/OpenEXRConfig.h" TMP REGEX "^#define OPENEXR_VERSION_MINOR .*$")
    string (REGEX MATCHALL "[0-9]+" OPENEXR_VERSION_MINOR ${TMP})

This cannot work with openexr-2.3.0 which installs
/usr/include/OpenEXR/OpenEXRConfig.h

which is only a wrapper - in my case (x86_64) to
/usr/include/x86_64-pc-linux-gnu/OpenEXR/OpenEXRConfig.h

Therefore the 'file' command above finds noting => ${TMP} is empty !
Furthermore 
/usr/include/x86_64-pc-linux-gnu/OpenEXR/OpenEXRConfig.h
doesn't contain #define OPENEXR_VERSION_STRING
but
#define OPENEXR_PACKAGE_STRING "OpenEXR 2.3.0"
Comment 2 Garry R. Osgood 2018-10-28 14:34:44 UTC
Appears related to bug 668444 and bug 668466 logged for media-libs/openimageio-1.8.13 in that both this and openimageio projects appear to use similar (identical? haven't diffed...) FindOpenEXR.cmake files. I used the patch proposed by Attila Toth in bug 668466 comment 14 on this project as well; it successfully patched the FindOpenEXR.cmake file, configuration succeeded and media-libs/osl could be built and installed. The patch (and the circumstances arising from it) prevail when media-libs/openexr-2.3.0 is installed. See Attila Toth's bug 668444 comment 12.
Comment 3 Garry R. Osgood 2018-10-28 14:38:31 UTC
Forgive my typo in Comment 2. Should read: 

> patch proposed by Attila Toth in bug 668444 comment 14.

Apologies.
Comment 4 Helmut Jarausch 2018-10-28 15:00:11 UTC
Created attachment 553504 [details, diff]
patch for FindOpenEXR.cmake
Comment 5 Helmut Jarausch 2018-10-28 15:00:44 UTC
(In reply to Garry R. Osgood from comment #3)
> Forgive my typo in Comment 2. Should read: 
> 
> > patch proposed by Attila Toth in bug 668444 comment 14.
> 
> Apologies.

Many thanks for this hint.
With a tiny modification this works - see my patch.
Comment 6 Bernd 2018-11-03 17:21:52 UTC
That's caused by the multilib wrapped header file.

They were already in the ebuild when I picked them up for finishing them. On x86 arch the files for abi_x86_64 and abi_x86_32 are identical, so the wrapping might not be needed at all. But I don't have any other arch available to test for the wrapping.

@Jonathan: What do you think, whether we need these multilib wrapped header file for openexr?
Comment 7 Marco Ziebell 2019-04-17 19:51:25 UTC
I can confirm this bug and that "patch_for_FindOpenEXR.cmake" is working.

Thank you
Comment 8 Philippe Trottier 2019-05-09 23:55:59 UTC
Confirmed problem and resolution. All was fine before I installed wine and required mutlilib USE flags x86_32

patched the FindOpenEXR.cmake and it worked.

Issue also present 1.8.xx
Comment 9 Bernd 2019-05-19 10:16:43 UTC
Looking for a multilib friendly patch for this, I found it fails to compile against llvm-7 as well:

[ 32%] oslc /var/tmp/portage/media-libs/osl-1.9.9/work/osl-1.9.9_build/src/shaders/MaterialX/mx_blur_color2.osl
cd /var/tmp/portage/media-libs/osl-1.9.9/work/osl-1.9.9_build/src/shaders/MaterialX && python /var/tmp/portage/media-libs/osl-1.9.9/
work/OpenShadingLanguage-Release-1.9.9/src/shaders/MaterialX/build_materialX_osl.py -s mx_blur -t color2 -mx /var/tmp/portage/media-
libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/shaders/MaterialX -o /var/tmp/portage/media-libs/osl-1.9.9/work/osl-1.9.9_
build/src/shaders/MaterialX
cd /var/tmp/portage/media-libs/osl-1.9.9/work/osl-1.9.9_build/src/shaders/MaterialX && /var/tmp/portage/media-libs/osl-1.9.9/work/os
l-1.9.9_build/src/oslc/oslc -q -I/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/shaders/MaterialX 
-I/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/shaders/MaterialX -I/var/tmp/portage/media-libs/o
sl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/shaders -I/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release
-1.9.9/src/shaders /var/tmp/portage/media-libs/osl-1.9.9/work/osl-1.9.9_build/src/shaders/MaterialX/mx_blur_color2.osl -o /var/tmp/p
ortage/media-libs/osl-1.9.9/work/osl-1.9.9_build/src/shaders/MaterialX/mx_blur_color2.oso
/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp: In member function ‘void 
OSL_v1_9::pvt::LLVM_Util::setup_optimization_passes(int)’:
/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp:708:24: error: ‘createInst
ructionCombiningPass’ is not a member of ‘llvm’
         mpm.add (llvm::createInstructionCombiningPass());
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 33%] oslc /var/tmp/portage/media-libs/osl-1.9.9/work/osl-1.9.9_build/src/shaders/MaterialX/mx_blur_color4.osl
/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp:708:24: note: suggested al
ternative: ‘createFunctionInliningPass’
         mpm.add (llvm::createInstructionCombiningPass());
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        createFunctionInliningPass


/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp:726:24: error: ‘createPromoteMemoryToRegisterPass’ is not a member of ‘llvm’
         mpm.add (llvm::createPromoteMemoryToRegisterPass());
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp:726:24: note: suggested alternative: ‘createLowerTypeTestsPass’
         mpm.add (llvm::createPromoteMemoryToRegisterPass());
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        createLowerTypeTestsPass


and

/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp: In member function ‘void OSL_v1_9::pvt::LLVM_Util::write_bitcode_file(const char*, std::__cxx11::string*)’:
/var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp:1684:37: error: invalid initialization of reference of type ‘const llvm::Module&’ from expression of type ‘llvm::Module*’
     llvm::WriteBitcodeToFile (module(), out);
                               ~~~~~~^~
In file included from /var/tmp/portage/media-libs/osl-1.9.9/work/OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp:63:
/usr/lib64/llvm/7/include/llvm/Bitcode/BitcodeWriter.h:129:8: note: in passing argument 1 of ‘void llvm::WriteBitcodeToFile(const llvm::Module&, llvm::raw_ostream&, bool, const llvm::ModuleSummaryIndex*, bool, llvm::ModuleHash*)’
   void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
        ^~~~~~~~~~~~~~~~~~
Comment 10 Bernd 2019-05-19 10:19:26 UTC
Created attachment 577288 [details]
emerge-info.txt

output of emerge --info =media-libs/osl-1.9.9::gentoo-git
Comment 11 Bernd 2019-05-19 10:25:57 UTC
Additionally, version 1.9.9 seems to be outdated. Checking the imageworks github page, I noticed version 1.10.5 has been released earlier this month.
Comment 12 Bernd 2019-05-21 16:42:12 UTC
Looking closer at the released version on https://github.com/imageworks/OpenShadingLanguage/releases?after=Release-1.9.12 they have versions 1.9.11 and 1.9.10, but no 1.9.9.

I would vote for removing this release from the tree.

I was able to compile and install the 1.10.5 version, fixing this issue and I'm going to prepare a PR for it.
Comment 13 Bernd 2019-05-22 05:29:30 UTC
Comment #9 seems to be a duplicate of bug #666698