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

CMake static build of OpenEXR 2.2 fails to link dwaLookups on Linux #166

Closed
ComicSansMS opened this issue Oct 7, 2015 · 2 comments
Closed
Labels
Build A problem with building or installing the library.
Milestone

Comments

@ComicSansMS
Copy link

I do a CMake build of ilmbase with -DBUILD_SHARED_LIBS=OFF and install to a directory /ilmbase-INSTALL.

Then I configure OpenEXR with the following CMake command:

cmake -DCMAKE_INSTALL_PREFIX=/openexr-INSTALL -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DILMBASE_PACKAGE_PREFIX=/ilmbase-INSTALL -DZLIB_ROOT=/my_zlib_install ..

This will fail to link dwaLookups with the following error message:

/ilmbase-INSTALL/lib/libIlmThread-2_2.a(IlmThreadPosix.cpp.o): In function `IlmThread_2_2::Thread::start()':
IlmThreadPosix.cpp:(.text+0xb4): undefined reference to `Iex_2_2::throwErrnoExc(std::string const&, int)'
/ilmbase-INSTALL/lib/libIlmThread-2_2.a(IlmThreadSemaphorePosix.cpp.o): In function `IlmThread_2_2::Semaphore::Semaphore(unsigned int)':
IlmThreadSemaphorePosix.cpp:(.text+0x72): undefined reference to `Iex_2_2::throwErrnoExc(std::string const&)'
/ilmbase-INSTALL/lib/libIlmThread-2_2.a(IlmThreadSemaphorePosix.cpp.o): In function `IlmThread_2_2::Semaphore::post()':
IlmThreadSemaphorePosix.cpp:(.text+0x16a): undefined reference to `Iex_2_2::throwErrnoExc(std::string const&)'
/ilmbase-INSTALL/lib/libIlmThread-2_2.a(IlmThreadSemaphorePosix.cpp.o): In function `IlmThread_2_2::Semaphore::value() const':
IlmThreadSemaphorePosix.cpp:(.text+0x212): undefined reference to `Iex_2_2::throwErrnoExc(std::string const&)'
collect2: error: ld returned 1 exit status

Inspecting the command line by running VERBOSE=1 make reveals the source of the error:

/usr/local/bin/g++48   -O3 -DNDEBUG   CMakeFiles/dwaLookups.dir/dwaLookups.cpp.o  -o dwaLookups  -L/ilmbase-INSTALL/lib -rdynamic -lHalf -lIex-2_2 -lIlmThread-2_2 -lpthread -Wl,-rpath,/ilmbase-INSTALL/lib

The order in which the ilmbase libraries are specified is wrong. IlmThread depends on symbols from Iex, so they need to be swapped. Changing the command line to

/usr/local/bin/g++48   -O3 -DNDEBUG   CMakeFiles/dwaLookups.dir/dwaLookups.cpp.o  -o dwaLookups  -L/ilmbase-INSTALL/lib -rdynamic -lHalf -lIlmThread-2_2 -lIex-2_2 -lpthread -Wl,-rpath,/ilmbase-INSTALL/lib

makes the error goes away. Once dwaLookups has been built manually this way, the rest of the CMake run can complete without further errors.

Reproduced on a CentOS 5 Linux with gcc 4.8 and CMake 3.3.

@ehanway-ilm ehanway-ilm added CMake Build A problem with building or installing the library. labels Oct 24, 2015
@ComicSansMS
Copy link
Author

I opened a pull request with a fix for the issue.

@ehanway-ilm ehanway-ilm modified the milestone: v2.2.1 May 2, 2016
@cary-ilm
Copy link
Member

Looking into the OpenEXR issue backlog. This seems to have been merged, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build A problem with building or installing the library.
Projects
None yet
Development

No branches or pull requests

3 participants