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

 
 

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

Submitted by:  None
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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:

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, 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.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

 

 

No changes have been made to this item

Back to the top


Powered by Savane 3.5