Bug 121131 - Compiler plugins won't build with Ubuntu 18.04
Summary: Compiler plugins won't build with Ubuntu 18.04
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.2.0.0.alpha1+
Hardware: All All
: medium normal
Assignee: Stephan Bergmann
URL:
Whiteboard: target:6.2.0 target:6.1.4
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-02 16:53 UTC by Jan-Marek Glogowski
Modified: 2020-02-26 20:46 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
config (16.95 KB, application/zip)
2020-02-26 20:35 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan-Marek Glogowski 2018-11-02 16:53:29 UTC
Running ./configure with 'CC=clang-6.0 CXX=clang++-6.0 CLANGDIR=/usr/lib/llvm-6.0 QT5DIR=/usr/lib/x86_64-linux-gnu/qt5 COMPILER_PLUGINS_CXX=g++ -std=c++11 --disable-online-update --enable-ccache --enable-compiler-plugins --enable-dbgutil --enable-epm --enable-evolution2 --enable-extension-integration --enable-ext-nlpsolver --enable-ext-wiki-publisher --enable-gdb-index --enable-gtk3-kde5 --enable-kde4 --enable-ld=lld --enable-odk --enable-python=system --enable-qt5 --enable-release-build --enable-symbols --enable-werror --with-external-tar=/home/glg/Development/libreoffice/tarballs --with-java --with-junit --with-lang=de --with-myspell-dicts --without-doxygen --with-system-curl --with-system-expat --with-system-jpeg --with-system-libpng --with-system-libxml --with-system-openldap --with-system-sane --with-system-zlib --with-vendor=it@M Landeshauptstadt München --srcdir=/home/glg/Development/libreoffice/dbgutil-clang --enable-option-checking=fatal'
********************************************************************
*
*   Running LibreOffice build configuration.
*
********************************************************************

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for product name... LibreOffice
checking for package version... 6.2.0.0.alpha1+
checking for product version... 6.2
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for grep... (cached) /bin/grep
checking for GNU Make... /usr/bin/make
checking for sed... /bin/sed
checking whether to use link-time optimization... no
checking for gcc... clang-6.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang-6.0 accepts -g... yes
checking for clang-6.0 option to accept ISO C89... none needed
checking how to run the C preprocessor... clang-6.0 -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking for explicit AFLAGS... no
checking for explicit CFLAGS... -g -O2
checking for explicit CXXFLAGS... no
checking for explicit OBJCFLAGS... no
checking for explicit OBJCXXFLAGS... no
checking for explicit LDFLAGS... no
checking for gcc... (cached) clang-6.0
checking whether we are using the GNU C compiler... (cached) yes
checking whether clang-6.0 accepts -g... (cached) yes
checking for clang-6.0 option to accept ISO C89... (cached) none needed
checking for library containing dlsym... -ldl
checking whether build target is Release Build... yes
checking whether to sign windows build... no
checking for gawk... no
checking for mawk... mawk
checking for mawk... /usr/bin/mawk
checking for bash... /bin/bash
checking for en_US.utf8 locale... present
checking for GNU or BSD tar... tar
checking for tar's option to strip components... --strip-components
checking how to build and package galleries... internal src images for desktop
checking for ccache... /usr/bin/ccache
checking gcc home... /usr
checking for clang-6.0... /usr/bin/clang-6.0
checking whether to build with Java support... yes
checking whether to treat the installation as read-only... no
checking for -fuse-ld=lld linker support... yes 
checking whether clang-6.0 supports -ggnu-pubnames... yes 
checking whether clang-6.0 supports -Wl,--gdb-index... yes 
checking for -Bsymbolic-functions linker support... found 
checking for -isystem ... yes
checking whether the compiler is actually Clang... yes
checking the Clang version... Clang "6.0.0 (tags/RELEASE_600/final)", 60000
checking whether clang-6.0 is already ccached... no
checking whether /usr/bin/ccache clang-6.0 supports -ggdb2... yes
checking whether /usr/bin/ccache clang-6.0 supports -finline-limit=0... no
checking whether /usr/bin/ccache clang-6.0 supports -fno-inline... yes
checking whether to build with additional debug utilities... yes
checking whether to do a debug build... yes (dbgutil)
checking whether to use selective debuginfo... no, for all
checking whether to generate debug information... yes
checking whether to compile with optimization flags... no
checking which package format to use... none
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking whether to turn warnings to errors... yes
checking whether to have assert() failures abort even without --enable-debug... yes
checking whether to use ooenv for the instdir installation... yes
checking whether to enable CUPS support... yes
checking whether cups support is present... checking for cupsPrintFiles in -lcups... yes
checking cups/cups.h usability... yes
checking cups/cups.h presence... yes
checking for cups/cups.h... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for FONTCONFIG... yes
checking whether we want to fetch tarballs... yes, if we use them
checking whether to build help... no
checking whether to include MySpell dictionaries... yes
checking whether to use dicts from external paths... yes
checking for spelling dictionary directory... file:///usr/share/hunspell
checking for hyphenation patterns directory... file:///usr/share/hyphen
checking for thesaurus directory... file:///usr/share/mythes
checking whether to enable pch feature... no
checking the GNU Make version... /usr/bin/make 4.1
checking whether GNU Make supports the 'file' function... yes
checking for --hash-style gcc linker support... gnu 
checking for perl... /usr/bin/perl
checking the Perl version... Perl 5
checking for required Perl modules... all modules found
checking for pkg-config... (cached) /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for ar... ar
checking for nm... nm
checking for ranlib... ranlib
checking for objdump... objdump
checking for readelf... readelf
checking for strip... strip
checking for ANSI C header files... (cached) yes
checking whether we are using the GNU C++ compiler... yes
checking whether clang++-6.0 accepts -g... yes
checking the GNU C++ compiler version... checked (g++ 4.2.1)
checking how to run the C++ preprocessor... clang++-6.0 -E
checking whether clang++-6.0 is broken with boost.thread... yes
checking whether clang++-6.0 is already ccached... no
checking how to run the C++ preprocessor... clang++-6.0 -E
checking how to run the C preprocessor... clang-6.0 -E
checking size of long... 8
checking size of short... 2
checking size of int... 4
checking size of long long... 8
checking size of double... 8
checking size of void*... 8
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 8
checking alignment of double... 8
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether to enable runtime optimizations... yes
checking valgrind/valgrind.h usability... yes
checking valgrind/valgrind.h presence... yes
checking for valgrind/valgrind.h... yes
checking sys/sdt.h usability... no
checking sys/sdt.h presence... no
checking for sys/sdt.h... no
checking whether /usr/bin/ccache clang-6.0 supports -mno-avx... yes
checking whether /usr/bin/ccache clang-6.0 supports -fstack-protector-strong... yes
checking whether /usr/bin/ccache clang-6.0 supports atomic functions... yes
checking whether /usr/bin/ccache clang-6.0 supports __builtin_ffs... yes
checking whether /usr/bin/ccache clang-6.0 supports __attribute__((deprecated(message)))... yes
checking whether /usr/bin/ccache clang++-6.0 defines __base_class_type_info in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 defines __class_type_info in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 declares __cxa_allocate_exception in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 defines __cxa_eh_globals in cxxabi.h... no
checking whether /usr/bin/ccache clang++-6.0 defines __cxa_exceptions in cxxabi.h... no
checking whether /usr/bin/ccache clang++-6.0 declares __cxa_get_globals in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 declares __cxa_current_exception_type in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 declares __cxa_throw in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 defines __si_class_type_info in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 defines __vmi_class_type_info in cxxabi.h... yes
checking whether /usr/bin/ccache clang++-6.0 supports __attribute__((warn_unused))... yes
checking what the C++ library is... GNU libstdc++
checking for gperf... /usr/bin/gperf
checking gperf version... OK
checking which libcmis to use... internal
checking whether /usr/bin/ccache clang++-6.0 supports C++17, C++14, or C++11... yes (-std=gnu++2a)
checking whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage... no
checking whether /usr/bin/ccache clang++-6.0 supports C++11 without Language Defect 757... yes
checking whether /usr/bin/ccache clang++-6.0 supports C++14 constexpr... yes
checking whether /usr/bin/ccache clang++-6.0 supports _Pragma operator... yes
checking whether /usr/bin/ccache clang++-6.0 supports -fno-sized-deallocation... yes
checking whether /usr/bin/ccache clang++-6.0 supports [[fallthrough]]... yes
checking whether /usr/bin/ccache clang++-6.0 supports [[nodiscard]]... yes
checking whether /usr/bin/ccache clang++-6.0 supports guaranteed copy elision... yes
checking whether /usr/bin/ccache clang++-6.0 has a fix for CWG1579... yes
checking whether /usr/bin/ccache clang++-6.0 has GCC bug 87150... no
checking if STL headers are visibility safe (GCC bug 22482)... yes
checking if gcc is -fvisibility-inlines-hidden safe (Clang bug 11250)... yes
checking if gcc has a visibility bug with class-level attributes (GCC bug 26905)... no
checking whether /usr/bin/ccache clang++-6.0 supports -fno-default-inline... no
checking whether /usr/bin/ccache clang++-6.0 supports -fno-enforce-eh-specs... no
checking clang/AST/RecursiveASTVisitor.h usability... no
checking clang/AST/RecursiveASTVisitor.h presence... yes
configure: WARNING: clang/AST/RecursiveASTVisitor.h: present but cannot be compiled
configure: WARNING: clang/AST/RecursiveASTVisitor.h:     check for missing prerequisite headers?
configure: WARNING: clang/AST/RecursiveASTVisitor.h: see the Autoconf documentation
configure: WARNING: clang/AST/RecursiveASTVisitor.h:     section "Present But Cannot Be Compiled"
configure: WARNING: clang/AST/RecursiveASTVisitor.h: proceeding with the compiler's result
checking for clang/AST/RecursiveASTVisitor.h... no
configure: error: Cannot find Clang headers to build compiler plugins.
Error running configure at ./autogen.sh line 296.

