loskutov / deadbeef-lyricbar

A simple plugin for DeaDBeeF audio player that fetches and shows the song’s lyrics
MIT License
29 stars 8 forks source link

Compile Error on GCC 12 #34

Closed mihawk90 closed 2 years ago

mihawk90 commented 2 years ago

Currently trying to get this to compile on Fedora 36, which ships GCC 12, and I'm running into a compile error.

For sanity check I also compiled on Fedora 34 and 35, which both ship GCC 11, and both targets seem to compile just fine.

This is what I'm getting:

+ make gtk3
g++ src/ui.cpp -c `pkg-config --cflags libxml++-3.0 gtkmm-3.0 gtk+-3.0` -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -std=c++14 -Wall -O2 -fPIC -fvisibility=hidden -flto
g++ src/utils.cpp -c `pkg-config --cflags libxml++-3.0 gtkmm-3.0 gtk+-3.0` -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -std=c++14 -Wall -O2 -fPIC -fvisibility=hidden -flto
src/utils.cpp: In function 'std::string fetch_file(Gio::File&)':
src/utils.cpp:178:32: error: aggregate 'std::array<char, 4096> buf' has incomplete type and cannot be defined
  178 |         std::array<char, 4096> buf;
      |                                ^~~
make: *** [Makefile:28: utils.o] Error 1

Complete build log attached: build.log

The-Munk commented 2 years ago

I was able to get past this issue on arch with a simple patch

--- deadbeef-lyricbar/src/utils.cpp 2022-06-20 17:54:56.042480744 -0500
+++ deadbeef-lyricbar/src/utils-2.cpp   2022-06-20 17:57:12.050407411 -0500
@@ -11,6 +11,7 @@
 #include <regex>
 #include <sstream>
 #include <stdexcept>
+#include <array>

 #include <giomm.h>
 #include <glibmm/fileutils.h>

Dunno if the problem really is as simple as a missing include, but it builds for me now.

mihawk90 commented 2 years ago

Hmm good catch. I looked this up and that seems to be the case:

https://gcc.gnu.org/gcc-12/porting_to.html

Header dependency changes Some C++ Standard Library headers have been changed to no longer include other headers that were being used internally by the library. As such, C++ programs that used standard library components without including the right headers will no longer compile.

The following headers are used less widely in libstdc++ and may need to be included explicitly when compiled with GCC 12:

(for std::shared_ptr, std::unique_ptr etc.) (for std::begin, std::end, std::size, std::istream_iterator, std::istreambuf_iterator) (for std::for_each, std::copy etc.) (for std::pair) (for std::array) (for std::atomic)

edit: well, while it compiled, it fails to load. Same issue as in #22