Search code examples
compiler-errorscygwincross-compilingopenexr

Compile OpenEXR in cygwin


I'm trying to compile OpenEXR with cygwin but i'm having troubles doing it.

What I've done so far:

cd ilmbase-X.X.X
./configure
make
make install
make check

I need this because it's OpenEXR needs it. It runs ok, and it creates in /usr/local three folders: bin, include\OpenEXR and lib.

Then I proceed to OpenEXR and this is what I do:

cd openexr-X.X.X
./configure

Everything runs ok but when I do make it gives me the following error:

b44ExpLogTable.cpp:52:18: half.h: No such file or directory

Although I'm not aware why does this happens I can work it around by doing this:

./configure CPPFLAGS=-I/usr/local/include/OpenEXR

But then, when I hit make another error is thrown and I'm stucked in here:

/usr/local/include/OpenEXR/half.h:511: undefined reference to `half::_toFloat'
/usr/local/include/OpenEXR/half.h:511: undefined reference to `half::_toFloat'
/usr/local/include/OpenEXR/half.h:481: undefined reference to `half::_eLut'
/usr/local/include/OpenEXR/half.h:511: undefined reference to `half::_toFloat'
/usr/local/include/OpenEXR/half.h:511: undefined reference to `half::_toFloat'
/usr/local/include/OpenEXR/half.h:481: undefined reference to `half::_eLut'
/usr/local/include/OpenEXR/half.h:499: undefined reference to `half::convert(int)'
/usr/local/include/OpenEXR/half.h:481: undefined reference to `half::_eLut'
/usr/local/include/OpenEXR/half.h:499: undefined reference to `half::convert(int)'
/usr/local/include/OpenEXR/half.h:499: undefined reference to `half::convert(int)'
collect2: ld returned 1 exit status
<builtin>: recipe for target `b44ExpLogTable' failed
make[1]: *** [b44ExpLogTable] Error 1
make[1]: Leaving directory `/home/Andre/openexr-1.6.1/IlmImf'
Makefile:313: recipe for target `all-recursive' failed
make: *** [all-recursive] Error 1

Does this happens to anyone? I've googled a lot already and I can't find a solution. I hope someone can help.


Solution

  • I know this is a bit old, but it helped me figure out the -I switch.

    Once I got that, I figured out the answer to your problem. You're providing the include file, but not the library itself, hence the undefined reference. Use:

    ./configure CPPFLAGS="-I/usr/local/include/OpenEXR -L/usr/local/bin -lHalf-6"

    -L provides a library search directory, while -l provides a library to link into the program. -lHalf-6 indicates the file /usr/local/bin/cygHalf-6.dll.

    I couldn't tell you why the library is where it is, but it is.

    You may also run into another problem with memset, which is solved here: http://lists.gnu.org/archive/html/openexr-user/2011-07/msg00002.html