Removing COMPILER_PLUGINS_CXX doesn't help.

Reverting

commit cd472d1d8489f30797f47d3f6dafede28c1feb90
Author: Stephan Bergmann <sbergman@redhat.com>
Date:   Thu Nov 1 17:07:57 2018 +0100

    Compile as C++2a, where available

fixes it.

But the real problem is

commit ab8bf5533f8de9bb1aa9dc83e650e4eccf0fcac3
Author: Luboš Luňák <l.lunak@collabora.com>
Date:   Fri Apr 13 11:20:08 2018 +0200

    avoid error message from configure about clang's header for compiler plugins

diff --git a/configure.ac b/configure.ac
index f21424e15810..bdc374699cb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6568,7 +6568,7 @@ if test "$COM_IS_CLANG" = "TRUE"; then
         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
         : "${COMPILER_PLUGINS_CXX=g++}"
         CXX=$COMPILER_PLUGINS_CXX
-        CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
+        CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11 -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
             [COMPILER_PLUGINS=TRUE],
             [

which added the $CXXFLAGS_CXX11 flags of the LO compiler (clang) to the "compiler plugin"-compiler options (g++).

From config.log:

configure:19309: checking clang/AST/RecursiveASTVisitor.h usability
configure:19309: g++ -std=c++11 -c   -std=gnu++2a -I/usr/lib/llvm-6.0/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS conftest.cpp >&5
g++: error: unrecognized command line option '-std=gnu++2a'; did you mean '-std=gnu++03'?
configure:19309: $? = 1
Comment 1 Stephan Bergmann 2018-11-05 08:28:37 UTC
So <https://cgit.freedesktop.org/libreoffice/core/commit/?id=ab8bf5533f8de9bb1aa9dc83e650e4eccf0fcac3> "avoid error message from configure about clang's header for compiler plugins" breaks again what had been fixed with <https://cgit.freedesktop.org/libreoffice/core/commit/?id=e754d0931ca75403647cc16100edd98e7e5ceadb> "Remove CXXFLAGS_CXX11 from Clang plugin compilation".  My suggestion would be to revert ab8bf5533f8de9bb1aa9dc83e650e4eccf0fcac3 again and have users solve that commit's issue instead by using COMPILER_PLUGINS_CXX (introduced as part of e754d0931ca75403647cc16100edd98e7e5ceadb).  Thoughts, Luboš?
Comment 2 Stephan Bergmann 2018-11-07 09:54:26 UTC
[setting to NEW, confirmed by Miklos on IRC]

(In reply to Stephan Bergmann from comment #1)
> My suggestion would be to revert
> ab8bf5533f8de9bb1aa9dc83e650e4eccf0fcac3 again and have users solve that
> commit's issue instead by using COMPILER_PLUGINS_CXX (introduced as part of
> e754d0931ca75403647cc16100edd98e7e5ceadb).

<https://gerrit.libreoffice.org/#/c/62997/> "tdf#121131: Revert 'avoid error message from configure about clang's header..."
Comment 3 Commit Notification 2018-11-08 12:38:00 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/4613e105f98af6e3b65ce87432b1a2db45e71ae2%5E%21

tdf#121131: Default COMPILER_PLUGINS_CXX to g++ -std=c++11

It will be available in 6.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2018-11-21 21:27:15 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

https://git.libreoffice.org/core/+/b73450caef299d38350f446d914f45b7c23a25b7%5E%21

tdf#121131: Default COMPILER_PLUGINS_CXX to g++ -std=c++11

It will be available in 6.1.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Regis Perdreau 2019-10-13 20:42:24 UTC
Still have this message 

CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
Calc: threaded

clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

what to do ?

Régis
Comment 6 Stephan Bergmann 2019-10-14 08:25:51 UTC
(In reply to Regis Perdreau from comment #5)
> Still have this message 
> 
> CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
> Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
> Calc: threaded
> 
> clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
> Target: x86_64-pc-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin

What version of LO, what configure switches, what does the relevant part of config.log look like (if you can't identify it, just attach the full config.log)?
Comment 7 Julien Nabet 2020-02-26 20:35:29 UTC
Created attachment 158213 [details]
config

Sorry to add some comment on a FIXED bug but on pc Debian x86-64 with master sources updated today, I tried to build with clang and enable clang plugins.

I installed "clang" + libclang-9-dev
I attached a zip which contains autogen.input + config.log
Comment 8 Julien Nabet 2020-02-26 20:46:53 UTC
(In reply to Julien Nabet from comment #7)
> Created attachment 158213 [details]
> config
> 
> Sorry to add some comment on a FIXED bug but on pc Debian x86-64 with master
> sources updated today, I tried to build with clang and enable clang plugins.
> 
> I installed "clang" + libclang-9-dev
> I attached a zip which contains autogen.input + config.log

Found it, I had just to install "llvm" package. Sorry for the noise.