NatronGitHub / openfx-arena

Extra OpenFX plugins for Natron
Other
41 stars 11 forks source link

poppler >= 21.12 require c++17 #23

Open Ahptt opened 2 years ago

Ahptt commented 2 years ago

I recently was looking to try out Natron. I run Arch Linux and simply was able to go through the AUR to obtain the natron package. I run into an error when compiling openfx-arena.

I've checked that I have all the required dependencies and was curious if there is something I'm missing or if there is an issue. Here is my output of making the file after git cloning it. Many thanks for reviewing this! (apologies on the formatting)

`git submodule update -i --recursive Submodule 'OpenFX' (https://github.com/NatronGitHub/openfx.git) registered for path 'OpenFX' Submodule 'OpenFX-IO' (https://github.com/NatronGitHub/openfx-io.git) registered for path 'OpenFX-IO' Submodule 'SupportExt' (https://github.com/NatronGitHub/openfx-supportext.git) registered for path 'SupportExt' Submodule 'lodepng' (https://github.com/lvandeve/lodepng) registered for path 'lodepng' Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX'... error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly before end of the underlying stream error: 4760 bytes of body are still expected fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: fetch-pack: invalid index-pack output fatal: clone of 'https://github.com/NatronGitHub/openfx.git' into submodule path '/home/ahpt/Documents/Git/openfx-arena/OpenFX' failed Failed to clone 'OpenFX'. Retry scheduled Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO'... fatal: unable to access 'https://github.com/NatronGitHub/openfx-io.git/': Failed to connect to github.com port 443 after 129284 ms: Connection timed out fatal: clone of 'https://github.com/NatronGitHub/openfx-io.git' into submodule path '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO' failed Failed to clone 'OpenFX-IO'. Retry scheduled Cloning into '/home/ahpt/Documents/Git/openfx-arena/SupportExt'... Cloning into '/home/ahpt/Documents/Git/openfx-arena/lodepng'... Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX'... Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO'... Submodule path 'OpenFX': checked out 'd5db5d0483faab6a85c104b436f7460897a90aa8' Submodule path 'OpenFX-IO': checked out 'c6ad47bc4e2f812ebeb9ce7c4a759d2546e2a382' Submodule 'IOSupport/SequenceParsing' (https://github.com/NatronGitHub/SequenceParsing) registered for path 'OpenFX-IO/IOSupport/SequenceParsing' Submodule 'SupportExt' (https://github.com/NatronGitHub/openfx-supportext.git) registered for path 'OpenFX-IO/SupportExt' Submodule 'openfx' (https://github.com/NatronGitHub/openfx.git) registered for path 'OpenFX-IO/openfx' Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO/IOSupport/SequenceParsing'... Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO/SupportExt'... Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO/openfx'... Submodule path 'OpenFX-IO/IOSupport/SequenceParsing': checked out '103c528347ebb2dd0ff5d79b5cee24bbcf938ce0' Submodule 'tinydir' (https://github.com/NatronGitHub/tinydir) registered for path 'OpenFX-IO/IOSupport/SequenceParsing/tinydir' Cloning into '/home/ahpt/Documents/Git/openfx-arena/OpenFX-IO/IOSupport/SequenceParsing/tinydir'... Submodule path 'OpenFX-IO/IOSupport/SequenceParsing/tinydir': checked out '64fb1d4376d7580aa1013fdbacddbbeba67bb085' Submodule path 'OpenFX-IO/SupportExt': checked out '79d8c229400d4aa76a97d689428aa96c0ccecab0' Submodule path 'OpenFX-IO/openfx': checked out 'd5db5d0483faab6a85c104b436f7460897a90aa8' Submodule path 'SupportExt': checked out '79d8c229400d4aa76a97d689428aa96c0ccecab0' Submodule path 'lodepng': checked out '5601b8272a6850b7c5d693dd0c0e16da50be8d8d' Submodule path 'OpenFX': checked out 'd5db5d0483faab6a85c104b436f7460897a90aa8' Submodule path 'OpenFX-IO': checked out 'c6ad47bc4e2f812ebeb9ce7c4a759d2546e2a382'

openfx-arena on  master via △ v3.23.2 took 2m49s ❯ make CONFIG=release (cd Bundle && make) make[1]: Entering directory '/home/ahpt/Documents/Git/openfx-arena/Bundle' CXX Linux-64-release/lodepng.o CXX Linux-64-release/RichText.o CXX Linux-64-release/TextOFX.o CXX Linux-64-release/ReadCDR.o ../Extra/ReadCDR.cpp: In member function ‘virtual void {anonymous}::ReadCDRPlugin::decode(const std::string&, OfxTime, int, bool, const OfxRectI&, const OfxPointD&, float, const OfxRectI&, OFX::PixelComponentEnum, int, int)’: ../Extra/ReadCDR.cpp:155:31: warning: ‘void rsvg_handle_get_dimensions(RsvgHandle, RsvgDimensionData)’ is deprecated: Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead [-Wdeprecated-declarations] 155 | rsvg_handle_get_dimensions(handle, &dimension); | ~~~~~~^~~~~~~~ In file included from ../Extra/ReadCDR.cpp:21: /usr/include/librsvg-2.0/librsvg/rsvg.h:706:6: note: declared here 706 | void rsvg_handle_get_dimensions (RsvgHandle handle, RsvgDimensionData dimension_data); | ^~~~~~ ../Extra/ReadCDR.cpp:184:29: warning: ‘gboolean rsvg_handle_render_cairo(RsvgHandle, cairo_t)’ is deprecated: Use 'rsvg_handle_render_document' instead [-Wdeprecated-declarations] 184 | rsvg_handle_render_cairo(handle, cr); | ~~~~~~^~~~~~ In file included from /usr/include/librsvg-2.0/librsvg/rsvg.h:1450: /usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:88:10: note: declared here 88 | gboolean rsvg_handle_render_cairo (RsvgHandle handle, cairo_t cr); | ^~~~~~~~ ../Extra/ReadCDR.cpp: In member function ‘virtual bool {anonymous}::ReadCDRPlugin::getFrameBounds(const std::string&, OfxTime, int, OfxRectI, OfxRectI, double, std::string, int, int)’: ../Extra/ReadCDR.cpp:275:31: warning: ‘void rsvg_handle_get_dimensions(RsvgHandle, RsvgDimensionData)’ is deprecated: Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead [-Wdeprecated-declarations] 275 | rsvg_handle_get_dimensions(handle, &dimension); | ~~~~~~^~~~~~~~ /usr/include/librsvg-2.0/librsvg/rsvg.h:706:6: note: declared here 706 | void rsvg_handle_get_dimensions (RsvgHandle handle, RsvgDimensionData dimension_data); | ^~~~~~ CXX Linux-64-release/ReadSVG.o ../Extra/ReadSVG.cpp: In member function ‘virtual void {anonymous}::ReadSVGPlugin::decodePlane(const std::string&, OfxTime, int, bool, const OfxRectI&, const OfxPointD&, float, const OfxRectI&, OFX::PixelComponentEnum, OFX::PixelComponentEnum, int, const std::string&, int)’: ../Extra/ReadSVG.cpp:247:31: warning: ‘void rsvg_handle_get_dimensions(RsvgHandle, RsvgDimensionData)’ is deprecated: Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead [-Wdeprecated-declarations] 247 | rsvg_handle_get_dimensions(handle, &dimension); | ~~~~~~^~~~~~~~ In file included from ../Extra/ReadSVG.cpp:19: /usr/include/librsvg-2.0/librsvg/rsvg.h:706:6: note: declared here 706 | void rsvg_handle_get_dimensions (RsvgHandle handle, RsvgDimensionData dimension_data); | ^~~~~~ ../Extra/ReadSVG.cpp:277:33: warning: ‘gboolean rsvg_handle_render_cairo(RsvgHandle, cairo_t)’ is deprecated: Use 'rsvg_handle_render_document' instead [-Wdeprecated-declarations] 277 | rsvg_handle_render_cairo(handle, cr); | ~~~~~~^~~~~~ In file included from /usr/include/librsvg-2.0/librsvg/rsvg.h:1450: /usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:88:10: note: declared here 88 | gboolean rsvg_handle_render_cairo (RsvgHandle handle, cairo_t cr); | ^~~~~~~~ ../Extra/ReadSVG.cpp:282:37: warning: ‘gboolean rsvg_handle_render_cairo_sub(RsvgHandle, cairo_t, const char)’ is deprecated: Use 'rsvg_handle_render_layer' instead [-Wdeprecated-declarations] 282 | rsvg_handle_render_cairo_sub(handle, cr, layerSub.str().c_str()); | ~~~~~~^~~~~~~~~~ /usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:153:10: note: declared here 153 | gboolean rsvg_handle_render_cairo_sub (RsvgHandle handle, cairo_t cr, const char id); | ^~~~~~~~ ../Extra/ReadSVG.cpp: In member function ‘virtual bool {anonymous}::ReadSVGPlugin::getFrameBounds(const std::string&, OfxTime, int, OfxRectI, OfxRectI, double, std::string, int, int)’: ../Extra/ReadSVG.cpp:352:31: warning: ‘void rsvg_handle_get_dimensions(RsvgHandle, RsvgDimensionData)’ is deprecated: Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead [-Wdeprecated-declarations] 352 | rsvg_handle_get_dimensions(handle, &dimension); | ~~~~~~^~~~~~~~ /usr/include/librsvg-2.0/librsvg/rsvg.h:706:6: note: declared here 706 | void rsvg_handle_get_dimensions (RsvgHandle handle, RsvgDimensionData dimension_data); | ^~~~~~ CXX Linux-64-release/ReadKrita.o CXX Linux-64-release/OpenRaster.o CXX Linux-64-release/AudioCurve.o CXX Linux-64-release/ReadPDF.o In file included from /usr/include/poppler/Error.h:35, from /usr/include/poppler/GlobalParams.h:46, from ../Extra/ReadPDF.cpp:20: /usr/include/poppler/goo/GooString.h:249:33: error: ‘std::string_view’ has not been declared 249 | static bool startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ^~~ /usr/include/poppler/goo/GooString.h:249:55: error: ‘std::string_view’ has not been declared 249 | static bool startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ^~~ /usr/include/poppler/goo/GooString.h:250:31: error: ‘std::string_view’ has not been declared 250 | static bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~ /usr/include/poppler/goo/GooString.h:250:53: error: ‘std::string_view’ has not been declared 250 | static bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~ /usr/include/poppler/goo/GooString.h: In static member function ‘static bool GooString::startsWith(int, int)’: /usr/include/poppler/goo/GooString.h:249:88: error: request for member ‘size’ in ‘str’, which is of non-class type ‘int’ 249 | static bool startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ^~~~ /usr/include/poppler/goo/GooString.h:249:105: error: request for member ‘size’ in ‘prefix’, which is of non-class type ‘int’ 249 | static bool startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ^~~~ /usr/include/poppler/goo/GooString.h:249:124: error: request for member ‘compare’ in ‘str’, which is of non-class type ‘int’ 249 | static bool startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ^~~ /usr/include/poppler/goo/GooString.h:249:142: error: request for member ‘size’ in ‘prefix’, which is of non-class type ‘int’ 249 | startsWith(std::string_view str, std::string_view prefix) { return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix); } | ^~~~

/usr/include/poppler/goo/GooString.h: In static member function ‘static bool GooString::endsWith(int, int)’: /usr/include/poppler/goo/GooString.h:250:86: error: request for member ‘size’ in ‘str’, which is of non-class type ‘int’ 250 | static bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~~ /usr/include/poppler/goo/GooString.h:250:103: error: request for member ‘size’ in ‘suffix’, which is of non-class type ‘int’ 250 | static bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~~ /usr/include/poppler/goo/GooString.h:250:122: error: request for member ‘compare’ in ‘str’, which is of non-class type ‘int’ 250 | static bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~ /usr/include/poppler/goo/GooString.h:250:134: error: request for member ‘size’ in ‘str’, which is of non-class type ‘int’ 250 | tic bool endsWith(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~~

/usr/include/poppler/goo/GooString.h:250:150: error: request for member ‘size’ in ‘suffix’, which is of non-class type ‘int’ 250 | h(std::string_view str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~~

/usr/include/poppler/goo/GooString.h:250:165: error: request for member ‘size’ in ‘suffix’, which is of non-class type ‘int’ 250 | iew str, std::string_view suffix) { return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix); } | ^~~~

make[1]: [../OpenFX/Support/Plugins/Makefile.master:83: Linux-64-release/ReadPDF.o] Error 1 make[1]: Leaving directory '/home/ahpt/Documents/Git/openfx-arena/Bundle' make: [Makefile:13: Bundle] Error 2`

