macOS - Makefile generation error on master


Patrick Hodoul
 
Edited

Hi,

I'm a newcomer to the project and for the first time, I tried to compile OSL on macOS. My current configuration is:
  • OpenEXR -> 3.0.3
  • OpenImageIO -> 2.2.14.0_3
  • Imath -> 3.0.3
  • Apple Clang 12.0.0
  • ninja 1.10.1
  • cmake 3.20.1
I did the usual steps:
  1. git clone https://github.com/AcademySoftwareFoundation/OpenShadingLanguage.git osl_1
  2. cd osl_1
  3. mkdir build
  4. cd build
  5. cmake -GNinja -DCMAKE_CXX_STANDARD=14 ../.

As you can notice there is nothing fancy. But the makefile generation fails:

-- Found Boost 107600 

-- Found ZLIB 1.2.11 

-- Found OpenEXR 3.0.3 

CMake Warning at src/cmake/checked_find_package.cmake:89 (find_package):

  Found package configuration file:

 

    /usr/local/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake

 

  but it set OpenImageIO_FOUND to FALSE so package "OpenImageIO" is

  considered to be NOT FOUND.  Reason given by package:

 

  OpenImageIO could not be found because dependency Imath could not be found.

 

Call Stack (most recent call first):

  src/cmake/externalpackages.cmake:114 (checked_find_package)

  CMakeLists.txt:142 (include)

 

-- OpenImageIO library not found 

--     Try setting OpenImageIO_ROOT ? 

--     Maybe this will help:  src/build-scripts/build_OpenImageIO.bash 

CMake Error at src/cmake/checked_find_package.cmake:148 (message):

  OpenImageIO is required, aborting.

Call Stack (most recent call first):

  src/cmake/externalpackages.cmake:114 (checked_find_package)

  CMakeLists.txt:142 (include)

-- Configuring incomplete, errors occurred!


Any ideas?


Roman Zulak
 

As you can see in the log, OpenImageIO is missing, but it's a required dependency:


On Thu, May 27, 2021 at 10:33 PM Patrick Hodoul <patrick.hodoul@...> wrote:

[Edited Message Follows]

Hi,

I'm a newcomer to the project and for the first time, I tried to compile OSL on macOS. My current configuration is:
  • OpenEXR -> 3.0.3
  • OpenImageIO -> 2.2.14.0_3
  • Imath -> 3.0.3
  • Apple Clang 12.0.0
  • ninja 1.10.1
  • cmake 3.20.1
I did the usual steps:
  1. git clone https://github.com/AcademySoftwareFoundation/OpenShadingLanguage.git osl_1
  2. cd osl_1
  3. mkdir build
  4. cd build
  5. cmake -GNinja -DCMAKE_CXX_STANDARD=14 ../.

As you can notice there is nothing fancy. But the makefile generation fails:

-- Found Boost 107600 

-- Found ZLIB 1.2.11 

-- Found OpenEXR 3.0.3 

CMake Warning at src/cmake/checked_find_package.cmake:89 (find_package):

  Found package configuration file:

 

    /usr/local/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake

 

  but it set OpenImageIO_FOUND to FALSE so package "OpenImageIO" is

  considered to be NOT FOUND.  Reason given by package:

 

  OpenImageIO could not be found because dependency Imath could not be found.

 

Call Stack (most recent call first):

  src/cmake/externalpackages.cmake:114 (checked_find_package)

  CMakeLists.txt:142 (include)

 

-- OpenImageIO library not found 

--     Try setting OpenImageIO_ROOT ? 

--     Maybe this will help:  src/build-scripts/build_OpenImageIO.bash 

CMake Error at src/cmake/checked_find_package.cmake:148 (message):

  OpenImageIO is required, aborting.

Call Stack (most recent call first):

  src/cmake/externalpackages.cmake:114 (checked_find_package)

  CMakeLists.txt:142 (include)

-- Configuring incomplete, errors occurred!


Any ideas?


Patrick Hodoul
 

The problem is that OpenImageIO is found as expected but disabled because Imath is not found. But the Imath library is installed.


Below is the interesting part of the failure:

CMake Warning at src/cmake/checked_find_package.cmake:89 (find_package):

  Found package configuration file:

 

    /usr/local/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake

 

  but it set OpenImageIO_FOUND to FALSE so package "OpenImageIO" is

  considered to be NOT FOUND.  Reason given by package:

 

  OpenImageIO could not be found because dependency Imath could not be found.


Larry Gritz
 

Is this another case of needing

brew unlink ilmbase
brew link imath

???


On May 27, 2021, at 7:53 PM, Patrick Hodoul <patrick.hodoul@...> wrote:

The problem is that OpenImageIO is found as expected but disabled because Imath is not found. But the Imath library is installed.


Below is the interesting part of the failure:

