Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.8: build fails with doctest 2.4.9 #2673

Closed
kloczek opened this issue Aug 10, 2022 · 14 comments
Closed

3.0.8: build fails with doctest 2.4.9 #2673

kloczek opened this issue Aug 10, 2022 · 14 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kloczek
Copy link

kloczek commented Aug 10, 2022

Looks like recent gcc changes in gcc used in fedora rawhide are causing fails

[ 68%] Building CXX object CMakeFiles/notcurses-tester.dir/src/tests/bitmap.cpp.o
/usr/bin/g++ -D_DEFAULT_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/include -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8 -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/x86_64-redhat-linux-gnu/include -O2 -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 -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -DNDEBUG -fvisibility=hidden -Wformat -Werror=format-security -Wall -Wextra -W -Wshadow -Wvla -Wstrict-aliasing=2 -fno-signed-zeros -fno-trapping-math -fassociative-math -fno-math-errno -freciprocal-math -funsafe-math-optimizations -fexceptions -fstrict-aliasing -std=c++17 -MD -MT CMakeFiles/notcurses-tester.dir/src/tests/bitmap.cpp.o -MF CMakeFiles/notcurses-tester.dir/src/tests/bitmap.cpp.o.d -o CMakeFiles/notcurses-tester.dir/src/tests/bitmap.cpp.o -c /home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/bitmap.cpp
In file included from /home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/main.h:9,
                 from /home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/bitmap.cpp:1:
/usr/include/doctest/doctest.h: In instantiation of ‘static void doctest::detail::filldata<T*>::fill(std::ostream*, const T*) [with T = int(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int); std::ostream = std::basic_ostream<char>]’:
/usr/include/doctest/doctest.h:1025:26:   required from ‘void doctest::detail::filloss(std::ostream*, const T&) [with T = int (*)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int); std::ostream = std::basic_ostream<char>]’
/usr/include/doctest/doctest.h:1038:16:   required from ‘doctest::String doctest::detail::toStream(const T&) [with T = int (*)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int)]’
/usr/include/doctest/doctest.h:1046:28:   required from ‘static doctest::String doctest::detail::StringMakerBase<true>::convert(const T&) [with T = int (*)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int)]’
/usr/include/doctest/doctest.h:1079:35:   required from ‘doctest::String doctest::toString(const T&) [with T = int (*)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int); typename detail::types::enable_if<(! detail::types::is_enum<T>::value), bool>::type <anonymous> = true]’
/usr/include/doctest/doctest.h:1476:32:   required from ‘doctest::detail::Expression_lhs<L>::operator doctest::detail::Result() [with L = int (*&)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int)]’
/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/bitmap.cpp:20:7:   required from here
/usr/include/doctest/doctest.h:1166:49: error: invalid conversion from ‘int (*)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int)’ to ‘const void*’ [-fpermissive]
 1166 |             filldata<const void*>::fill(stream, in);
      |                                                 ^~
      |                                                 |
      |                                                 int (*)(const tinfo*, const ncpile*, sprixel*, fbuf*, int, int)
/usr/include/doctest/doctest.h:1160:60: note:   initializing argument 2 of ‘static void doctest::detail::filldata<const void*>::fill(std::ostream*, const void*)’
 1160 |         static void fill(std::ostream* stream, const void* in);
      |                                                ~~~~~~~~~~~~^~
make[2]: *** [CMakeFiles/notcurses-tester.dir/build.make:135: CMakeFiles/notcurses-tester.dir/src/tests/bitmap.cpp.o] Error 1
[ 68%] Building CXX object CMakeFiles/notcurses-tester.dir/src/tests/tabbed.cpp.o
/usr/bin/g++ -D_DEFAULT_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/include -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8 -I/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/x86_64-redhat-linux-gnu/include -O2 -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 -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -DNDEBUG -fvisibility=hidden -Wformat -Werror=format-security -Wall -Wextra -W -Wshadow -Wvla -Wstrict-aliasing=2 -fno-signed-zeros -fno-trapping-math -fassociative-math -fno-math-errno -freciprocal-math -funsafe-math-optimizations -fexceptions -fstrict-aliasing -std=c++17 -MD -MT CMakeFiles/notcurses-tester.dir/src/tests/tabbed.cpp.o -MF CMakeFiles/notcurses-tester.dir/src/tests/tabbed.cpp.o.d -o CMakeFiles/notcurses-tester.dir/src/tests/tabbed.cpp.o -c /home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/tabbed.cpp
In file included from /home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/main.h:9,
                 from /home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/tabbed.cpp:1:
/usr/include/doctest/doctest.h: In instantiation of ‘static void doctest::detail::filldata<T*>::fill(std::ostream*, const T*) [with T = void(nctab*, ncplane*, void*); std::ostream = std::basic_ostream<char>]’:
/usr/include/doctest/doctest.h:1025:26:   required from ‘void doctest::detail::filloss(std::ostream*, const T&) [with T = void (*)(nctab*, ncplane*, void*); std::ostream = std::basic_ostream<char>]’
/usr/include/doctest/doctest.h:1038:16:   required from ‘doctest::String doctest::detail::toStream(const T&) [with T = void (*)(nctab*, ncplane*, void*)]’
/usr/include/doctest/doctest.h:1046:28:   required from ‘static doctest::String doctest::detail::StringMakerBase<true>::convert(const T&) [with T = void (*)(nctab*, ncplane*, void*)]’
/usr/include/doctest/doctest.h:1079:35:   required from ‘doctest::String doctest::toString(const T&) [with T = void (*)(nctab*, ncplane*, void*); typename detail::types::enable_if<(! detail::types::is_enum<T>::value), bool>::type <anonymous> = true]’
/usr/include/doctest/doctest.h:1318:49:   required from ‘doctest::String doctest::detail::stringifyBinaryExpr(const L&, const char*, const R&) [with L = void(nctab*, ncplane*, void*); R = void (*)(nctab*, ncplane*, void*)]’
/usr/include/doctest/doctest.h:1485:9:   required from ‘decltype (((void)((declval<L>() == declval<R>())), (doctest::detail::Result)(<brace-enclosed initializer list>()))) doctest::detail::Expression_lhs<L>::operator==(R&&) [with R = void (*)(nctab*, ncplane*, void*); L = void (&)(nctab*, ncplane*, void*); decltype (((void)((declval<L>() == declval<R>())), (doctest::detail::Result)(<brace-enclosed initializer list>()))) = doctest::detail::Result]’
/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/src/tests/tabbed.cpp:398:5:   required from here
/usr/include/doctest/doctest.h:1166:49: error: invalid conversion from ‘void (*)(nctab*, ncplane*, void*)’ to ‘const void*’ [-fpermissive]
 1166 |             filldata<const void*>::fill(stream, in);
      |                                                 ^~
      |                                                 |
      |                                                 void (*)(nctab*, ncplane*, void*)
/usr/include/doctest/doctest.h:1160:60: note:   initializing argument 2 of ‘static void doctest::detail::filldata<const void*>::fill(std::ostream*, const void*)’
 1160 |         static void fill(std::ostream* stream, const void* in);
      |                                                ~~~~~~~~~~~~^~
make[2]: *** [CMakeFiles/notcurses-tester.dir/build.make:625: CMakeFiles/notcurses-tester.dir/src/tests/tabbed.cpp.o] Error 1
make[2]: Target 'CMakeFiles/notcurses-tester.dir/build' not remade because of errors.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/notcurses-3.0.8/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:2518: CMakeFiles/notcurses-tester.dir/all] Error 2
make  -f CMakeFiles/notcurses.3.man.dir/build.make CMakeFiles/notcurses.3.man.dir/depend
@kloczek kloczek added the bug Something isn't working label Aug 10, 2022
@dankamongmen dankamongmen self-assigned this Aug 10, 2022
@dankamongmen dankamongmen added this to the 3.1.0 milestone Aug 10, 2022
@dankamongmen
Copy link
Owner

egads! it looks like this has to do with doctest. i'll get on it asap.

@dankamongmen
Copy link
Owner

hrmmm, not running into this on debian unstable. what environment and g++ version?

@kloczek
Copy link
Author

kloczek commented Aug 10, 2022

I'm using gcc from Fedora rawhide gcc-12.1.1-3.fc37.x86_64
I also wtote https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/NW75YZ3VIXGO2TOPC33AS47VDJDVQKIE/

@dankamongmen
Copy link
Owner

thanks; i'll bring up my fedora VM later today and see what's what.

@kloczek
Copy link
Author

kloczek commented Aug 24, 2022

Any update? 🤔

@msftceo
Copy link

msftceo commented Sep 12, 2022

same error on arch, gcc 12.2.0

building worked after commenting out these lines:
./src/tests/bitmap.cpp:17-21

     CHECK(0 < nc_->tcache.cellpxy); 
     CHECK(0 < nc_->tcache.cellpxx); 
     if(!nc_->tcache.pixel_draw_late){ 
       CHECK(nc_->tcache.pixel_draw); 
     }