rodlie commented 2 years ago

https://gitlab.freedesktop.org/poppler/poppler/-/commit/5bebbe59a1e971dfd6b2f1f76d51dc544239ffb6 https://en.cppreference.com/w/cpp/string/basic_string_view (since C++17)

This is an issue with poppler IMHO.

vojta001 commented 2 years ago

I can confirm openfx-arena builds with poppler 22.08.0 when -std=c++17 is used.

Can't we simply bump the C++ standard version used?

rodlie commented 2 years ago

Use CMake? -DCMAKE_CXX_STANDARD=17.

vojta001 commented 2 years ago

I did something similar and yep, it works for me. I am just suggesting to change the default in Makefile.master, so that others don't face the same issue

devernay commented 2 years ago

poppler includes should at least disable declarations of C++17-specific API, which we don't use in ReadPDF anyway. But we have to deal with how the poppler developpers enforced compiling in C++17 mode.

There should be no issue with compiling in C++17 mode on clang, GCC, and VC++, according to this: https://stackoverflow.com/q/46746878

C++17 is necessary only to compiler ReadPDF with poppler >= 21.12, but I think it's OK to enable it to compile the whole plugin set. I wouldn't switch the main Natron code to using C++17, since it's still being built with Qt4, which barely supports C++11.

BTW, this line in openfx-arena:

globalParams.reset(new GlobalParams(popplerData.c_str()));

should be replaced by

globalParams = make_unique<GlobalParams>(popplerData.c_str()));
rodlie commented 2 years ago

Ok, will bump to c++17. I'm busy today, but will do it tomorrow (also got other fixes for openfx-arena in my queue).

I wouldn't switch the main Natron code to using C++17, since it's still being built with Qt4, which barely supports C++11.

On Windows using latest GCC (12) and MinGW I'm not able to build Qt4 with c++11 anymore, had to revert to c++98 (just gets random failures with c++11 and beyond).