Hello,
I am trying to build the latest released Alembic as static libs, with minimal dependencies (IMath as static only), and have a hard time linking the libs.
On both gcc4.8.5 and 6.3, I have tons of link errors regarding std.
My CMake options were all default except :
Imath_dir=[my path to IMath/lib64/cmake/Imath]
modified CMAKE_INSTAL_PREFIX=[My wished path]
disabled ALEMBIC_SHARED_LIBS
disabled USE_TESTS
Imath is also built as STATIC :
disabled BUILD_SHARED_LIBS
disabled BUILD_TESTING
modified CMAKE_INSTAL_PREFIX=[My wished path]
Note that on Imath gcc 4.8.5, I had to fix a little issue with __has_attribute(__type_visibility__) not handles correctly under 4..8.5 (ignoring this line).
The result is a ton of conflicts at link time.
For example, gcc6 link first errors are :
[ 94%] Linking CXX executable abcdiff
cd /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/source/build_gcc6/bin/AbcDiff && /home/golaem/software/cmake-3.15.2-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/abcdiff.dir/link.txt --verbose=1
/home/golaem/software/gcc-6.3.0/bin/gcc -fvisibility=hidden CMakeFiles/abcls.dir/AbcLs.cpp.o -o abcls -Wl,-rpath,:::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/software/gcc-6.3.0/bin/gcc -fvisibility=hidden CMakeFiles/abctree.dir/AbcTree.cpp.o -o abctree -Wl,-rpath,:::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/software/gcc-6.3.0/bin/gcc -fvisibility=hidden CMakeFiles/abcechobounds.dir/AbcBoundsEcho.cpp.o -o abcechobounds -Wl,-rpath,:::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/software/gcc-6.3.0/bin/gcc -fvisibility=hidden CMakeFiles/abcecho.dir/AbcEcho.cpp.o -o abcecho -Wl,-rpath,:::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/software/gcc-6.3.0/bin/gcc -fvisibility=hidden CMakeFiles/abcstitcher.dir/AbcStitcher.cpp.o CMakeFiles/abcstitcher.dir/util.cpp.o -o abcstitcher -Wl,-rpath,:::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/software/gcc-6.3.0/bin/gcc -fvisibility=hidden CMakeFiles/abcdiff.dir/AbcDiff.cpp.o -o abcdiff -Wl,-rpath,:::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a(half.cpp.o): In function `operator<<(std::ostream&, Imath_3_2::half)':
half.cpp:(.text+0x1b): undefined reference to `std::ostream& std::ostream::_M_insert<double>(double)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a(half.cpp.o): In function `operator>>(std::istream&, Imath_3_2::half&)':
half.cpp:(.text+0x42): undefined reference to `std::istream& std::istream::_M_extract<float>(float&)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a(half.cpp.o): In function `printBits(std::ostream&, Imath_3_2::half)':
half.cpp:(.text+0x175): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
half.cpp:(.text+0x194): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a(half.cpp.o): In function `printBits(std::ostream&, float)':
half.cpp:(.text+0x1ff): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
half.cpp:(.text+0x223): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc63_x64/lib64/libImath-3_2.a(half.cpp.o): In function `_GLOBAL__sub_I_half.cpp':
half.cpp:(.text.startup+0xc): undefined reference to `std::ios_base::Init::Init()'
And for gcc 4.8.5 :
[ 94%] Linking CXX executable abcstitcher
cd /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/source/build_gcc48/bin/AbcStitcher && /home/golaem/software/cmake-3.15.2-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/abcstitcher.dir/link.txt --verbose=1
/usr/bin/gcc485 -fvisibility=hidden CMakeFiles/abcecho.dir/AbcEcho.cpp.o -o abcecho -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/usr/bin/gcc485 -fvisibility=hidden CMakeFiles/abcdiff.dir/AbcDiff.cpp.o -o abcdiff -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/usr/bin/gcc485 -fvisibility=hidden CMakeFiles/abcls.dir/AbcLs.cpp.o -o abcls -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/usr/bin/gcc485 -fvisibility=hidden CMakeFiles/abcechobounds.dir/AbcBoundsEcho.cpp.o -o abcechobounds -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/usr/bin/gcc485 -fvisibility=hidden CMakeFiles/abctree.dir/AbcTree.cpp.o -o abctree -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/usr/bin/gcc485 -fvisibility=hidden CMakeFiles/abcstitcher.dir/AbcStitcher.cpp.o CMakeFiles/abcstitcher.dir/util.cpp.o -o abcstitcher -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ../../lib/Alembic/libAlembic.a /home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a -lm -lpthread -lm
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a(half.cpp.o): In function `operator<<(std::ostream&, Imath_3_2::half)':
half.cpp:(.text+0x1a): undefined reference to `std::ostream& std::ostream::_M_insert<double>(double)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a(half.cpp.o): In function `operator>>(std::istream&, Imath_3_2::half&)':
half.cpp:(.text+0x40): undefined reference to `std::istream& std::istream::_M_extract<float>(float&)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a(half.cpp.o): In function `printBits(std::ostream&, Imath_3_2::half)':
half.cpp:(.text+0x176): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
half.cpp:(.text+0x193): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a(half.cpp.o): In function `printBits(std::ostream&, float)':
half.cpp:(.text+0x20a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
half.cpp:(.text+0x22c): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/home/golaem/glm/GolaemMisc/golaemExternals/alembic/alembic-1.8.2/gcc48_x64/lib64/libImath-3_2.a(half.cpp.o): In function `_GLOBAL__sub_I_half.cpp':
half.cpp:(.text.startup+0xc): undefined reference to `std::ios_base::Init::Init()'
I have included both logs after a second build (skipping already built parts)
Thank you in advance for any advice on how to manage that / correct what I did wrong !
Best