header file issue with gcc-4.9 and clang-3.5 installed
Kevin Funk
kfunk at kde.org
Sun Dec 14 10:49:03 GMT 2014
On Wednesday 10 December 2014 06:03:10 René J.V. Bertin wrote:
> Hi
>
> Not sure who's bug/issue this is, but as I've only seen it building kdevelop
> for now I'm exposing it here first.
>
> I'm running KUbuntu 14.04 with gcc-4.9 installed from
> http://ppa.launchpad.net/ubuntu-toolchain-r and clang-3.5 from one of the
> standard repositories. When I try to build kdevplatform git/master (synced
> yesterday) against KF5 from Project Neon5, I get headerfile-confusion
> related build errors on 5 files (the rest builds fine):
>
> cd
> /home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/plugi
> ns/classbrowser && /usr/bin/clang++ -DKCOREADDONS_LIB -DQT_CORE_LIB
> -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS
> -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_GUI_LIB -DQT_NETWORK_LIB
> -DQT_NO_DEBUG -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_CONCATENATION
> -DQT_USE_FAST_OPERATOR_PLUS -DQT_WIDGETS_LIB -DQT_XML_LIB
> -DTRANSLATION_DOMAIN=\"kdevclassbrowser\" -D_GNU_SOURCE
> -D_LARGEFILE64_SOURCE -Dkdevclassbrowser_EXPORTS -O3 -march=amdfam10
> -fvectorize -g -DNDEBUG -DQT_NO_DEBUG -std=c++0x -fno-exceptions -Wall
> -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long
> -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual
> -Werror=return-type -O2 -g -DNDEBUG -fPIC -fvisibility=hidden
> -fvisibility-inlines-hidden
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/plu
> gins/classbrowser
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/plugins/class
> browser -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/util
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/uti
> l
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/lan
> guage -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/language
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/int
> erfaces
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/interfaces
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/ser
> ialization
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/serialization
> -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/build-kf5/pro
> ject -I/home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/project
> -isystem /opt/project-neon5/include/KF5/KTextEditor -isystem
> /opt/project-neon5/include/KF5 -isystem
> /opt/project-neon5/include/KF5/KParts
> -I/opt/project-neon5/include/KF5/KIOWidgets
> -I/opt/project-neon5/include/KF5/KIOCore
> -I/opt/project-neon5/include/KF5/KCoreAddons -I/opt/project-neon5/include
> -I/opt/project-neon5/include/QtCore -I/opt/project-neon5/mkspecs/linux-g++
> -I/opt/project-neon5/include/KF5/KService
> -I/opt/project-neon5/include/KF5/KConfigCore
> -I/opt/project-neon5/include/KF5/KJobWidgets
> -I/opt/project-neon5/include/QtWidgets -I/opt/project-neon5/include/QtGui
> -I/opt/project-neon5/include/QtNetwork
> -I/opt/project-neon5/include/KF5/KCompletion
> -I/opt/project-neon5/include/KF5/KWidgetsAddons
> -I/opt/project-neon5/include/KF5/KXmlGui
> -I/opt/project-neon5/include/QtDBus -I/opt/project-neon5/include/QtXml
> -isystem /opt/project-neon5/include/KF5/KConfigWidgets
> -I/opt/project-neon5/include/KF5/KCodecs
> -I/opt/project-neon5/include/KF5/KConfigGui
> -I/opt/project-neon5/include/KF5/KAuth
> -I/opt/project-neon5/include/KF5/KTextWidgets
> -I/opt/project-neon5/include/KF5/SonnetUi
> -I/opt/project-neon5/include/KF5/KI18n -isystem
> /opt/project-neon5/include/KF5/KItemModels -isystem
> /opt/project-neon5/include/KF5/ThreadWeaver -fexceptions
> -UQT_NO_EXCEPTIONS -o CMakeFiles/kdevclassbrowser.dir/classmodel.cpp.o -c
> /home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/plugins/classbr
> owser/classmodel.cpp In file included from
> /home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/plugins/classbr
> owser/classmodel.cpp:25: In file included from
> /home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/plugins/classbr
> owser/allclassesfolder.h:25: In file included from
> /home/bertin/work/src/Scratch/KDE/kdevelop/kdevplatform-git/plugins/classbr
> owser/documentclassesfolder.h:26: In file included from
> /usr/include/boost/multi_index_container.hpp:18: In file included from
> /usr/include/boost/config.hpp:40:
> In file included from /usr/include/boost/config/select_stdlib_config.hpp:18:
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/cstdde
> f:51:11: error: no member named 'max_align_t' in the global namespace
> using ::max_align_t;
> ~~^
> 1 error generated.
>
> This happens in:
> make[2]: ***
> [plugins/classbrowser/CMakeFiles/kdevclassbrowser.dir/classmodel.cpp.o]
> Error 1 make[2]: ***
> [plugins/classbrowser/CMakeFiles/kdevclassbrowser.dir/documentclassesfolder
> .cpp.o] Error 1 make[2]: ***
> [plugins/classbrowser/CMakeFiles/kdevclassbrowser.dir/projectfolder.cpp.o]
> Error 1 make[2]: ***
> [plugins/classbrowser/CMakeFiles/kdevclassbrowser.dir/allclassesfolder.cpp.
> o] Error 1 make[2]: ***
> [plugins/classbrowser/CMakeFiles/kdevclassbrowser.dir/kdevclassbrowser_auto
> moc.cpp.o] Error 1
>
> I do NOT get that error when I have Ubuntu's standard gcc-4.8 installed or
> (IIRC, not sure though) with clang-3.4 . Using -std=c++11 instead of
> -std=c++0x doesn't make a difference. Checking classmodel.cpp, it builds
> fine when I replace the compiler with g++ and suppress -fvectorize .
>
> Search for max_align_t in /usr/include, I see
>
> #if (defined(__GXX_EXPERIMENTAL_CXX0X__) && VC_GCC >= 0x40600) ||
> __cplusplus >= 201103 # define VC_CXX11 1
> # ifdef VC_GCC
> # if VC_GCC >= 0x40700 // && VC_GCC < 0x408000)
> // ::max_align_t was introduced with GCC 4.7. std::max_align_t took a
> bit longer. # define VC_HAVE_MAX_ALIGN_T 1
> # endif
> # elif !defined(VC_CLANG)
> // Clang doesn't provide max_align_t at all
> # define VC_HAVE_STD_MAX_ALIGN_T 1
> # endif
> #endif
>
> which suggests the error lies with boost. I'd almost say with gcc, but one
> can hardly reproach it for causing errors when other compilers use its
> include files ...
>
> Suggestions?
>
> Thanks,
> René
This seems to be a general issue with Clang when using GCC 4.9's cstddef:
https://bugzilla.redhat.com/show_bug.cgi?id=1120995
According to this bug this should be fixed in clang-3.5, by this commit:
http://reviews.llvm.org/rL201729
Works fine for me (Ubuntu 14.10):
% cat example.cpp
#include <boost/format.hpp>
int main(int argc, char** argv)
{
auto s = boost::format("");
return 0;
}
% clang++-3.4 -std=c++11 example.cpp
% clang++-3.5 -std=c++11 example.cpp
%
And yes, using GCC 4.9's stdlib:
% clang++-3.5 -std=c++11 -E example.cpp | grep cstddef
# 1 "/usr/bin/../lib/gcc/x86_64-linux-
gnu/4.9/../../../../include/c++/4.9/cstddef" 1 3 4
# 43 "/usr/bin/../lib/gcc/x86_64-linux-
gnu/4.9/../../../../include/c++/4.9/cstddef" 3
# 46 "/usr/bin/../lib/gcc/x86_64-linux-
gnu/4.9/../../../../include/c++/4.9/cstddef" 2 3
% clang++-3.4 -std=c++11 -E example.cpp | grep cstddef
# 1 "/usr/bin/../lib/gcc/x86_64-linux-
gnu/4.9/../../../../include/c++/4.9/cstddef" 1 3 4
# 43 "/usr/bin/../lib/gcc/x86_64-linux-
gnu/4.9/../../../../include/c++/4.9/cstddef" 3
# 46 "/usr/bin/../lib/gcc/x86_64-linux-
gnu/4.9/../../../../include/c++/4.9/cstddef" 2 3
Note: The header containing VC_HAVE_STD_MAX_ALIGN_T seems unrelated. I don't
even have that one installed. (comes from libvc-dev).
Cheers
--
Kevin Funk | kfunk at kde.org | http://kfunk.org
More information about the KDevelop
mailing list