Boost C++ Libraries: Ticket #13315: boost 1.65.1 gcc 5.4 redefinition error in boost/type_traits/is_unsigned.hpp https://svn.boost.org/trac10/ticket/13315 <p> This is my gcc version: </p> <pre class="wiki">root# g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/5/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.1-2ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=gcc4-compatible --disable-libstdcxx-dual-abi --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 5.4.1 20160904 (Ubuntu/Linaro 5.4.1-2ubuntu1~14.04) </pre><p> When I am building ViennaCL, I got this error: </p> <pre class="wiki">makefile# cd /root/viennacl-dev/build/tests &amp;&amp; /usr/bin/c++ --std=c++11 -O3 -DNDEBUG -I/root/viennacl-dev -I/usr/local/include -I/root/viennacl-dev/external -I/root/viennacl-dev/libviennacl/include -DVIENNACL_WITH_OPENCL -o CMakeFiles/external_linkage-opencl.dir/src/external_2.cpp.o -c /root/viennacl-dev/tests/src/external_2.cpp In file included from /usr/local/include/boost/type_traits.hpp:127:0, from /usr/local/include/boost/numeric/ublas/traits.hpp:27, from /usr/local/include/boost/numeric/ublas/storage.hpp:26, from /usr/local/include/boost/numeric/ublas/storage_sparse.hpp:23, from /usr/local/include/boost/numeric/ublas/vector_sparse.hpp:16, from /usr/local/include/boost/numeric/ublas/matrix_sparse.hpp:16, from /root/viennacl-dev/viennacl/meta/result_of.hpp:32, from /root/viennacl-dev/viennacl/scalar.hpp:29, from /root/viennacl-dev/tests/src/external_2.cpp:34: /usr/local/include/boost/type_traits/is_unsigned.hpp:126:20: error: redefinition of ‘struct boost::is_unsigned&lt;long long unsigned int&gt;’ template &lt;&gt; struct is_unsigned&lt;const ::boost::ulong_long_type&gt; : public true_type{}; ^ /usr/local/include/boost/type_traits/is_unsigned.hpp:125:20: error: previous definition of ‘struct boost::is_unsigned&lt;long long unsigned int&gt;’ template &lt;&gt; struct is_unsigned&lt; ::boost::ulong_long_type&gt; : public true_type{}; ^ </pre><p> With or without `--std=c++11' didn't help. </p> <p> Other info. I installed GCC 5 via ppa. </p> <pre class="wiki">root# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.1 LTS Release: 14.04 Codename: trusty root# uname -a Linux firefly 3.10.0 #128 SMP PREEMPT Tue Aug 15 16:17:29 CST 2017 armv7l armv7l armv7l GNU/Linux </pre><p> <strong>I didn't meed the error when I use GCC 4.8.4 with libboost 1.54.</strong> </p> <p> What should I do to solve the problem, thank you very much! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13315 Trac 1.4.3 anonymous Fri, 01 Dec 2017 04:02:22 GMT summary changed https://svn.boost.org/trac10/ticket/13315#comment:1 https://svn.boost.org/trac10/ticket/13315#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">gcc 5.4 redefinition error in boost/type_traits/is_unsigned.hpp</span> → <span class="trac-field-new">boost 1.65.1 gcc 5.4 redefinition error in boost/type_traits/is_unsigned.hpp</span> </li> </ul> Ticket Michel Morin Fri, 01 Dec 2017 13:23:58 GMT <link>https://svn.boost.org/trac10/ticket/13315#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13315#comment:2</guid> <description> <p> I think this is a compiler bug (though I don't understand what happens in the code). Here is a smaller testcase </p> <pre class="wiki">#include &lt;iostream&gt; typedef unsigned long long cl_ulong __attribute__((aligned(8))); void f() { // unsigned long long x; // OK cl_ulong x; // Error std::cout &lt;&lt; x; } template &lt;class T&gt; struct is_unsigned {}; template &lt;&gt; struct is_unsigned&lt; unsigned long long&gt; {}; template &lt;&gt; struct is_unsigned&lt;const unsigned long long&gt; {}; </pre><p> G++-5 fails to compile the code on C++11, 14, 17 modes with the following error messages </p> <pre class="wiki">Line14: error: redefinition of 'struct is_unsigned&lt;long long unsigned int&gt;' template &lt;&gt; struct is_unsigned&lt;const unsigned long long&gt; {}; ^ Line13: error: previous definition of 'struct is_unsigned&lt;long long unsigned int&gt;' template &lt;&gt; struct is_unsigned&lt; unsigned long long&gt; {}; </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Michel Morin</dc:creator> <pubDate>Tue, 05 Dec 2017 11:38:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13315#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13315#comment:3</guid> <description> <p> I reported the compiler bug to GCC as <a class="ext-link" href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83248"><span class="icon">​</span>PR83248</a>. There, I got this reply </p> <blockquote class="citation"> <p> GCC 5 is no longer maintained, if it is fixed in GCC 6 please use that. </p> </blockquote> <p> GCC 6, 7, 8 do not have this compiler bug. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 25 Jan 2018 10:53:21 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/13315#comment:4 https://svn.boost.org/trac10/ticket/13315#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> I'm going to close this, purely because I don't see any way to fix this without breaking other stuff... please file a PR if you see a way. </p> Ticket