CMake Warning at src/cmake/checked_find_package.cmake:89 (find_package):

  Found package configuration file:

 

    /usr/local/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake

 

  but it set OpenImageIO_FOUND to FALSE so package "OpenImageIO" is

  considered to be NOT FOUND.  Reason given by package:

 

  OpenImageIO could not be found because dependency Imath could not be found.


--
Larry Gritz





Patrick Hodoul
 
Edited

Nope. 

I also tried -DImath_DIR & -DImath_ROOT without success.


Patrick Hodoul
 

I found something.

brew install imath version 3.0.3, and OpenImageIO version 2.2.14.0_3 looks for Imath 3.0.3 so, everything seems fine.

If I change the OSL file ./src/cmake/externalpackages.cmake to add an explicit request to find Imath version 3.0, the library found is Imath version 3.0.2 !!
And OpenImageIO is only looking for Imath 3.0.3 (Refer to "/usr/local/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake").

The Imath version is 3.0.3 but the Imath file "/usr/local/Cellar/imath/3.0.3/include/Imath/ImathConfig.h" indicates version 3.0.2 !! 


Patrick Hodoul
 

The workaround is:
  1. chmod +w /usr/local/Cellar/openimageio/2.2.14.0_3/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake
  2. vi /usr/local/Cellar/openimageio/2.2.14.0_3/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake +31
  3. change 3.0.3 by 3.0

That's definitively not an OSL problem. There is a mismatch with the Imath version.


Patrick Hodoul
 
Edited

Now I can compile and run the unit tests but four of them are failing. Any suggestions?


~/dev/osl_1/build_rls (master) $ ctest --rerun-failed --output-on-failure
Test project /Users/hodoulp/dev/osl_1/build_rls
    Start  68: example-deformer
1/4 Test  #68: example-deformer .................***Failed    0.33 sec
CMake Error at CMakeLists.txt:27 (find_package):
  By not providing "FindOSL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OSL", but
  CMake did not find one.
 
  Could not find a package configuration file provided by "OSL" with any of
  the following names:
 
    OSLConfig.cmake
    osl-config.cmake
 
  Add the installation prefix of "OSL" to CMAKE_PREFIX_PATH or set "OSL_DIR"
  to a directory containing one of the above files.  If "OSL" provides a
  separate development package or SDK, be sure it has been installed.
 
 
test source dir =  /Users/hodoulp/dev/osl_1/testsuite/example-deformer
command =  /Users/hodoulp/dev/osl_1/build_rls/bin/oslc -Wall getP.osl >> out.txt 2>>out.txt  ;
/Users/hodoulp/dev/osl_1/build_rls/bin/oslc -Wall vadd.osl >> out.txt 2>>out.txt  ;
/Users/hodoulp/dev/osl_1/build_rls/bin/oslc -Wall vfBm3d.osl >> out.txt 2>>out.txt  ;
cmake -DCMAKE_BUILD_TYPE=Release data >> build.txt ;
cmake --build . >> build.txt ;
bin/osldeformer >> out.txt >> out.txt 2>>out.txt  ;
 
#### Error: this command failed:  cmake -DCMAKE_BUILD_TYPE=Release data >> build.txt
FAIL
Output was:
--------
Compiled getP.osl -> getP.oso
Compiled vadd.osl -> vadd.oso
Compiled vfBm3d.osl -> vfBm3d.oso
 
--------
 
    Start 219: osl-imageio
2/4 Test #219: osl-imageio ......................***Failed    0.18 sec
test source dir =  /Users/hodoulp/dev/osl_1/testsuite/osl-imageio
command =  /Users/hodoulp/dev/osl_1/build_rls/bin/oslc -Wall ramp.osl >> out.txt 2>>out.txt  ;
oiiotool "ramp.oso?RES=64" -d uint8 -o ramp-oso-default.tif >> out.txt 2>>out.txt  ;
oiiotool "ramp.oso?RES=64&color topright=0,0,1" -d uint8 -o ramp-oso-blue.tif >> out.txt 2>>out.txt  ;
oiiotool "ramp.oso?RES=64&color bottomright=0,1,1&TILE=32x32" -d uint8 -o ramp-oso-tiles.tif >> out.txt 2>>out.txt  ;
oiiotool "result=sin(40*s)/2+0.5.oslbody?RES=256x256&MIP=1" -selectmip 2 -d uint8 -o wave-mip.tif >> out.txt 2>>out.txt  ;
 
#### Error: this command failed:  oiiotool "ramp.oso?RES=64" -d uint8 -o ramp-oso-default.tif >> out.txt 2>>out.txt
FAIL
Output was:
--------
Compiled ramp.osl -> ramp.oso
oiiotool ERROR: read : File does not exist: "ramp.oso?RES=64"
Full command line was:
> oiiotool ramp.oso?RES=64 -d uint8 -o ramp-oso-default.tif
 
--------
 
    Start 220: osl-imageio.opt
3/4 Test #220: osl-imageio.opt ..................***Failed    0.18 sec
test source dir =  /Users/hodoulp/dev/osl_1/testsuite/osl-imageio
command =  /Users/hodoulp/dev/osl_1/build_rls/bin/oslc -Wall ramp.osl >> out.txt 2>>out.txt  ;
oiiotool "ramp.oso?RES=64" -d uint8 -o ramp-oso-default.tif >> out.txt 2>>out.txt  ;
oiiotool "ramp.oso?RES=64&color topright=0,0,1" -d uint8 -o ramp-oso-blue.tif >> out.txt 2>>out.txt  ;
oiiotool "ramp.oso?RES=64&color bottomright=0,1,1&TILE=32x32" -d uint8 -o ramp-oso-tiles.tif >> out.txt 2>>out.txt  ;
oiiotool "result=sin(40*s)/2+0.5.oslbody?RES=256x256&MIP=1" -selectmip 2 -d uint8 -o wave-mip.tif >> out.txt 2>>out.txt  ;
 
#### Error: this command failed:  oiiotool "ramp.oso?RES=64" -d uint8 -o ramp-oso-default.tif >> out.txt 2>>out.txt
FAIL
Output was:
--------
Compiled ramp.osl -> ramp.oso
oiiotool ERROR: read : File does not exist: "ramp.oso?RES=64"
Full command line was:
> oiiotool ramp.oso?RES=64 -d uint8 -o ramp-oso-default.tif
 
--------
 
    Start 357: python-oslquery
4/4 Test #357: python-oslquery ..................***Failed    0.16 sec
Traceback (most recent call last):
  File "src/test_oslquery.py", line 11, in <module>
    import oslquery
ImportError: No module named oslquery
test source dir =  /Users/hodoulp/dev/osl_1/testsuite/python-oslquery
command =  /Users/hodoulp/dev/osl_1/build_rls/bin/oslc -Wall test.osl >> out.txt 2>>out.txt  ;
python src/test_oslquery.py >> out.txt
#### Error: this command failed:  python src/test_oslquery.py >> out.txt
FAIL
Output was:
--------
Compiled test.osl -> test.oso
 
--------
 
 
0% tests passed, 4 tests failed out of 4
 
Total Test time (real) =   0.89 sec
 
The following tests FAILED:
68 - example-deformer (Failed)
219 - osl-imageio (Failed)
220 - osl-imageio.opt (Failed)
357 - python-oslquery (Failed)
Errors while running CTest


Larry Gritz
 

Aha, yes, I know this combination of bugs!

Bug #1: Imath 3.0.3 was the same as 3.0.2 -- just retagged to keep its version in sync with openexr, which really did have a change necessitating a 3.0.3. We tagged, but we forgot to bump the version, so the ImathConfigVersion.cmake exported by it still said it was 3.0.2.

Bug #2: OpenImageIO's exported OpenImageIOTargets.cmake, in doing the find_dependency() call for Imath, accidentally expanded @OpenEXR_VERSION@ instead of @Imath_VERSION@ -- which until that point, in my testing were always identical, so I didn't notice.

Consequence: Something downstream, like OSL, that consumes OIIO's exported cmake configs, would see a requirement for Imath 3.0.3 (the exr version) even though the Imath itself declared itself to be 3.0.2, and thus would reject it as "too old a version."

Oops.


It was backported to RB-2.2, but since I hadn't heard anybody else report this problem, I did not push out an emergency release. It would ordinarily be scheduled for the monthly patch release on Jun 1.

You can build OIIO master or RB-2.2 from source if you want, or if you need me to, I canl push out an emergency 2.2.14.1 that contains only this fix, if you can't wait until Jun 1.


On May 28, 2021, at 5:44 AM, Patrick Hodoul <patrick.hodoul@...> wrote:

I found something.

brew install imath version 3.0.3, and OpenImageIO version 2.2.14.0_3 looks for Imath 3.0.3 so, everything seems fine.

If I change the OSL file ./src/cmake/externalpackages.cmake to add an explicit request to find Imath version 3.0, the library found is Imath version 3.0.2 !!
And OpenImageIO is only looking for Imath 3.0.3 (Refer to "/usr/local/lib/cmake/OpenImageIO/OpenImageIOConfig.cmake").

The Imath version is 3.0.3 but the Imath file "/usr/local/Cellar/imath/3.0.3/include/Imath/ImathConfig.h" indicates version 3.0.2 !! 

--
Larry Gritz





Patrick Hodoul
 

I can push out an emergency 2.2.14.1 that contains only this fix, if you can't wait until Jun 1.
Now that I found a workaround, I can wait for 2.2.14.1

Patrick