./src/tests/tabbed.cpp:398

    CHECK(tabbedcb == nctab_cb(t1));

@dankamongmen
Copy link
Owner

i don't want to say that this is a bug ion doctest, but i'm not sure exactly what's up. i fixed one problem. i hope to have this resolved today. thanks for your patience!

@dankamongmen
Copy link
Owner

so all the failure points involve function pointers, and we break in this part of doctest:

/usr/include/doctest/doctest.h:1046:28:   required from ‘static doctest::String doctest::detail::StringMakerBase<true>::convert(const T&) [with T = void (*)(nctab*, ncplane*, void*)]’
/usr/include/doctest/doctest.h:1079:35:   required from ‘doctest::String doctest::toString(const T&) [with T = void (*)(nctab*, ncplane*, void*); typename detail::types::enable_if<(! detail::types::is_enum<T>::value), bool>::type <anonymous> = true]’
/usr/include/doctest/doctest.h:1318:49:   required from ‘doctest::String doctest::detail::stringifyBinaryExpr(const L&, const char*, const R&) [with L = void(nctab*, ncplane*, void*); R = void (*)(nctab*, ncplane*, void*)]’

so it's trying to turn the expression into a string to show when it fails, and it's running into some problem:

/usr/include/doctest/doctest.h:1485:9:   required from ‘decltype (((void)((declval<L>() == declval<R>())), (doctest::detail::Result)(<brace-enclosed initializer list>()))) doctest::detail::Expression_lhs<L>::operator==(R&&) [with R = void (*)(nctab*, ncplane*, void*); L = void (&)(nctab*, ncplane*, void*); decltype (((void)((declval<L>() == declval<R>())), (doctest::detail::Result)(<brace-enclosed initializer list>()))) = doctest::detail::Result]’

@Saalvage, would you mind taking a quick look at this? it started breaking with doctest 2.4.9. it might very well be my misuse of the library, but maybe you'll know quickly.

@dankamongmen
Copy link
Owner

if i manually cast things to const void*, they compile, e.g.:

[schwarzgerat](0) $ git diff
diff --git src/tests/bitmap.cpp src/tests/bitmap.cpp
index 9f56ea788..d0f39d80e 100644
--- src/tests/bitmap.cpp
+++ src/tests/bitmap.cpp
@@ -17,7 +17,7 @@ TEST_CASE("Bitmaps") {
     CHECK(0 < nc_->tcache.cellpxy);
     CHECK(0 < nc_->tcache.cellpxx);
     if(!nc_->tcache.pixel_draw_late){
-      CHECK(nc_->tcache.pixel_draw);
+      CHECK((const void*)nc_->tcache.pixel_draw);
     }
   }
 
diff --git src/tests/tabbed.cpp src/tests/tabbed.cpp
index 272b09e2d..9adc7ae7d 100644
--- src/tests/tabbed.cpp
+++ src/tests/tabbed.cpp
@@ -395,7 +395,7 @@ TEST_CASE("Tabbed") {
     CHECK(0 == strcmp(sep, nctabbed_separator(nt)));
     auto t1 = nctabbed_add(nt, nullptr, nullptr, tabbedcb, "tab1", nullptr);
     nctab_set_cb(t1, tabbedcb);
-    CHECK(tabbedcb == nctab_cb(t1));
+    CHECK((const void*)(tabbedcb) == (const void*)nctab_cb(t1));
     nctab_set_userptr(t1, (void*) sep);
     CHECK((void*) sep == nctab_userptr(t1));
     const char* tname = "tab name";
[schwarzgerat](0) $ 

@dankamongmen
Copy link
Owner

i think this might be doctest/doctest#686, and if so, we're just gonna need to wait for 2.4.10, and mark that as a dep, ugh.

@Saalvage
Copy link

Saalvage commented Oct 1, 2022

Yep, seems like an instance of that issue. Sorry for the inconvenience, looking to get 2.4.10 out of the door next week!

@dankamongmen
Copy link
Owner

Yep, seems like an instance of that issue. Sorry for the inconvenience, looking to get 2.4.10 out of the door next week!

these things happen. thanks for the confirmation. i'll go ahead and exclude 2.4.9 in the CMake config.

@dankamongmen dankamongmen changed the title 3.0.8: build fails with latest gcc 3.0.8: build fails with doctest 2.4.9 Oct 4, 2022
@dankamongmen
Copy link
Owner

i'm going to go ahead and put in a workaround to get things compiling again.

@dankamongmen
Copy link
Owner

alright, imma cut a 3.0.9 to get us past this bullshit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants