Building issues with gcc


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

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

I believe this is a known error for certain versions of gcc because OpenColorIO uses the -fvisibility-inlines-hidden flag by default (disable this flag and the error goes away).

FYI my compile line for Baker.cpp was:

cd /user_data/ARCHIVE/ociobuild/src/core && /tools/SITE/rnd/scripts/g++412   -DOpenColorIO_EXPORTS -DUSE_SSE -Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2 -L/apps/Linux64/gcc/gcc412/lib64 -msse2 -O2 -g -fPIC -I/user_data/ARCHIVE/imageworks-OpenColorIO-de86248/export -I/user_data/ARCHIVE/ociobuild/export -I/user_data/ARCHIVE/ociobuild/ext/dist/include -I/user_data/ARCHIVE/imageworks-OpenColorIO-de86248/ext/oiio/src/include   -DTIXML_USE_STL -fPIC -fvisibility-inlines-hidden -fvisibility=hidden -o CMakeFiles/OpenColorIO.dir/Baker.cpp.o -c /user_data/ARCHIVE/imageworks-OpenColorIO-de86248/src/core/Baker.cpp

b)

If you need to build OpenColorIO with a centrally installed version of gcc (like we do at DNeg) rather than the default local machine's one then currently passing the required CXX_FLAGS using -D CMAKE_CXX_FLAGS="-L/apps/Linux64/gcc/gcc412/lib64" as a cmake command line argument doesn't work.

The CMakeLists.txt file is overriding any options here:

if(CMAKE_COMPILER_IS_GNUCXX)
    # Enable a bunch of compiler warnings...
    # http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
    set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2")
    # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif(CMAKE_COMPILER_IS_GNUCXX)

rather than appending to the builder's options.

Regards,

Jeff.


Join ocio-dev@lists.aswf.io to automatically receive all group messages.