bugOpenEXR - Bugs: bug #46146, CMake static build of OpenEXR...


bug #46146: CMake static build of OpenEXR fails to link dwaLookups on Linux

Submitter:  None
Submitted:  Wed 07 Oct 2015 02:17:13 PM UTC
Category:  build/install Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Wed 07 Oct 2015 02:17:13 PM UTC, original submission:  

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:


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, calling make again will complete the remaining build without further errors.

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



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.


No changes have been made to this item

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code