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

Error compiling test_toAscii.cpp with higher language level #197

Closed
jboynes opened this issue Aug 21, 2023 · 1 comment · Fixed by #206
Closed

Error compiling test_toAscii.cpp with higher language level #197

jboynes opened this issue Aug 21, 2023 · 1 comment · Fixed by #206
Labels

Comments

@jboynes
Copy link
Contributor

jboynes commented Aug 21, 2023

Testing on Ubuntu 23 with GCC 12 and glibc-2.37

$ uname -a
Linux foo 6.2.0-27-generic #28-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 00:41:18 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

I get the following compilation error:

[ 92%] Building CXX object CMakeFiles/test-ArduinoCore-API.dir/src/WCharacter/test_toAscii.cpp.o
In file included from /usr/include/c++/12/bits/atomic_wait.h:49,
                 from /usr/include/c++/12/bits/atomic_base.h:41,
                 from /usr/include/c++/12/bits/shared_ptr_atomic.h:33,
                 from /usr/include/c++/12/memory:77,
                 from /home/ubuntu/ArduinoCore-API/test/external/catch/v2.13.9/include/catch.hpp:2948,
                 from /home/ubuntu/ArduinoCore-API/test/src/WCharacter/test_toAscii.cpp:11:
/usr/include/c++/12/bits/std_mutex.h: In member function ‘void std::__condvar::wait_until(std::mutex&, clockid_t, timespec&)’:
/usr/include/c++/12/bits/std_mutex.h:169:7: error: ‘pthread_cond_clockwait’ was not declared in this scope; did you mean ‘pthread_cond_wait’?
  169 |       pthread_cond_clockwait(&_M_cond, __m.native_handle(), __clock,
      |       ^~~~~~~~~~~~~~~~~~~~~~
      |       pthread_cond_wait
make[2]: *** [CMakeFiles/test-ArduinoCore-API.dir/build.make:1084: CMakeFiles/test-ArduinoCore-API.dir/src/WCharacter/test_toAscii.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/test-ArduinoCore-API.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I'm guessing this is because C++20 added std::atomic<std::shared_ptr>

This test case has an #undef _GNU_SOURCE and if that is removed then it compiles and passes. Can this be removed?

@aentinger
Copy link
Contributor

Thank you @jboynes for this report.

Personally I don't see any reason why this define could not be removed. Why not create a PR and let's see what our CI build makes of this? Alternately, only exclude this macro when an advanced C++ compiler is used.

@jboynes jboynes mentioned this issue Sep 7, 2023
@per1234 per1234 linked a pull request Sep 7, 2023 that will close this issue
@per1234 per1234 added the bug label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants