jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
419 stars 65 forks source link

Failed to compile mympd-9.0.x #652

Closed itspec-ru closed 2 years ago

itspec-ru commented 2 years ago

myMPD version: [e.g. 9.0.x]

When compiling mympd i get multiple errors like this

In function ‘sdsll2str’,
    inlined from ‘sdsfromlonglong’ at /var/calculate/tmp/portage/media-sound/mympd-9.0.3/work/myMPD-9.0.3/dist/sds/sds.c:516:15:
/var/calculate/tmp/portage/media-sound/mympd-9.0.3/work/myMPD-9.0.3/dist/sds/sds.c:473:12: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  473 |         *s = *p;
      |         ~~~^~~~
/var/calculate/tmp/portage/media-sound/mympd-9.0.3/work/myMPD-9.0.3/dist/sds/sds.c: In function ‘sdsfromlonglong’:
/var/calculate/tmp/portage/media-sound/mympd-9.0.3/work/myMPD-9.0.3/dist/sds/sds.c:515:10: note: at offset 21 into destination object ‘buf’ of size 21
  515 |     char buf[SDS_LLSTR_SIZE];
      |          ^~~
In function ‘sdsll2str’,
    inlined from ‘sdsfromlonglong’ at /var/calculate/tmp/portage/media-sound/mympd-9.0.3/work/myMPD-9.0.3/dist/sds/sds.c:516:15:
/var/calculate/tmp/portage/media-sound/mympd-9.0.3/work/myMPD-9.0.3/dist/sds/sds.c:473:12: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  473 |         *s = *p;
      |         ~~~^~~~

My configuration: OS: Gentoo Linux GCC: gcc (Gentoo 11.2.0 p1) 11.2.0 CMAKE: cmake version 3.21.4

For installing as workaround i use own ebuild with added code block

src_prepare() {
        sed -e "s: -Werror : :" -i "${S}"/CMakeLists.txt
        sed -e "s: -Werror : :" -i "${S}"/test/CMakeLists.txt
        cmake_src_prepare
}

As you can see, I just remove the "-Werror" instructions from the CMakeLists.txt This is probably not the best way to solve the problem.

jcorporation commented 2 years ago

This is an issue with the integrated sds library and the compiler warning „ stringop-overflow“ with gcc 11.2. Best workaround is to remove the warning only for this library and opening a bug report in the sds repository.

Edit:

It seems to be a gcc bug:

In gcc 11.2.1 the bug is fixed. At least myMPD compiles fine on fedora 35 with gcc 11.2.1. Can you upgrade gcc and test?

jcorporation commented 2 years ago

I disabled the stringop-overflow warning for the sds source in the devel branch. Can you test it?

itspec-ru commented 2 years ago

mympd from devel branch compiled successful. live-ebuild for devel branch Works fine. Thanks!

jcorporation commented 2 years ago

Above commit in my new sds fork should also fix this issue. Could you please test the v9.1.0 branch?

itspec-ru commented 2 years ago

Of course, I'm ready to test the v9.1.0 branch. ebuild ready But the v9.1.0 branch has not been fixed yet.

jcorporation commented 2 years ago

I hopped commit 9dbd049 fixes this issue independent from compile settings.

itspec-ru commented 2 years ago

I get errors like this

In function ‘sdsll2str’,
    inlined from ‘sdsfromlonglong’ at /var/calculate/tmp/portage/media-sound/mympd-9.1.0.9999/work/mympd-9.1.0.9999/dist/sds/sds.c:529:15:
/var/calculate/tmp/portage/media-sound/mympd-9.1.0.9999/work/mympd-9.1.0.9999/dist/sds/sds.c:486:12: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  486 |         *s = *p;
      |         ~~~^~~~
/var/calculate/tmp/portage/media-sound/mympd-9.1.0.9999/work/mympd-9.1.0.9999/dist/sds/sds.c: In function ‘sdsfromlonglong’:
/var/calculate/tmp/portage/media-sound/mympd-9.1.0.9999/work/mympd-9.1.0.9999/dist/sds/sds.c:528:10: note: at offset 21 into destination object ‘buf’ of size 21
  528 |     char buf[SDS_LLSTR_SIZE];
      |          ^~~
jcorporation commented 2 years ago

Thanks for your test. It seems the deactivation of the compiler option is for gcc 11.2.0 the only solution. Is this version the default in gentoo?

itspec-ru commented 2 years ago

gcc 11.2.0 now latest stable in gentoo for most arch (amd64 arm arm64 hppa ppc ppc64 sparc x86). But it is possible to install unstable ("testing") packages as well (gcc-11.2.1_p20211127, gcc-11.2.1_pre9999, gcc-12.0.0_pre9999). It is also possible to install older versions, they are also stable. By default, the system is updated to the latest stable version. Also you can see Keywording and Stabilization

jcorporation commented 2 years ago

Thanks for the information. The patch will be merged into master for the next release.

itspec-ru commented 2 years ago

Latest commit 707c9ea8d5b7faaad516a68838721a6592767cc2 compiled successfully. Bug fixed. Thanks!