Building issues with gcc


Richard Shaw <hobbe...@...>
 

On Thu, Dec 8, 2011 at 9:28 AM, Jeff Clifford <j...@...> wrote:
Hi,

I've hit upon a couple of issues when trying to build the core OpenColorIO
lib.

a)

The following error occurs:

/usr/bin/ld: CMakeFiles/OpenColorIO.dir/Baker.cpp.o: relocation
R_X86_64_PC32 against `std::basic_ostringstream<char,
std::char_traits<char>, std::allocator<char>
::basic_ostringstream(std::_Ios_Openmode)@@GLIBCXX_3.4' can not be used
when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [src/core/libOpenColorIO.so.1.0.2] Error 1
Disclaimer: I'm not a programmer :)

But, I do know that Fedora builds with -fPIC by default, which the
error message suggests. I haven't run into this issue with Fedora 15
which uses a pretty recent gcc version.

Richard


Jeremy Selan <jeremy...@...>
 

I'll hold off on commenting on the first issue for the moment, but the 2nd issue (not preserving incoming CMAKE_CXX_FLAGS) is clearly an oversight.  I'll check in a fix today.

-- Jeremy


Jeremy Selan <jeremy...@...>
 

I've pushed the fix for CMAKE_CXX_FLAGS to master. Thanks for pointing that out.

As for
-fvisibility-inlines-hidden, the only places that appears in OCIO are:
CMakeLists.txt
ext/tinyxml_2_6_1.patch
ext/yaml-cpp-r482.patch

Would you try commenting out the offending lines, and see if that can build on your gcc version?

There are currently checks for CMAKE_COMPILER_IS_GNUCXX around these lines, and if we can confirm that older gccs dont support this option I'm happy to add an additional gcc version check as well.

-- Jeremy


On Thu, Dec 8, 2011 at 8:57 AM, Jeremy Selan <jeremy...@...> wrote:
I'll hold off on commenting on the first issue for the moment, but the 2nd issue (not preserving incoming CMAKE_CXX_FLAGS) is clearly an oversight.  I'll check in a fix today.

-- Jeremy


Jeff Clifford <j...@...>
 

Hi Jeremy,

Thanks for getting back to me so fast.

I can confirm already that omitting the -fvisibility-inlines-hidden from just CMakeLists.txt works.

I can also confirm that the issue doesn't occur for our gcc4.3.3 build - only for our gcc4.1.2 build.

Thanks,

Jeff.

Jeremy Selan wrote:

I've pushed the fix for CMAKE_CXX_FLAGS to master. Thanks for pointing that out.

As for -fvisibility-inlines-hidden, the only places that appears in OCIO are:
CMakeLists.txt
ext/tinyxml_2_6_1.patch
ext/yaml-cpp-r482.patch

Would you try commenting out the offending lines, and see if that can build on your gcc version?

There are currently checks for CMAKE_COMPILER_IS_GNUCXX around these lines, and if we can confirm that older gccs dont support this option I'm happy to add an additional gcc version check as well.

-- Jeremy

On Thu, Dec 8, 2011 at 8:57 AM, Jeremy Selan <jeremy...@... <mailto:jeremy...@...>> wrote:

I'll hold off on commenting on the first issue for the moment, but
the 2nd issue (not preserving incoming CMAKE_CXX_FLAGS) is clearly
an oversight. I'll check in a fix today.

-- Jeremy


------------------------------------------------------------------------

No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 10.0.1415 / Virus Database: 2102/4067 - Release Date: 12/08/11


Jeremy Selan <jeremy...@...>
 

I pushed a fix to my local master that detects what gcc is being used, and acts accordingly.

Would you test with both of your gcc versions and confirm this works?  I wasn't sure if -fPIC should still be used on gcc4.1, so I left it on (current behavior).

diff:
https://github.com/jeremyselan/OpenColorIO/commit/f0f45901178462287b713de1d9c51e0fc517ab47

Download the updated CMakeLists.txt:
https://raw.github.com/jeremyselan/OpenColorIO/f0f45901178462287b713de1d9c51e0fc517ab47/CMakeLists.txt

-- Jeremy


On Thu, Dec 8, 2011 at 12:27 PM, Jeff Clifford <j...@...> wrote:
Hi Jeremy,

Thanks for getting back to me so fast.

I can confirm already that omitting the -fvisibility-inlines-hidden from just CMakeLists.txt works.

I can also confirm that the issue doesn't occur for our gcc4.3.3 build - only for our gcc4.1.2 build.

Thanks,

Jeff.


Richard Shaw <hobbe...@...>
 

On Thu, Dec 8, 2011 at 8:06 PM, Jeremy Selan <jeremy...@...> wrote:
I pushed a fix to my local master that detects what gcc is being used, and
acts accordingly.

Would you test with both of your gcc versions and confirm this works?  I
wasn't sure if -fPIC should still be used on gcc4.1, so I left it on
(current behavior).

diff:
https://github.com/jeremyselan/OpenColorIO/commit/f0f45901178462287b713de1d9c51e0fc517ab47

Download the updated CMakeLists.txt:
https://raw.github.com/jeremyselan/OpenColorIO/f0f45901178462287b713de1d9c51e0fc517ab47/CMakeLists.txt
Built with no errors on my system (GCC 4.6.1)

Richard


Jeff Clifford <j...@...>
 

Yep good for me now too thanks.  Both gcc412 and gcc433 build fine and using -D CMAKE_CXX_FLAGS= passes through too.

Richard Shaw wrote:

On Thu, Dec 8, 2011 at 8:06 PM, Jeremy Selan <jere...@...> wrote:
  
I pushed a fix to my local master that detects what gcc is being used, and
acts accordingly.

Would you test with both of your gcc versions and confirm this works?  I
wasn't sure if -fPIC should still be used on gcc4.1, so I left it on
(current behavior).

diff:
https://github.com/jeremyselan/OpenColorIO/commit/f0f45901178462287b713de1d9c51e0fc517ab47

Download the updated CMakeLists.txt:
https://raw.github.com/jeremyselan/OpenColorIO/f0f45901178462287b713de1d9c51e0fc517ab47/CMakeLists.txt
    
Built with no errors on my system (GCC 4.6.1)

Richard
  


Jeremy Selan <jeremy...@...>
 

Committed.

-- Jeremy


On Fri, Dec 9, 2011 at 6:49 AM, Jeff Clifford <j...@...> wrote:
Yep good for me now too thanks.  Both gcc412 and gcc433 build fine and using -D CMAKE_CXX_FLAGS= passes through too.


Richard Shaw wrote:
On Thu, Dec 8, 2011 at 8:06 PM, Jeremy Selan <jere...@...> wrote:
  
I pushed a fix to my local master that detects what gcc is being used, and
acts accordingly.

Would you test with both of your gcc versions and confirm this works?  I
wasn't sure if -fPIC should still be used on gcc4.1, so I left it on
(current behavior).

diff:
https://github.com/jeremyselan/OpenColorIO/commit/f0f45901178462287b713de1d9c51e0fc517ab47

Download the updated CMakeLists.txt:
https://raw.github.com/jeremyselan/OpenColorIO/f0f45901178462287b713de1d9c51e0fc517ab47/CMakeLists.txt
    
Built with no errors on my system (GCC 4.6.1)

Richard