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

Support for QNX 7.1 #301

Closed

Conversation

kheaactua
Copy link

@kheaactua kheaactua commented Sep 20, 2024

Without specifying _XOPEN_SOURCE>=600, QNX 7.1 (ntoaarch64le) fails with:

/target/qnx7/usr/include/c++/v1/__threading_support: In function 'int std::__1::__libcpp_condvar_timedwait(std::__1::__libcpp_condvar_t*, std::__1::__libcpp_mutex_t*, timespec*)': /target/qnx7/usr/include/c++/v1/__threading_support:293:10: error: 'pthread_cond_timedwait' was not declared in this scope
   return pthread_cond_timedwait(__cv, __m, __ts);
          ^~~~~~~~~~~~~~~~~~~~~~
/target/qnx7/usr/include/c++/v1/__threading_support:293:10: note: suggested alternative: 'pthread_cond_wait'
   return pthread_cond_timedwait(__cv, __m, __ts);
          ^~~~~~~~~~~~~~~~~~~~~~
          pthread_cond_wait

Without specifying _XOPEN_SOURCE>=600, QNX 7.1 fails with:

/target/qnx7/usr/include/c++/v1/__threading_support: In function 'int std::__1::__libcpp_condvar_timedwait(std::__1::__libcpp_condvar_t*, std::__1::__libcpp_mutex_t*, timespec*)':
/target/qnx7/usr/include/c++/v1/__threading_support:293:10: error: 'pthread_cond_timedwait' was not declared in this scope
   return pthread_cond_timedwait(__cv, __m, __ts);
          ^~~~~~~~~~~~~~~~~~~~~~
/target/qnx7/usr/include/c++/v1/__threading_support:293:10: note: suggested alternative: 'pthread_cond_wait'
   return pthread_cond_timedwait(__cv, __m, __ts);
          ^~~~~~~~~~~~~~~~~~~~~~
          pthread_cond_wait
@kheaactua kheaactua marked this pull request as ready for review September 20, 2024 13:19
Copy link
Member

@derekmauro derekmauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you post the full error message? The part of the error message that you posted mentions pthread_cond_timedwait but I don't see how that is used by this file. It also seems weird that if this change is to fix pthread_cond_timedwait that the #define is going into a block guarded by #if defined(HAS_STRPTIME) && HAS_STRPTIME.

@kheaactua
Copy link
Author

Can you post the full error message? The part of the error message that you posted mentions pthread_cond_timedwait but I don't see how that is used by this file. It also seems weird that if this change is to fix pthread_cond_timedwait that the #define is going into a block guarded by #if defined(HAS_STRPTIME) && HAS_STRPTIME.

Sure. This is from a conan build with a QNX profile I set up.

FAILED: CMakeFiles/cctz.dir/src/time_zone_format.cc.o
ccache /sdp710-qc/stage/host/linux/x86_64/usr/bin/q++ -Vaarch64 -Wc,-isysroot,/sdp710-qc/stage/target/qnx7 -lang-c++ -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/home/matt/.conan2/p/b/cctz69ae74031be22/b/src/include -Vgcc_ntoaarch64le  -O2 -g -DNDEBUG -std=gnu++17 -fPIC -fdiagnostics-color=always -march=armv8-a -mcpu=cortex-a57 -mtune=cortex-a57 -fstack-protector-strong -ftrapv -ffast-math -fno-unsafe-math-optimizations -Werror=return-type -Wp,-MD,CMakeFiles/cctz.dir/src/time_zone_format.cc.o.d -Wp,-MT,CMakeFiles/cctz.dir/src/time_zone_format.cc.o -Wp,-MF,CMakeFiles/cctz.dir/src/time_zone_format.cc.o.d -o CMakeFiles/cctz.dir/src/time_zone_format.cc.o -c /home/matt/.conan2/p/b/cctz69ae74031be22/b/src/src/time_zone_format.cc
In file included from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/__mutex_base:17,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/mutex:191,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/__locale:18,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/ios:216,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/ostream:138,
                 from /home/matt/.conan2/p/b/cctz69ae74031be22/b/src/include/cctz/civil_time_detail.h:20,
                 from /home/matt/.conan2/p/b/cctz69ae74031be22/b/src/include/cctz/civil_time.h:18,
                 from /home/matt/.conan2/p/b/cctz69ae74031be22/b/src/include/cctz/time_zone.h:30,
                 from /home/matt/.conan2/p/b/cctz69ae74031be22/b/src/src/time_zone_format.cc:27:
/sdp710-qc/stage/target/qnx7/usr/include/c++/v1/__threading_support: In function 'int std::__1::__libcpp_condvar_timedwait(std::__1::__libcpp_condvar_t*, std::__1::__libcpp_mutex_t*, timespec*)':
/sdp710-qc/stage/target/qnx7/usr/include/c++/v1/__threading_support:293:10: error: 'pthread_cond_timedwait' was not declared in this scope
   return pthread_cond_timedwait(__cv, __m, __ts);
          ^~~~~~~~~~~~~~~~~~~~~~
/sdp710-qc/stage/target/qnx7/usr/include/c++/v1/__threading_support:293:10: note: suggested alternative: 'pthread_cond_wait'
   return pthread_cond_timedwait(__cv, __m, __ts);
          ^~~~~~~~~~~~~~~~~~~~~~
          pthread_cond_wait

@kheaactua
Copy link
Author

I'm reconsidering this PR. My toolchain used to define _QNX_SOURCE, which would also enable these pthread functions. I removed it from my toolchain based on the docs

There are additional variants of this option that enable vendor-specific compiler extensions: gnu99, gnu11, gnu++98, gnu++11, gnu++14, and gnu++17. If you use these variants, _QNX_SOURCE is defined automatically

As hard as I try, I can't show that this statement is in any way true.

Re-enabling this in a QNX toolchain (add_compile_definitions(_QNX_SOURCE)) solves this issue without any code change.

@kheaactua kheaactua closed this Sep 23, 2024
@kheaactua kheaactua deleted the fix_qnx_pthread_xopen_source branch September 23, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants