Bug 402566

Summary: krita fails to build against >=exiv2-0.27
Product: [Applications] krita Reporter: Andreas Sturmlechner <asturm>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 4.2.0
Sentry Crash Report:
Attachments: cmake.patch
build.log

Description Andreas Sturmlechner 2018-12-25 21:10:53 UTC
Created attachment 117108 [details]
cmake.patch

Using the attached patch to fix detecting the new version fails later during merge.
Comment 1 Andreas Sturmlechner 2018-12-25 21:14:19 UTC
Created attachment 117109 [details]
build.log

/var/tmp/portage/media-gfx/krita-4.1.7/work/krita-4.1.7.101/libs/ui/kisexiv2/kis_xmp_io.cpp:284:75: error: ‘std::vector<std::__cxx11::basic_string<char> > Exiv2::XmpArrayValue::value_’ is private within this context
                 for (std::vector< std::string >::const_iterator it = xav->value_.begin();
                                                                           ^~~~~~
In file included from /usr/include/exiv2/metadatum.hpp:37,
                 from /usr/include/exiv2/datasets.hpp:32,
                 from /usr/include/exiv2/exiv2.hpp:33,
                 from /var/tmp/portage/media-gfx/krita-4.1.7/work/krita-4.1.7.101/libs/ui/kisexiv2/kis_exiv2.h:24,
                 from /var/tmp/portage/media-gfx/krita-4.1.7/work/krita-4.1.7.101/libs/ui/kisexiv2/kis_xmp_io.cpp:20:
/usr/include/exiv2/value.hpp:861:34: note: declared private here
         std::vector<std::string> value_;        //!< Stores the string values.
                                  ^~~~~~
/var/tmp/portage/media-gfx/krita-4.1.7/work/krita-4.1.7.101/libs/ui/kisexiv2/kis_xmp_io.cpp:285:36: error: ‘std::vector<std::__cxx11::basic_string<char> > Exiv2::XmpArrayValue::value_’ is private within this context
                         it != xav->value_.end(); ++it) {
                                    ^~~~~~
Comment 3 Halla Rempt 2018-12-26 11:33:00 UTC
This change fixes the use of the private api:

@@ -277,15 +281,15 @@ bool KisXMPIO::loadFrom(KisMetaData::Store* store, QIODevice* ioDevice) const
                 const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get());
                 Q_ASSERT(xav);
                 QList<KisMetaData::Value> array;
-                for (std::vector< std::string >::const_iterator it = xav->value_.begin();
-                        it != xav->value_.end(); ++it) {
-                    QString value = it->c_str();
+                for (int i = 0; i == xav->size(); ++i) {
+                    QString value = QString::fromStdString(xav->toString(i));
                     if (parser) {
                         array.push_back(parser->parse(value));
                     } else {
                         dbgImage << "No parser " << tagName;
                         array.push_back(KisMetaData::Value(value));
                     }
+
                 }
                 KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid;
                 switch (xav->xmpArrayType()) {
~


The only thing I wonder about is the removal of FindExiv2.cmake and then this change:


    -target_link_libraries(kritajpegimport kritaui  ${JPEG_LIBRARIES} ${LCMS2_LIBRARIES} ${EXIV2_LIBRARIES} )
    +target_link_libraries(kritajpegimport kritaui  ${JPEG_LIBRARIES} ${LCMS2_LIBRARIES} LibExiv2::LibExiv2 )


Is that really what we want?
Comment 4 Halla Rempt 2019-01-01 12:17:09 UTC
Git commit 06dfa759f4dd2d3918bb12ebb2155b00b811b60f by Boudewijn Rempt, on behalf of Andreas Sturmlechner.
Committed on 01/01/2019 at 12:11.
Pushed by rempt into branch 'krita/4.1'.

Fix building against exiv2-0.27

Summary:
Copied FindLibExiv2.cmake from ECM 5.53.0 until we raise min version.

Thanks-to: Boudewijn Rempt <boud@valdyas.org>
for final fix to kis_xmp_io.cpp.

Test Plan: Built fine against exiv2-0.26 and exiv2-0.27.

Reviewers: #krita, rempt

Reviewed By: #krita, rempt

Subscribers: pino

Tags: #krita

Differential Revision: https://phabricator.kde.org/D17810

M  +1    -5    CMakeLists.txt
D  +0    -80   cmake/modules/FindExiv2.cmake
A  +115  -0    cmake/modules/FindLibExiv2.cmake
M  +1    -2    libs/ui/CMakeLists.txt
M  +6    -8    libs/ui/kisexiv2/kis_exif_io.cpp
M  +2    -1    libs/ui/kisexiv2/kis_exiv2.h
M  +2    -2    libs/ui/kisexiv2/kis_iptc_io.cpp
M  +2    -4    libs/ui/kisexiv2/kis_xmp_io.cpp
M  +2    -3    plugins/impex/jpeg/CMakeLists.txt

https://commits.kde.org/krita/06dfa759f4dd2d3918bb12ebb2155b00b811b60f