Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890324 - app-office/libreoffice[clang] fails to build after upgrade to media-libs/zxing-cpp-2.0.0
Summary: app-office/libreoffice[clang] fails to build after upgrade to media-libs/zxin...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Office Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-10 07:12 UTC by Marius Stoica
Modified: 2023-01-30 22:57 UTC (History)
12 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,25.05 KB, text/x-log)
2023-01-10 07:13 UTC, Marius Stoica
Details
emerge --info (emerge.info,19.88 KB, text/plain)
2023-01-10 07:13 UTC, Marius Stoica
Details
config.log (config.log,158.87 KB, text/x-log)
2023-01-10 07:13 UTC, Marius Stoica
Details
ebuild.patch (ebuild.patch,465 bytes, patch)
2023-01-11 15:54 UTC, nvinson234
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Stoica 2023-01-10 07:12:29 UTC
After the upgrade to media-libs/zxing-cpp-2.0.0 libreoffice is picked by @preserved-rebuild as needing rebuild, but it fails to emerge


letto@localhost: ~ $ sudo emerge -av @preserved-rebuild 

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-office/libreoffice-7.4.3.2::gentoo  USE="branding clang dbus kde mariadb pdfimport vulkan -accessibility -base -bluetooth -coinmp -cups -custom-cflags -debug -eds -firebird -googledrive -gstreamer -gtk -java -ldap -odk -postgres -test" LIBREOFFICE_EXTENSIONS="-nlpsolver -scripting-beanshell -scripting-javascript -wiki-publisher" PYTHON_SINGLE_TARGET="python3_10 -python3_8 -python3_9 -python3_11" 0 KiB
...

configure: error: zxing headers not found.


Reproducible: Always
Comment 1 Marius Stoica 2023-01-10 07:13:24 UTC
Created attachment 848048 [details]
build.log
Comment 2 Marius Stoica 2023-01-10 07:13:39 UTC
Created attachment 848050 [details]
emerge --info
Comment 3 Marius Stoica 2023-01-10 07:13:59 UTC
Created attachment 848052 [details]
config.log
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-10 07:19:51 UTC
commit 05c841fbf1f173837c1078ebf9b1ae076317413f
Author: Andreas Sturmlechner <asturm@gentoo.org>
Date:   Mon Jan 9 22:09:42 2023 +0100

    app-office/libreoffice: backport patch for >=zxing-cpp-1.4.0

    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

I guess this wasn't enough for you.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-10 07:19:57 UTC
From config.log:
```
configure:38268: checking which libzxing to use
configure:38271: result: external
configure:38290: checking for MultiFormatWriter.h
configure:38290: x86_64-pc-linux-gnu-clang++ -c -march=x86-64 -O2 -pipe -I/usr/include/ZXing   conftest.cpp >&5
In file included from conftest.cpp:129:
In file included from /usr/include/ZXing/MultiFormatWriter.h:8:
In file included from /usr/include/ZXing/BarcodeFormat.h:9:
In file included from /usr/include/ZXing/Flags.h:8:
/usr/include/ZXing/BitHacks.h:17:16: warning: nested namespace definition is a C++17 extension; define each namespace separately [-Wc++17-extensions]
namespace ZXing::BitHacks {
               ^~~~~~~~~~
                { namespace BitHacks
In file included from conftest.cpp:129:
In file included from /usr/include/ZXing/MultiFormatWriter.h:8:
/usr/include/ZXing/BarcodeFormat.h:59:56: error: use of undeclared identifier 'str'; did you mean 'std'?
BarcodeFormat BarcodeFormatFromString(std::string_view str);
                                                       ^~~
                                                       std
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/streambuf_iterator.h:38:11: note: 'std' declared here
namespace std _GLIBCXX_VISIBILITY(default)
          ^
In file included from conftest.cpp:129:
In file included from /usr/include/ZXing/MultiFormatWriter.h:8:
/usr/include/ZXing/BarcodeFormat.h:59:56: error: expected ')'
BarcodeFormat BarcodeFormatFromString(std::string_view str);
                                                       ^
/usr/include/ZXing/BarcodeFormat.h:59:38: note: to match this '('
BarcodeFormat BarcodeFormatFromString(std::string_view str);
                                     ^
/usr/include/ZXing/BarcodeFormat.h:59:44: error: no member named 'string_view' in namespace 'std'
BarcodeFormat BarcodeFormatFromString(std::string_view str);
                                      ~~~~~^
/usr/include/ZXing/BarcodeFormat.h:68:58: error: use of undeclared identifier 'str'; did you mean 'std'?
BarcodeFormats BarcodeFormatsFromString(std::string_view str);
                                                         ^~~
                                                         std
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/streambuf_iterator.h:38:11: note: 'std' declared here
namespace std _GLIBCXX_VISIBILITY(default)
          ^
In file included from conftest.cpp:129:
In file included from /usr/include/ZXing/MultiFormatWriter.h:8:
/usr/include/ZXing/BarcodeFormat.h:68:58: error: expected ')'
BarcodeFormats BarcodeFormatsFromString(std::string_view str);
                                                         ^
/usr/include/ZXing/BarcodeFormat.h:68:40: note: to match this '('
BarcodeFormats BarcodeFormatsFromString(std::string_view str);
                                       ^
/usr/include/ZXing/BarcodeFormat.h:68:46: error: no member named 'string_view' in namespace 'std'
BarcodeFormats BarcodeFormatsFromString(std::string_view str);
                                        ~~~~~^
In file included from conftest.cpp:129:
In file included from /usr/include/ZXing/MultiFormatWriter.h:9:
/usr/include/ZXing/CharacterSet.h:56:42: error: no type named 'string_view' in namespace 'std'
CharacterSet CharacterSetFromString(std::string_view name);
                                    ~~~~~^
1 warning and 7 errors generated.
configure:38290: $? = 1
```
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-10 07:24:49 UTC
Is this just a missing <string_view> include in the header?
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-10 07:25:46 UTC
(In reply to Sam James from comment #6)
> Is this just a missing <string_view> include in the header?

no, nevermind, it's there
Comment 8 Marius Stoica 2023-01-10 08:02:23 UTC
It seems to rather be an issue with compiler settings. This is the first error that appears:

> warning: nested namespace definition is a C++17 extension; define each
> namespace separately [-Wc++17-extensions]
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-10 08:27:10 UTC
I would've assumed if it identified it as an extension, it would've errored out if it wasn't going to allow it anyway, but that might be a bad assumption.
Comment 10 Holger Hoffstätte 2023-01-10 08:38:25 UTC
Building zxing-2.0.0 works fine when configured like this:
'cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'

This automatically adds -std=c++17 which seems to be missing from LO's conftest and therefore goes splat.
Comment 11 Holger Hoffstätte 2023-01-10 09:17:36 UTC
The reason it seems to work with gcc but not clang-15 is that gcc (>=11) defaults to std=c++17 whereas clang-15 still defaults to std=c++14 (clang-16 will default to std=c++17 as well). We might So LO's conftests will have to explicitly configure with std=c++17.
Comment 12 Sven Eden 2023-01-10 10:00:16 UTC
So I put this into /etc/portage/env/force_cpp17.conf:

=========
## CFLAGS:
CFLAGS="-march=native -pipe -ggdb -O2 -ftree-vectorize"
CXXFLAGS="-std=c++17 ${CFLAGS}"
CFLAGS="-std=c18 ${CFLAGS}"
LDFLAGS="${LDFLAGS} ${CFLAGS}"

========

And added "media-libs/zxing-cpp force_cpp17.conf" to /etc/portage/package.env/gentoo.env.

I checked the zxing-2.0.0 build log (after a re-merge, of course) and the "-std=c++17" is in every compiler call.

--------

ebuild /usr/portage/app-office/libreoffice/libreoffice-7.4.3.2.ebuild clean configure

still ended in:

configure: error: zxing headers not found.
Comment 13 Sven Eden 2023-01-10 10:05:33 UTC
(In reply to Sven Eden from comment #12)
> configure: error: zxing headers not found.

To make this clear: I use gcc-12, this issue is therefore not a clang-only thing. Upgrade zxing-cpp to 2.0.0 and libreoffice configure fails.

Maybe it works with gcc-11... 
hang on...
Nope, same result: "configure: error: zxing headers not found."
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-10 10:15:30 UTC
(In reply to Sven Eden from comment #13)
> (In reply to Sven Eden from comment #12)
> > configure: error: zxing headers not found.
> 
> To make this clear: I use gcc-12, this issue is therefore not a clang-only
> thing. Upgrade zxing-cpp to 2.0.0 and libreoffice configure fails.
> 
> Maybe it works with gcc-11... 
> hang on...
> Nope, same result: "configure: error: zxing headers not found."

Please share the build.log & config.log from *your* run. Is it with USE=clang or USE=-clang?

Also, keep in mind that you can't downgrade GCC for anything C++ anyway.
Comment 15 Holger Hoffstätte 2023-01-10 10:16:16 UTC
(In reply to Sven Eden from comment #13)
> (In reply to Sven Eden from comment #12)
> > configure: error: zxing headers not found.
> 
> To make this clear: I use gcc-12, this issue is therefore not a clang-only
> thing. Upgrade zxing-cpp to 2.0.0 and libreoffice configure fails.
> 
> Maybe it works with gcc-11... 
> hang on...
> Nope, same result: "configure: error: zxing headers not found."

Interesting, thanks for checking! This means there might be more to the issue. Let me try with gcc as well.
Comment 16 Andreas Sturmlechner gentoo-dev 2023-01-10 10:18:07 UTC
Please note that LO[-clang] w/ zxing-2.0.0 was tested successfully with latest ~arch GCC-12 by me.
Comment 17 Holger Hoffstätte 2023-01-10 10:29:07 UTC
(In reply to Holger Hoffstätte from comment #15)
> (In reply to Sven Eden from comment #13)
> > (In reply to Sven Eden from comment #12)
> > > configure: error: zxing headers not found.
> > 
> > To make this clear: I use gcc-12, this issue is therefore not a clang-only
> > thing. Upgrade zxing-cpp to 2.0.0 and libreoffice configure fails.
> > 
> > Maybe it works with gcc-11... 
> > hang on...
> > Nope, same result: "configure: error: zxing headers not found."
> 
> Interesting, thanks for checking! This means there might be more to the
> issue. Let me try with gcc as well.

After Andreas' comment I didn't try with gcc but instead also created a config to force std=c++17 (yes, with USE=clang) and the conftest still fails:

configure:38290: x86_64-pc-linux-gnu-clang++ -c -pipe -O2 -march=native -I/usr/include/ZXing   conftest.cpp >&5

So it seems simply injecting CXXFLAGS into the ebuild does not work.
The config.log says:
..
CXX='x86_64-pc-linux-gnu-clang++'
CXXCPP='x86_64-pc-linux-gnu-clang++ -E'
CXXFLAGS='-pipe -O2 -march=native'
CXXFLAGS_CXX11='-std=c++17'
..

So something is funky with clang.
Comment 18 Holger Hoffstätte 2023-01-10 10:35:17 UTC
I added -std=c++17 to /etc/clang/clang++.cfg and ..

..
checking whether to use zxing... yes
checking which libzxing to use... external
checking for MultiFormatWriter.h... yes
checking for main in -lZXing... yes
..

This is clearly the best solution :D
Comment 19 Marius Stoica 2023-01-10 10:56:58 UTC
I emerged just fine with gcc-12 (deleted clang use flag)
Comment 20 Oleksa 2023-01-10 19:46:26 UTC
Hello there!
I an affected also, but seems in a bit another way.

After release version media-libs/zxing-cpp-2.0.0 it is impossible to compile app-office/libreoffice because it falls with error:

[CXX] cui/source/options/connpoolconfig.cxx
/var/tmp/portage/app-office/libreoffice-7.5.0.1/work/libreoffice-7.5.0.1/cui/source/dialogs/QrCodeGenDialog.cxx:30:10: fatal error: BitArray.h: No such file or directory
30 | #include <BitArray.h>
| ^~~~~~~~~~~~
compilation terminated.
Comment 21 Andreas Sturmlechner gentoo-dev 2023-01-10 20:59:06 UTC
7.5.0.1 is not provided by Gentoo ebuild repository so you are wrong in this bug in the first place.

As such, this version simply does not contain that fix yet.
Comment 22 stealth 2023-01-11 02:31:12 UTC
i suspect the reason setting CXXFLAGS doesn't work is because in configure.ac there are lots of tests which saves it to a variable and is supposed to reset it back but i think somewhere in the chain it gets forgotton, when i added -std=c++17 to CXXFLAGS variable in that file directly above the test for ZXING headers it gets past the checks

this is what i did but is not a proper fix 
CXXFLAGS="$save_CXXFLAGS -std=c++17 -I$i/ZXing"
             AC_CHECK_HEADER(MultiFormatWriter.h, [ZXING_CFLAGS=-I$i/ZXing; break]
Comment 23 nvinson234 2023-01-11 15:54:51 UTC
Created attachment 848227 [details, diff]
ebuild.patch

A quick and dirty patch to the ebuild that works-around the issue.
Comment 24 Jan Psota 2023-01-12 11:37:27 UTC
As Marius suggested I successfully compiled LO using gcc-12 with USE=-clang
and noticed, that installed size grown by 6% (qsize -b):
clang compiled  365597071 bytes
gcc compiled    389798631 bytes
- just an oddity.

# app-office/libreoffice-7.4.3.2: 8842 files (8699 unique), 497 non-files, ...
Comment 25 Bernd 2023-01-13 10:48:14 UTC
Also happens for LO 7.4.4.2. The ebuild patch works for the configuration step, but compilation breaks.
Comment 26 Larry the Git Cow gentoo-dev 2023-01-13 19:08:24 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c530f3090fb695e76a9f0376c0597418523d70e4

commit c530f3090fb695e76a9f0376c0597418523d70e4
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-13 19:07:13 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-13 19:08:06 +0000

    app-office/libreoffice: fix build w/ USE=clang & clang <16
    
    Closes: https://bugs.gentoo.org/890324
    Signed-off-by: Sam James <sam@gentoo.org>

 ...libreoffice-7.4.4.2-zxing-cpp-1.4.0-c++17.patch | 36 ++++++++++++++++++++++
 app-office/libreoffice/libreoffice-7.4.4.2.ebuild  |  1 +
 2 files changed, 37 insertions(+)