Building Alembic 1.8.2 + Imath 3.2 as Static -> OK on MSVC, fail under gcc

80 views
Skip to first unread message

Sébastien Maraux

unread,
Aug 16, 2021, 5:49:47 AMAug 16
to alembic-discussion
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
build_gcc48.zip
build_gcc6.zip

Sébastien Maraux

unread,
Aug 16, 2021, 9:13:58 AMAug 16
to alembic-d...@googlegroups.com
Answering to myself :
After patching Imath 3.2 to handle the __has_attribute() on gcc4.8.5, I am able to build both gcc 4.8.5 and gcc6.3 without errors
A lot of std issues -> I used gcc instead of g++. Sorry to disturb the list for general gcc misuse.


--
You received this message because you are subscribed to a topic in the Google Groups "alembic-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/alembic-discussion/I4UbY8U6qN4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to alembic-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alembic-discussion/0a9bed49-81fb-4328-9bab-34b71b79c0d0n%40googlegroups.com.


--

Lucas Miller

unread,
Aug 16, 2021, 12:16:11 PMAug 16
to alembic-d...@googlegroups.com
I retested with a fresh rebuild of Imath 3.1.2 and Alembic master with
gcc6.3 this morning: (installing to /tmp/install_test)

Imath3:
cmake -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc
-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++
-DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/tmp/install_test
Imath3_src_location

Alembic:
cmake -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc
-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++
-DImath_ROOT=/tmp/install_test
-DCMAKE_INSTALL_PREFIX=/tmp/install_test -DALEMBIC_SHARED_LIBS=OFF
Alembic_src_location

The tests ran fine, and installed as expected, is it possible your
Imath_ROOT is NOT that statically built one?

Lucas
> --
> You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.

Sébastien Maraux

unread,
Aug 16, 2021, 12:53:04 PMAug 16
to alembic-d...@googlegroups.com
Hello Lucas, 

Thank you for your testing, as I posted before, that was a misconfiguration of my compiler (gcc instead of g++ in CMake, I am not used to linux environment), both compilations ran fine after that. I had some issues with ABI which I should handle on my linux distribution (libstd++ used to build probably does not match the system one)

Thank you again

Best regards

You received this message because you are subscribed to a topic in the Google Groups "alembic-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/alembic-discussion/I4UbY8U6qN4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to alembic-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alembic-discussion/CAMoRnt5dsPfz-gZntjwVi8BZLVpPg3yLOJOq2w4i8-Qi%2BfKndw%40mail.gmail.com.


--

Reply all
Reply to author
Forward
0 new messages