Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Half.h stops OpenEXR from compiling #231

Closed
omenos opened this issue May 9, 2017 · 14 comments
Closed

Half.h stops OpenEXR from compiling #231

omenos opened this issue May 9, 2017 · 14 comments

Comments

@omenos
Copy link

omenos commented May 9, 2017

Apologies if this isn't the right place to ask this, I couldn't find info online that made sense. When trying to compile OpenEXR after building IlmBase, I receive the following error:

Scanning dependencies of target b44ExpLogTable
[  1%] Building CXX object IlmImf/CMakeFiles/b44ExpLogTable.dir/b44ExpLogTable.cpp.o
/vol/Work/openexr-2.2.0/OpenEXR/IlmImf/b44ExpLogTable.cpp:52:18: fatal error: half.h: No such file or directory
 #include <half.h>
                  ^
compilation terminated.
make[2]: *** [IlmImf/CMakeFiles/b44ExpLogTable.dir/b44ExpLogTable.cpp.o] Error 1
make[1]: *** [IlmImf/CMakeFiles/b44ExpLogTable.dir/all] Error 2
make: *** [all] Error 2

Steps to reproduce (from extracted 2.2.0 release):

# Build IlmBase
cd IlmBase
mkdir build && cd build
cmake ..
make
sudo make install

# IlmBase builds and install with no issues.

# Build OpenExr
cd OpenEXR
mkdir build && cd build
cmake ..
make         # Error is here

I'm very new to compiling C material and using cmake, but I'm trying to compile OpenEXR for OIIO and OCIO. Wasn't sure if using the 1.7.1 package in the base repos was acceptable for this (CentOS 7.3.1611). The only solutions I can think of are copying the Half/half.f file from IlmBase, missing environment variables (LD_LIBRARY_PATH) or this line:

cmake -DCMAKE_INSTALL_PREFIX=<install location> <source location of IlmBase>
@meshula
Copy link
Contributor

meshula commented May 9, 2017

When building OpenEXR you have to tell it where IlmBase is hiding. Something like the script you can find in usd-build-club should work, if you strip it down to be appropriate to your build environment. Note the ILMBASE_PACKAGE_PREFIX variable...


  cd build/ilmbase

  cmake \
        -DCMAKE_PREFIX_PATH="${LOCAL}" \
        -DCMAKE_INSTALL_PREFIX="${LOCAL}" \
        -DCMAKE_INSTALL_NAME_DIR=@rpath \
        -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
        -DBUILD_WITH_INSTALL_RPATH=1 \
        ${ROOT}/prereq/openexr/IlmBase
  cmake --build . --target install --config Release

  cd ../openexr

  cmake \
        -DCMAKE_PREFIX_PATH="${LOCAL}" \
        -DCMAKE_INSTALL_PREFIX="${LOCAL}" \
        -DCMAKE_INSTALL_NAME_DIR=@rpath \
        -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON \
        -DBUILD_WITH_INSTALL_RPATH=1 \
        -DILMBASE_PACKAGE_PREFIX="${LOCAL}" \
        ${ROOT}/prereq/openexr/OpenEXR
  cmake --build . --target install --config Release

@omenos
Copy link
Author

omenos commented May 22, 2017

Sorry for taking so long to respond, I may have figured out the issue causing me to have to build OpenEXR from source. When I installed IlmBase without any modifications it installed into a couple of different locations (I've attached the output of the install). Would you recommend removing them from my system, or do you see anything potentially breaking if I do? I don't see why it would.

ilmbase.txt

@meshula
Copy link
Contributor

meshula commented May 22, 2017

That all looks good, assuming you want everything in /usr/local/lib, and /usr/local/include. If you set up your own project to look in those directories, you should be fine. Note that your build overwrote whatever previous build of OpenEXR you had in /usr/local.

@omenos
Copy link
Author

omenos commented May 23, 2017

Yeah, I was never able to build OpenEXR, so that was IlmBase overwriting itself about 4 times ;)

@shreyaj
Copy link

shreyaj commented Jan 13, 2018

I am having the same issue. I configured IlmBase and OpenEXE successfully. Now, I try to build openexe but it fails showing that it cannot find any of the include files. I added the include files path (C:\Program\include) and lib files path (C:\Program\lib) to my user environment variables and to each project's properties in Visual studio but nothing works. I keep getting the error that half.h cannot be found when I do "cmake --build . --target install --config Release".
Did you guys end up building OpenEXE?
PLEASE HELP!

@omenos
Copy link
Author

omenos commented Jan 13, 2018

Did you guys end up building OpenEXER?

Actually, yes! Turns out even if I included the path in the configure or make line to the header files, OpenEXR still couldn't find half.h. The solution for me was to add it to the LD_LIBRARY_PATH environment variable after building IlmBase. So on Linux, it would look like:

export LD_LIBRARY_PATH=$HOME/sw/vfx/openexr/2.2.1/include:$HOME/sw/vfx/openexr/2.2.1/include/openexr

I did the doubling there as a safety measure, just to make sure it knew exactly where the header files were. After doing this I could build OpenEXR just fine. How this carries over onto Windows, however, I'm not too sure... I think instead of LD_LIBRARY_PATH you need to add the headers location to PATH.

Cheers!

@shreyaj
Copy link

shreyaj commented Jan 13, 2018

I already added my include and lib directories to the PATH variable. It still doesn't work. I am not sure why...
error.txt

@omenos
Copy link
Author

omenos commented Jan 13, 2018

Weird. Though I'm going to be honest I'm not sure if my solution was due to me getting past the half.h issue and running into libHalf missing. It's been so long since I've built and I don't use Windows.

Just to clarify, I build IlmBase and OpenEXR into the same directory, so the LD_LIBRARY_PATH I've pointed to above is containing IlmBase despite being labeled OpenEXR.

@shreyaj
Copy link

shreyaj commented Jan 13, 2018

Omg, putting them in the same directory did it for me. Thank you so much, I really appreciate it!

@omenos
Copy link
Author

omenos commented Jan 14, 2018

@shreyaj I'm in the process of building OpenEXR on Windows (need to build OpenVDB for multiple platforms) and had a quick question. Are you building from source or from the download on the releases page? They have different contents and I'm used to source on Linux and running bootstrap with configure. Doesn't seem to be the way to do things on Windows. Maybe you can point me in the right direction?

Edit: I think I got it. README.cmake.txt is what I needed.

@meshula
Copy link
Contributor

meshula commented Jan 15, 2018

FWIW, this script has a lot of clues in it: https://github.com/vfxpro99/mkvfx/blob/master/windows/vc140-x64/openexr.cmd

That script doesn't build the python bindings though.

@shreyaj
Copy link

shreyaj commented Jan 15, 2018

@omento I am building it from source to use with renderdoc. I used cmake and Visual studio to build the solutions. You also need zlib. I attached the instructions file to build it.
README.cmake.txt

Sorry for the late reply, I just saw that you figured it out. Good luck!

@omenos
Copy link
Author

omenos commented Jan 15, 2018

Turns out trying to match CMake versions to what I used on Linux was a dumb idea. Latest CMake version fixed it. The problem was that CMake couldn't find the generator for "Visual Studio 15 2017 Win64".

@cary-ilm
Copy link
Member

Looking into the OpenEXR issue backlog. This issue seems to be resolved, so closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants