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 QNX 7.1 build #1758

Closed
wants to merge 1 commit into from
Closed

Conversation

kheaactua
Copy link

@kheaactua kheaactua commented Sep 18, 2024

Support for QNX 7.1. I understand this is not a supported platform

On QNX 7.1 ntoaarch64le, I hit the two build issue:

  • error: no matching function for call to 'absl::lts_20240722::flags_internal::MaskedPointer::MaskedPointer()'
    • For this I defined a constructor, quite sure this was the wrong approach though.

I've built code using this, in particular the flat_has_map, it seems to work really well. Hoping for feedback to get the PR up to merging quality.

Copy link

google-cla bot commented Sep 18, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kheaactua kheaactua changed the title Apply LTS transformations for 20240722 LTS branch (#1724) Support QNX 7.1 build Sep 18, 2024
@kheaactua kheaactua force-pushed the 20240722.0-qnx71 branch 2 times, most recently from 06a47f2 to c1b6427 Compare September 18, 2024 16:47
@kheaactua kheaactua marked this pull request as ready for review September 18, 2024 20:32
@@ -20,9 +20,13 @@

#if defined(HAS_STRPTIME) && HAS_STRPTIME
#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
#if defined(__QNX__)
#define _XOPEN_SOURCE 600 // Exposes definitions for QNX.

Choose a reason for hiding this comment

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

I think you'd need to fix this in the upstream cctz project first. Then it gets copied to absl.

Copy link
Author

Choose a reason for hiding this comment

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

Oh. I wasn't aware of the structure (this is from another repo?), that does make the comments in your PR make more sense then. K, thanks, I'll post this there now.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I pushed it here: google/cctz#301

Copy link
Author

Choose a reason for hiding this comment

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

I removed the issue about:

This simply required the definition of _QNX_SOURCE which is suppose to be implicit when gnu extensions are enabled (docs) but evidently is not.

This allowed me to close google/cctz#301 though which is nice.

@derekmauro
Copy link
Member

Can you share the compiler, compiler version, and full context of the compiler error message?

@kheaactua
Copy link
Author

Can you share the compiler, compiler version, and full context of the compiler error message?

Sure, tag 20240722.0

FAILED: absl/log/CMakeFiles/log_flags.dir/flags.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 -D_QNX_SOURCE -I/home/matt/.conan2/p/b/absei64e320fb65917/b/src -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,absl/log/CMakeFiles/log_flags.dir/flags.cc.o.d -Wp,-MT,absl/log/CMakeFiles/log_flags.dir/flags.cc.o -Wp,-MF,absl/log/CMakeFiles/log_flags.dir/flags.cc.o.d -o absl/log/CMakeFiles/log_flags.dir/flags.cc.o -c /home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/log/flags.cc
In file included from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/memory:668,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/algorithm:644,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/__string:57,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/string_view:176,
                 from /sdp710-qc/stage/target/qnx7/usr/include/c++/v1/string:505,
                 from /home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/log/internal/flags.h:25,
                 from /home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/log/flags.cc:16:
/sdp710-qc/stage/target/qnx7/usr/include/c++/v1/atomic: In instantiation of '_Tp std::__1::__c11_atomic_load(const std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>*, std::__1::memory_order) [with _Tp = absl::lts_20240722::flags_internal::MaskedPointer; std::__1::memory_order = std::__1::memory_order]':
/sdp710-qc/stage/target/qnx7/usr/include/c++/v1/atomic:926:34:   required from '_Tp std::__1::__atomic_base<_Tp, <anonymous> >::load(std::__1::memory_order) const [with _Tp = absl::lts_20240722::flags_internal::MaskedPointer; bool <anonymous> = false; std::__1::memory_order = std::__1::memory_order]'
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:533:41:   required from 'bool absl::lts_20240722::flags_internal::FlagValue<T, (absl::lts_20240722::flags_internal::FlagValueStorageKind)3>::Get(const absl::lts_20240722::flags_internal::SequenceLock&, T&) const [with T = std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >]'
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:823:9:   required from 'T absl::lts_20240722::flags_internal::Flag<T>::Get() const [with T = std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >]'
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:851:21:   required from 'static T absl::lts_20240722::flags_internal::FlagImplPeer::InvokeGet(const FlagType&) [with T = std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >; FlagType = absl::lts_20240722::flags_internal::Flag<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >]'
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/flag.h:98:52:   required from 'T absl::lts_20240722::GetFlag(absl::lts_20240722::Flag<T>&) [with T = std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >; absl::lts_20240722::Flag<T> = absl::lts_20240722::flags_internal::Flag<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >]' /home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/log/flags.cc:93:47:   required from here
/sdp710-qc/stage/target/qnx7/usr/include/c++/v1/atomic:708:7: error: no matching function for call to 'absl::lts_20240722::flags_internal::MaskedPointer::MaskedPointer()'
   _Tp __ret;
       ^~~~~
In file included from /home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/flag.h:41,
                 from /home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/log/flags.cc:27:
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:377:3: note: candidate: 'absl::lts_20240722::flags_internal::MaskedPointer::MaskedPointer(absl::lts_20240722::flags_internal::MaskedPointer::ptr_t, bool)'
   MaskedPointer(ptr_t rhs, bool is_candidate);
   ^~~~~~~~~~~~~
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:377:3: note:   candidate expects 2 arguments, 0 provided
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:376:22: note: candidate: 'constexpr absl::lts_20240722::flags_internal::MaskedPointer::MaskedPointer(absl::lts_20240722::flags_internal::MaskedPointer::ptr_t)'
   constexpr explicit MaskedPointer(ptr_t rhs) : ptr_(rhs) {}
                      ^~~~~~~~~~~~~
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:376:22: note:   candidate expects 1 argument, 0 provided
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:369:7: note: candidate: 'constexpr absl::lts_20240722::flags_internal::MaskedPointer::MaskedPointer(const absl::lts_20240722::flags_internal::MaskedPointer&)'
 class MaskedPointer {
       ^~~~~~~~~~~~~
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:369:7: note:   candidate expects 1 argument, 0 provided
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:369:7: note: candidate: 'constexpr absl::lts_20240722::flags_internal::MaskedPointer::MaskedPointer(absl::lts_20240722::flags_internal::MaskedPointer&&)'
/home/matt/.conan2/p/b/absei64e320fb65917/b/src/absl/flags/internal/flag.h:369:7: note:   candidate expects 1 argument, 0 provided

I do get this warning in CMake:

CMake Warning at absl/copts/AbseilConfigureCopts.cmake:101 (message):
  Unknown compiler:
  /f/phoenix/phx-fsb/output/phoenix_hi/package/sdp710-qc/stage/host/linux/x86_64/usr/bin/q++.
  Building with no default flags
Call Stack (most recent call first):
  CMake/AbseilHelpers.cmake:18 (include)
  CMakeLists.txt:76 (include

Using q++ 8.3.0 gcc_ntoaarch64le. Cross compiling this on an x86_64 machine using the QNX 7.1 SDP.

@derekmauro
Copy link
Member

derekmauro commented Sep 25, 2024

I don't know how to test this easily, but I believe this fix is simply changing

MaskedPointer ptr_value = value.load(std::memory_order_acquire);

to

MaskedPointer ptr_value(value.load(std::memory_order_acquire));

@kheaactua
Copy link
Author

I don't know how to test this easily, but I believe this fix is simply changing

MaskedPointer ptr_value = value.load(std::memory_order_acquire);

to

MaskedPointer ptr_value(value.load(std::memory_order_acquire));

I gave that a try:

❯ gd c0b9bd08e0
diff --git a/absl/flags/internal/flag.h b/absl/flags/internal/flag.h
index a0be31d9..d91eb426 100644
--- a/absl/flags/internal/flag.h
+++ b/absl/flags/internal/flag.h
@@ -530,7 +530,7 @@ struct FlagValue<T, FlagValueStorageKind::kHeapAllocated>
   constexpr FlagValue() : FlagMaskedPointerValue(&buffer[0]) {}
 
   bool Get(const SequenceLock&, T& dst) const {
-    MaskedPointer ptr_value = value.load(std::memory_order_acquire);
+    MaskedPointer ptr_value(value.load(std::memory_order_acquire));
 
     if (ABSL_PREDICT_TRUE(ptr_value.AllowsUnprotectedRead())) {
       ::new (static_cast<void*>(&dst)) T(*static_cast<T*>(ptr_value.Ptr()));

Got a very similar error. Working with gcc 8.3 isn't fun. :)

[68/247] Building CXX object absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o
FAILED: absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o
/home/matt/.local/share/Ford/fsb-suite-2024-08-2/tools/bin/ccache /output/toolchain/qnx710_qualcomm/host/linux/x86_64/usr/bin/q++ -Vaarch64 -Wc,-isysroot,/output/toolchain/qnx710_qualcomm/target/qnx7 -lang-c++ -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -D_LARGEFILE64_SOURCE -D_LARG
EFILE_SOURCE -D_QNX_SOURCE -Wp,-isystem,/output/hi/package/abseil-cpp/src -Vgcc_ntoaarch64le  -Os -g -DNDEBUG -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 -std=gnu+
+17 -Wp,-MD,absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o.d -Wp,-MT,absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o -Wp,-MF,absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o.d -o absl/flags/CMakeFiles/flags_parse.dir/parse.cc.o -c /output/hi/package/abseil-cpp/src/absl/flags/parse.cc
In file included from /output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/memory:668,
                 from /output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/algorithm:644,
                 from /output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/__string:57,
                 from /output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/string_view:176,
                 from /output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/string:505,
                 from /output/hi/package/abseil-cpp/src/absl/flags/parse.h:26,
                 from absl/flags/parse.cc:16:
/output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/atomic: In instantiation of '_Tp std::__1::__c11_atomic_load(const std::__1::__gcc_atomic::__gcc_atomic_t<_Tp>*, std::__1::memory_order) [with _Tp = absl::flags_internal::MaskedPointer; std::__1::memory_order = std::__1::memory_order]'
:
/output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/atomic:926:34:   required from '_Tp std::__1::__atomic_base<_Tp, <anonymous> >::load(std::__1::memory_order) const [with _Tp = absl::flags_internal::MaskedPointer; bool <anonymous> = false; std::__1::memory_order = std::__1::memory_ord
er]'
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:533:39:   required from 'bool absl::flags_internal::FlagValue<T, (absl::flags_internal::FlagValueStorageKind)3>::Get(const absl::flags_internal::SequenceLock&, T&) const [with T = std::__1::vector<std::__1::basic_string<char, std::
__1::char_traits<char>, std::__1::allocator<char> > >]'
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:823:9:   required from 'T absl::flags_internal::Flag<T>::Get() const [with T = std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >]'
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:851:21:   required from 'static T absl::flags_internal::FlagImplPeer::InvokeGet(const FlagType&) [with T = std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >; FlagType = absl::f
lags_internal::Flag<std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >]'
/output/hi/package/abseil-cpp/src/absl/flags/flag.h:98:52:   required from 'T absl::GetFlag(absl::Flag<T>&) [with T = std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >; absl::Flag<T> = absl::flags_internal::Flag<std::__1::vector<std::__1
::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >]'
absl/flags/parse.cc:107:39:   required from here
/output/toolchain/qnx710_qualcomm/target/qnx7/usr/include/c++/v1/atomic:708:7: error: no matching function for call to 'absl::flags_internal::MaskedPointer::MaskedPointer()'
   _Tp __ret;
       ^~~~~
In file included from /output/hi/package/abseil-cpp/src/absl/flags/flag.h:41,
                 from absl/flags/parse.cc:42:
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:377:3: note: candidate: 'absl::flags_internal::MaskedPointer::MaskedPointer(absl::flags_internal::MaskedPointer::ptr_t, bool)'
   MaskedPointer(ptr_t rhs, bool is_candidate);
   ^~~~~~~~~~~~~
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:377:3: note:   candidate expects 2 arguments, 0 provided
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:376:22: note: candidate: 'constexpr absl::flags_internal::MaskedPointer::MaskedPointer(absl::flags_internal::MaskedPointer::ptr_t)'
   constexpr explicit MaskedPointer(ptr_t rhs) : ptr_(rhs) {}
                      ^~~~~~~~~~~~~
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:376:22: note:   candidate expects 1 argument, 0 provided
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:369:7: note: candidate: 'constexpr absl::flags_internal::MaskedPointer::MaskedPointer(const absl::flags_internal::MaskedPointer&)'
 class MaskedPointer {
       ^~~~~~~~~~~~~
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:369:7: note:   candidate expects 1 argument, 0 provided
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:369:7: note: candidate: 'constexpr absl::flags_internal::MaskedPointer::MaskedPointer(absl::flags_internal::MaskedPointer&&)'
/output/hi/package/abseil-cpp/src/absl/flags/internal/flag.h:369:7: note:   candidate expects 1 argument, 0 provided
ninja: build stopped: subcommand failed.

@derekmauro
Copy link
Member

I ended up making a change similar to your suggestion to add a constructor. Please let us know if it did not work.

@kheaactua
Copy link
Author

@derekmauro It builds!

Thanks

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.

3 participants