Issue building kwiver with clang and fletch with gcc
I am seeing an issue when building fletch with gcc and then kwiver with clang. I'm not sure if this is expected to cause problems, but it seems that the travis dashboards for master are successfully building clang-kwiver against gcc-fletch. So, it seems odd that I can't.
Note, that If I build clang-kwiver against clang-fletch, then the error does not occur. This test also does not occur if with KWIVER_ENABLE_TESTS=False.
However, when I build clang-kwiver against gcc-fletch (with KWIVER_ENABLE_TESTS=True) I get a linker error in the vxl arrow tests:
Scanning dependencies of target test-ocv_bounding_box
[ 51%] Building CXX object arrows/ocv/tests/CMakeFiles/test-ocv_bounding_box.dir/test_bounding_box.cxx.o
[ 51%] Linking CXX executable ../../../tests/bin/test-ocv_bounding_box
[ 51%] Built target test-ocv_bounding_box
[ 51%] Built target kwiver_algo_proj
[ 52%] Built target kwiver_algo_proj_plugin
[ 54%] Built target kwiver_algo_vxl
[ 54%] Built target kwiver_algo_vxl_plugin
[ 54%] Linking CXX executable ../../../tests/bin/test-vxl_triangulate_landmarks
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<int>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<unsigned char>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<short>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<long>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<bool>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<unsigned long>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<double>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<unsigned int>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<signed char>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<unsigned short>::is_a[abi:cxx11]() const'
../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view<float>::is_a[abi:cxx11]() const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
arrows/vxl/tests/CMakeFiles/test-vxl_triangulate_landmarks.dir/build.make:119: recipe for target 'tests/bin/test-vxl_triangulate_landmarks' failed
make[2]: *** [tests/bin/test-vxl_triangulate_landmarks] Error 1
CMakeFiles/Makefile2:4375: recipe for target 'arrows/vxl/tests/CMakeFiles/test-vxl_triangulate_landmarks.dir/all' failed
make[1]: *** [arrows/vxl/tests/CMakeFiles/test-vxl_triangulate_landmarks.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
The issue seems to be with vil_image_view<*>::is_a[abi:cxx11]() const.
I made sure that cmake is correctly linking the target with the vil (which it seems to be). I then went and checked that libvil.so had the correct symbols.
In gcc-fletch the symbols for were:
(venv3) joncrall@calculex:~/code/fletch/build-py2/install/lib$ nm -gC libvil.so | grep "vil_image.*::is_a"
00000000001867e0 W vil_image_view<vil_rgb<signed char> >::is_a() const
000000000017a8a0 W vil_image_view<vil_rgb<bool> >::is_a() const
000000000017dea0 W vil_image_view<vil_rgb<double> >::is_a() const
000000000017fa50 W vil_image_view<vil_rgb<float> >::is_a() const
000000000017c380 W vil_image_view<vil_rgb<unsigned char> >::is_a() const
00000000001830e0 W vil_image_view<vil_rgb<int> >::is_a() const
0000000000189d80 W vil_image_view<vil_rgb<unsigned int> >::is_a() const
0000000000184c40 W vil_image_view<vil_rgb<long> >::is_a() const
000000000018b8e0 W vil_image_view<vil_rgb<unsigned long> >::is_a() const
00000000001815b0 W vil_image_view<vil_rgb<short> >::is_a() const
0000000000188250 W vil_image_view<vil_rgb<unsigned short> >::is_a() const
00000000001990c0 W vil_image_view<vil_rgba<signed char> >::is_a() const
000000000018d510 W vil_image_view<vil_rgba<bool> >::is_a() const
0000000000190970 W vil_image_view<vil_rgba<double> >::is_a() const
0000000000192510 W vil_image_view<vil_rgba<float> >::is_a() const
000000000018ef80 W vil_image_view<vil_rgba<unsigned char> >::is_a() const
0000000000195a70 W vil_image_view<vil_rgba<int> >::is_a() const
000000000019c5a0 W vil_image_view<vil_rgba<unsigned int> >::is_a() const
0000000000197540 W vil_image_view<vil_rgba<long> >::is_a() const
000000000019e070 W vil_image_view<vil_rgba<unsigned long> >::is_a() const
0000000000193fe0 W vil_image_view<vil_rgba<short> >::is_a() const
000000000019aac0 W vil_image_view<vil_rgba<unsigned short> >::is_a() const
000000000016fb60 W vil_image_view<signed char>::is_a() const
0000000000162640 W vil_image_view<bool>::is_a() const
0000000000165bf0 W vil_image_view<double>::is_a() const
0000000000167b00 W vil_image_view<float>::is_a() const
0000000000092990 W vil_image_view<unsigned char>::is_a() const
000000000016bd90 W vil_image_view<int>::is_a() const
0000000000092e40 W vil_image_view<unsigned int>::is_a() const
000000000016dba0 W vil_image_view<long>::is_a() const
00000000001752b0 W vil_image_view<unsigned long>::is_a() const
0000000000169b30 W vil_image_view<short>::is_a() const
0000000000177280 W vil_image_view<std::complex<double> >::is_a() const
0000000000178d40 W vil_image_view<std::complex<float> >::is_a() const
0000000000092d30 W vil_image_view<unsigned short>::is_a() const
000000000015dd50 W vil_image_resource_plugin::is_a[abi:cxx11]() const
and in the clang-fletch version they were:
(venv3) joncrall@calculex:~/code/fletch/build-clang/install/lib$ nm -gC libvil.so | grep "vil_image.*::is_a"
000000000016dd40 W vil_image_view<vil_rgb<signed char> >::is_a[abi:cxx11]() const
00000000001626d0 W vil_image_view<vil_rgb<bool> >::is_a[abi:cxx11]() const
0000000000165c40 W vil_image_view<vil_rgb<double> >::is_a[abi:cxx11]() const
0000000000167590 W vil_image_view<vil_rgb<float> >::is_a[abi:cxx11]() const
0000000000164090 W vil_image_view<vil_rgb<unsigned char> >::is_a[abi:cxx11]() const
000000000016a8d0 W vil_image_view<vil_rgb<int> >::is_a[abi:cxx11]() const
0000000000171030 W vil_image_view<vil_rgb<unsigned int> >::is_a[abi:cxx11]() const
000000000016c370 W vil_image_view<vil_rgb<long> >::is_a[abi:cxx11]() const
0000000000172aa0 W vil_image_view<vil_rgb<unsigned long> >::is_a[abi:cxx11]() const
0000000000168f50 W vil_image_view<vil_rgb<short> >::is_a[abi:cxx11]() const
000000000016f6e0 W vil_image_view<vil_rgb<unsigned short> >::is_a[abi:cxx11]() const
00000000001807a0 W vil_image_view<vil_rgba<signed char> >::is_a[abi:cxx11]() const
00000000001746d0 W vil_image_view<vil_rgba<bool> >::is_a[abi:cxx11]() const
0000000000177f10 W vil_image_view<vil_rgba<double> >::is_a[abi:cxx11]() const
0000000000179920 W vil_image_view<vil_rgba<float> >::is_a[abi:cxx11]() const
0000000000176300 W vil_image_view<vil_rgba<unsigned char> >::is_a[abi:cxx11]() const
000000000017cf70 W vil_image_view<vil_rgba<int> >::is_a[abi:cxx11]() const
0000000000184000 W vil_image_view<vil_rgba<unsigned int> >::is_a[abi:cxx11]() const
000000000017eb70 W vil_image_view<vil_rgba<long> >::is_a[abi:cxx11]() const
0000000000185c30 W vil_image_view<vil_rgba<unsigned long> >::is_a[abi:cxx11]() const
000000000017b560 W vil_image_view<vil_rgba<short> >::is_a[abi:cxx11]() const
0000000000182430 W vil_image_view<vil_rgba<unsigned short> >::is_a[abi:cxx11]() const
00000000001585e0 W vil_image_view<signed char>::is_a[abi:cxx11]() const
000000000014c4a0 W vil_image_view<bool>::is_a[abi:cxx11]() const
000000000014f690 W vil_image_view<double>::is_a[abi:cxx11]() const
0000000000151510 W vil_image_view<float>::is_a[abi:cxx11]() const
0000000000091740 W vil_image_view<unsigned char>::is_a[abi:cxx11]() const
0000000000155080 W vil_image_view<int>::is_a[abi:cxx11]() const
0000000000091cf0 W vil_image_view<unsigned int>::is_a[abi:cxx11]() const
0000000000156e50 W vil_image_view<long>::is_a[abi:cxx11]() const
000000000015d940 W vil_image_view<unsigned long>::is_a[abi:cxx11]() const
0000000000153400 W vil_image_view<short>::is_a[abi:cxx11]() const
000000000015f300 W vil_image_view<std::complex<double> >::is_a[abi:cxx11]() const
0000000000160d50 W vil_image_view<std::complex<float> >::is_a[abi:cxx11]() const
0000000000091a10 W vil_image_view<unsigned short>::is_a[abi:cxx11]() const
0000000000145fb0 W vil_image_resource_plugin::is_a[abi:cxx11]() const
Notice that the clang version has the [abi:cxx11] tag on all the vil_image_view templates, where as gcc does not. However, gcc does have [abi:cxx11] on vil_image_resource_plugin::is_a. This is the extent of the debugging I've been able to do, and I don't know where to go from here.
It bothers me that the travis dashboards don't fail because even though the master passes normally, I saw them fail in this way in PR #308. I'm not sure what triggered it to fail in that instance. I am building against master on my machine.
Other relevant specs: I'm on Ubuntu 16.04, using gcc5.4.0 and clang4.0.
I have done preliminary tests using clang3.8 on seen the same behavior. (I probably should test the versions being used on the travis dashboard, which I believe are gcc-4.8 and clang 3.4, but the fact that I saw these errors on the travis dashboard means its probably something else causing them to pass on travis but fail on my machine)
Doesn't Clang on Linux/Ubuntu use libc++ where gcc uses libstdc++.
If my understanding of that is correct, it could account for the issues you're seeing. I don't know what the default standard library for Clang is though, so I could be offbase, but that is a decent place to start.
On Tue, Oct 3, 2017 at 10:28 AM, Jon Crall [email protected] wrote:
I am seeing an issue when building fletch with gcc and then kwiver with clang. I'm not sure if this is expected to cause problems, but it seems that the travis dashboards for master are successfully building clang-kwiver against gcc-fletch. So, it seems odd that I can't.
Note, that If I build clang-kwiver against clang-fletch, then the error does not occur. This test also does not occur if with KWIVER_ENABLE_TESTS=False.
However, when I build clang-kwiver against gcc-fletch (with KWIVER_ENABLE_TESTS=True) I get a linker error in the vxl arrow tests:
Scanning dependencies of target test-ocv_bounding_box [ 51%] Building CXX object arrows/ocv/tests/CMakeFiles/test-ocv_bounding_box.dir/test_bounding_box.cxx.o [ 51%] Linking CXX executable ../../../tests/bin/test-ocv_bounding_box [ 51%] Built target test-ocv_bounding_box [ 51%] Built target kwiver_algo_proj [ 52%] Built target kwiver_algo_proj_plugin [ 54%] Built target kwiver_algo_vxl [ 54%] Built target kwiver_algo_vxl_plugin [ 54%] Linking CXX executable ../../../tests/bin/test-vxl_triangulate_landmarks ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to
vil_image_view<int>::is_a[abi:cxx11]() const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference tovil_image_view::is_aabi:cxx11 const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to vil_image_view<short>::is_a[abi:cxx11]() const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference tovil_image_view::is_aabi:cxx11 const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to vil_image_view<bool>::is_a[abi:cxx11]() const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference tovil_image_view::is_aabi:cxx11 const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to vil_image_view<double>::is_a[abi:cxx11]() const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference tovil_image_view::is_aabi:cxx11 const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to vil_image_view<signed char>::is_a[abi:cxx11]() const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference tovil_image_view::is_aabi:cxx11 const' ../../../lib/libkwiver_algo_vxl.so.1.2.0: undefined reference to `vil_image_view ::is_aabi:cxx11 const' clang: error: linker command failed with exit code 1 (use -v to see invocation) arrows/vxl/tests/CMakeFiles/test-vxl_triangulate_landmarks.dir/build.make:119: recipe for target 'tests/bin/test-vxl_triangulate_landmarks' failed make[2]: *** [tests/bin/test-vxl_triangulate_landmarks] Error 1 CMakeFiles/Makefile2:4375: recipe for target 'arrows/vxl/tests/CMakeFiles/test-vxl_triangulate_landmarks.dir/all' failed make[1]: *** [arrows/vxl/tests/CMakeFiles/test-vxl_triangulate_landmarks.dir/all] Error 2 Makefile:162: recipe for target 'all' failed make: *** [all] Error 2 The issue seems to be with vil_image_view<*>::is_aabi:cxx11 const. I made sure that cmake is correctly linking the target with the vil (which it seems to be). I then went and checked that libvil.so had the correct symbols.
In gcc-fletch the symbols for were:
(venv3) joncrall@calculex:~/code/fletch/build-py2/install/lib$ nm -gC libvil.so | grep "vil_image.*::is_a" 00000000001867e0 W vil_image_view<vil_rgb
>::is_a() const 000000000017a8a0 W vil_image_view<vil_rgb >::is_a() const 000000000017dea0 W vil_image_view<vil_rgb >::is_a() const 000000000017fa50 W vil_image_view<vil_rgb >::is_a() const 000000000017c380 W vil_image_view<vil_rgb >::is_a() const 00000000001830e0 W vil_image_view<vil_rgb >::is_a() const 0000000000189d80 W vil_image_view<vil_rgb >::is_a() const 0000000000184c40 W vil_image_view<vil_rgb >::is_a() const 000000000018b8e0 W vil_image_view<vil_rgb >::is_a() const 00000000001815b0 W vil_image_view<vil_rgb >::is_a() const 0000000000188250 W vil_image_view<vil_rgb >::is_a() const 00000000001990c0 W vil_image_view<vil_rgba >::is_a() const 000000000018d510 W vil_image_view<vil_rgba >::is_a() const 0000000000190970 W vil_image_view<vil_rgba >::is_a() const 0000000000192510 W vil_image_view<vil_rgba >::is_a() const 000000000018ef80 W vil_image_view<vil_rgba >::is_a() const 0000000000195a70 W vil_image_view<vil_rgba >::is_a() const 000000000019c5a0 W vil_image_view<vil_rgba >::is_a() const 0000000000197540 W vil_image_view<vil_rgba >::is_a() const 000000000019e070 W vil_image_view<vil_rgba >::is_a() const 0000000000193fe0 W vil_image_view<vil_rgba >::is_a() const 000000000019aac0 W vil_image_view<vil_rgba >::is_a() const 000000000016fb60 W vil_image_view ::is_a() const 0000000000162640 W vil_image_view ::is_a() const 0000000000165bf0 W vil_image_view ::is_a() const 0000000000167b00 W vil_image_view ::is_a() const 0000000000092990 W vil_image_view ::is_a() const 000000000016bd90 W vil_image_view ::is_a() const 0000000000092e40 W vil_image_view ::is_a() const 000000000016dba0 W vil_image_view ::is_a() const 00000000001752b0 W vil_image_view ::is_a() const 0000000000169b30 W vil_image_view ::is_a() const 0000000000177280 W vil_image_view<std::complex >::is_a() const 0000000000178d40 W vil_image_view<std::complex >::is_a() const 0000000000092d30 W vil_image_view ::is_a() const 000000000015dd50 W vil_image_resource_plugin::is_aabi:cxx11 const and in the clang-fletch version they were:
(venv3) joncrall@calculex:~/code/fletch/build-clang/install/lib$ nm -gC libvil.so | grep "vil_image.*::is_a" 000000000016dd40 W vil_image_view<vil_rgb
>::is_aabi:cxx11 const 00000000001626d0 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 0000000000165c40 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 0000000000167590 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 0000000000164090 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 000000000016a8d0 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 0000000000171030 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 000000000016c370 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 0000000000172aa0 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 0000000000168f50 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 000000000016f6e0 W vil_image_view<vil_rgb >::is_aabi:cxx11 const 00000000001807a0 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 00000000001746d0 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 0000000000177f10 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 0000000000179920 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 0000000000176300 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 000000000017cf70 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 0000000000184000 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 000000000017eb70 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 0000000000185c30 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 000000000017b560 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 0000000000182430 W vil_image_view<vil_rgba >::is_aabi:cxx11 const 00000000001585e0 W vil_image_view ::is_aabi:cxx11 const 000000000014c4a0 W vil_image_view ::is_aabi:cxx11 const 000000000014f690 W vil_image_view ::is_aabi:cxx11 const 0000000000151510 W vil_image_view ::is_aabi:cxx11 const 0000000000091740 W vil_image_view ::is_aabi:cxx11 const 0000000000155080 W vil_image_view ::is_aabi:cxx11 const 0000000000091cf0 W vil_image_view ::is_aabi:cxx11 const 0000000000156e50 W vil_image_view ::is_aabi:cxx11 const 000000000015d940 W vil_image_view ::is_aabi:cxx11 const 0000000000153400 W vil_image_view ::is_aabi:cxx11 const 000000000015f300 W vil_image_view<std::complex >::is_aabi:cxx11 const 0000000000160d50 W vil_image_view<std::complex >::is_aabi:cxx11 const 0000000000091a10 W vil_image_view ::is_aabi:cxx11 const 0000000000145fb0 W vil_image_resource_plugin::is_aabi:cxx11 const Notice that the clang version has the [abi:cxx11] tag on all the vil_image_view templates, where as gcc does not. However, gcc does have [abi:cxx11] on vil_image_resource_plugin::is_a. This is the extent of the debugging I've been able to do, and I don't know where to go from here.
It bothers me that the travis dashboards don't fail because even though the master passes normally, I saw them fail in this way in PR #308 https://github.com/Kitware/kwiver/pull/308. I'm not sure what triggered it to fail in that instance. I am building against master on my machine.
Other relevant specs: I'm on Ubuntu 16.04, using gcc5.4.0 and clang4.0.
I have done preliminary tests using clang3.8 on seen the same behavior. (I probably should test the versions being used on the travis dashboard, which I believe are gcc-4.8 and clang 3.4, but the fact that I saw these errors on the travis dashboard means its probably something else causing them to pass on travis but fail on my machine)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kitware/kwiver/issues/332, or mute the thread https://github.com/notifications/unsubscribe-auth/AFRAWpFY2q9CI9eKhFpWB687yptZGzL0ks5sokR8gaJpZM4PsNU0 .
-- David Stoup Staff R&D Engineer
Kitware, Inc. 28 Corporate Drive Clifton Park, NY. 12065 518-881-4949 (W) 518-312-3946 (M) 518-371-4573 (F)
Looking on stack overflow, one answer from 2014 reports that linux systems will use libstdc++ because libc++ is not complete and is not backwards compatible on linux systems.
I verified this by looking at the binaries in the clang-kwiver/clang-fletch build. I checked what they were linking to via ldd, and like they are indeed using libstdc++, and not libc++.