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

[FIX] CPP23 #3240

Merged
merged 2 commits into from
Feb 27, 2024
Merged

[FIX] CPP23 #3240

merged 2 commits into from
Feb 27, 2024

Conversation

eseiler
Copy link
Member

@eseiler eseiler commented Feb 26, 2024

I don't know why the nightlies only fail now, even though these changes have been in GCC for a few months :)

https://cdash.seqan.de/index.php?project=SeqAn3

Commit 1

Things like std::apply require tuple-like.

It also kinda means that CPP23 breaks most of our custom tuple stuff; at least when you want to use it like a std::tuple. In the future, std::get is supposed to get a CPO.

#include <vector>

#include <seqan3/alphabet/nucleotide/dna5.hpp>
#include <seqan3/alphabet/quality/phred42.hpp>
#include <seqan3/io/record.hpp>
#include <seqan3/utility/tuple/pod_tuple.hpp>
#include <seqan3/utility/type_list/type_list.hpp>

// Would work, but not allowed.
// namespace std
// {
//     template <typename... T>
//     inline constexpr bool __is_tuple_like_v<seqan3::pod_tuple<T...>> = true;
// }

int main()
{
    using seq_t = std::vector<seqan3::dna5>;
    using id_t = std::string;
    using qual_t = std::vector<seqan3::phred42>;
    using type_list_t = seqan3::type_list<seq_t, id_t, qual_t>;
    using fields_t = seqan3::fields<seqan3::field::seq, seqan3::field::id, seqan3::field::qual>;
    using record_t = seqan3::record<type_list_t, fields_t> &;

    static_assert(std::__tuple_like<record_t>); // Fails
    static_assert(std::__tuple_like<seqan3::pod_tuple<int, float, int>>); // Fails
}

Commit 2

/usr/bin/ld: read_mapper_step2.cpp.o: warning: relocation against `_ZN6seqan36detail21optimum_search_schemeILh0ELh2EEE' in read-only section `.text._ZN6seqan36detail23search_scheme_algorithmINS_13configurationIJNS_10search_cfg15max_error_totalENS3_12hit_all_bestENS3_15output_query_idENS3_19output_reference_idENS3_31output_reference_begin_positionENS3_6detail11result_typeINS_13search_resultImNS0_10empty_typeEmmEEEEEEENS_11bi_fm_indexINS_4dna5ELNS_11text_layoutE1EN4sdsl6csa_wtINSJ_5wt_pcINSJ_14balanced_shapeENSJ_10int_vectorILh1EEENSJ_14rank_support_vILh1ELh1EEENSJ_19select_support_scanILh1ELh1EEENSR_ILh0ELh1EEENSJ_9byte_treeILb0EEEEELj16ELj10000000ENSJ_20sa_order_sa_samplingILh0EEENSJ_12isa_samplingILh0EEENSJ_19plain_byte_alphabetEEEEEJNS0_16policy_max_errorENS0_28policy_search_result_builderISF_EEEE14search_algo_biILb0ESt6vectorISH_SaISH_EERKZNS17_clISt5tupleIJmRS1B_EESt8functionIFvSD_EEEEvOT_OT0_EUlRKS1J_E_EEvRS1L_NS0_12search_paramEOT1_[_ZN6seqan36detail23search_scheme_algorithmINS_13configurationIJNS_10search_cfg15max_error_totalENS3_12hit_all_bestENS3_15output_query_idENS3_19output_reference_idENS3_31output_reference_begin_positionENS3_6detail11result_typeINS_13search_resultImNS0_10empty_typeEmmEEEEEEENS_11bi_fm_indexINS_4dna5ELNS_11text_layoutE1EN4sdsl6csa_wtINSJ_5wt_pcINSJ_14balanced_shapeENSJ_10int_vectorILh1EEENSJ_14rank_support_vILh1ELh1EEENSJ_19select_support_scanILh1ELh1EEENSR_ILh0ELh1EEENSJ_9byte_treeILb0EEEEELj16ELj10000000ENSJ_20sa_order_sa_samplingILh0EEENSJ_12isa_samplingILh0EEENSJ_19plain_byte_alphabetEEEEEJNS0_16policy_max_errorENS0_28policy_search_result_builderISF_EEEE14search_algo_biILb0ESt6vectorISH_SaISH_EERKZNS17_clISt5tupleIJmRS1B_EESt8functionIFvSD_EEEEvOT_OT0_EUlRKS1J_E_EEvRS1L_NS0_12search_paramEOT1_]'
/usr/bin/ld: read_mapper_step2.cpp.o: in function `void seqan3::detail::search_scheme_algorithm<seqan3::configuration<seqan3::search_cfg::max_error_total, seqan3::search_cfg::hit_all_best, seqan3::search_cfg::output_query_id, seqan3::search_cfg::output_reference_id, seqan3::search_cfg::output_reference_begin_position, seqan3::search_cfg::detail::result_type<seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long> > >, seqan3::bi_fm_index<seqan3::dna5, (seqan3::text_layout)1, sdsl::csa_wt<sdsl::wt_pc<sdsl::balanced_shape, sdsl::int_vector<(unsigned char)1>, sdsl::rank_support_v<(unsigned char)1, (unsigned char)1>, sdsl::select_support_scan<(unsigned char)1, (unsigned char)1>, sdsl::select_support_scan<(unsigned char)0, (unsigned char)1>, sdsl::byte_tree<false> >, 16u, 10000000u, sdsl::sa_order_sa_sampling<(unsigned char)0>, sdsl::isa_sampling<(unsigned char)0>, sdsl::plain_byte_alphabet> >, seqan3::detail::policy_max_error, seqan3::detail::policy_search_result_builder<seqan3::configuration<seqan3::search_cfg::max_error_total, seqan3::search_cfg::hit_all_best, seqan3::search_cfg::output_query_id, seqan3::search_cfg::output_reference_id, seqan3::search_cfg::output_reference_begin_position, seqan3::search_cfg::detail::result_type<seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long> > > > >::search_algo_bi<false, std::vector<seqan3::dna5, std::allocator<seqan3::dna5> >, seqan3::detail::search_scheme_algorithm<seqan3::configuration<seqan3::search_cfg::max_error_total, seqan3::search_cfg::hit_all_best, seqan3::search_cfg::output_query_id, seqan3::search_cfg::output_reference_id, seqan3::search_cfg::output_reference_begin_position, seqan3::search_cfg::detail::result_type<seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long> > >, seqan3::bi_fm_index<seqan3::dna5, (seqan3::text_layout)1, sdsl::csa_wt<sdsl::wt_pc<sdsl::balanced_shape, sdsl::int_vector<(unsigned char)1>, sdsl::rank_support_v<(unsigned char)1, (unsigned char)1>, sdsl::select_support_scan<(unsigned char)1, (unsigned char)1>, sdsl::select_support_scan<(unsigned char)0, (unsigned char)1>, sdsl::byte_tree<false> >, 16u, 10000000u, sdsl::sa_order_sa_sampling<(unsigned char)0>, sdsl::isa_sampling<(unsigned char)0>, sdsl::plain_byte_alphabet> >, seqan3::detail::policy_max_error, seqan3::detail::policy_search_result_builder<seqan3::configuration<seqan3::search_cfg::max_error_total, seqan3::search_cfg::hit_all_best, seqan3::search_cfg::output_query_id, seqan3::search_cfg::output_reference_id, seqan3::search_cfg::output_reference_begin_position, seqan3::search_cfg::detail::result_type<seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long> > > > >::operator()<std::tuple<unsigned long, std::vector<seqan3::dna5, std::allocator<seqan3::dna5> >&>, std::function<void (seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long>)> >(std::tuple<unsigned long, std::vector<seqan3::dna5, std::allocator<seqan3::dna5> >&>&&, std::function<void (seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long>)>&&)::{lambda(auto:1 const&)#1} const&>(std::function<void (seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long>)>&, seqan3::detail::search_param, seqan3::detail::search_scheme_algorithm<seqan3::configuration<seqan3::search_cfg::max_error_total, seqan3::search_cfg::hit_all_best, seqan3::search_cfg::output_query_id, seqan3::search_cfg::output_reference_id, seqan3::search_cfg::output_reference_begin_position, seqan3::search_cfg::detail::result_type<seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long> > >, seqan3::bi_fm_index<seqan3::dna5, (seqan3::text_layout)1, sdsl::csa_wt<sdsl::wt_pc<sdsl::balanced_shape, sdsl::int_vector<(unsigned char)1>, sdsl::rank_support_v<(unsigned char)1, (unsigned char)1>, sdsl::select_support_scan<(unsigned char)1, (unsigned char)1>, sdsl::select_support_scan<(unsigned char)0, (unsigned char)1>, sdsl::byte_tree<false> >, 16u, 10000000u, sdsl::sa_order_sa_sampling<(unsigned char)0>, sdsl::isa_sampling<(unsigned char)0>, sdsl::plain_byte_alphabet> >, seqan3::detail::policy_max_error, seqan3::detail::policy_search_result_builder<seqan3::configuration<seqan3::search_cfg::max_error_total, seqan3::search_cfg::hit_all_best, seqan3::search_cfg::output_query_id, seqan3::search_cfg::output_reference_id, seqan3::search_cfg::output_reference_begin_position, seqan3::search_cfg::detail::result_type<seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long> > > > >::operator()<std::tuple<unsigned long, std::vector<seqan3::dna5, std::allocator<seqan3::dna5> >&>, std::function<void (seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long>)> >(std::tuple<unsigned long, std::vector<seqan3::dna5, std::allocator<seqan3::dna5> >&>&&, std::function<void (seqan3::search_result<unsigned long, seqan3::detail::empty_type, unsigned long, unsigned long>)>&&)::{lambda(auto:1 const&)#1} const&)':
seqan3/search/detail/search_scheme_algorithm.hpp:839: undefined reference to `seqan3::detail::optimum_search_scheme<(unsigned char)0, (unsigned char)0>'
/usr/bin/ld: seqan3/search/detail/search_scheme_algorithm.hpp:842: undefined reference to `seqan3::detail::optimum_search_scheme<(unsigned char)0, (unsigned char)1>'
/usr/bin/ld: seqan3/search/detail/search_scheme_algorithm.hpp:845: undefined reference to `seqan3::detail::optimum_search_scheme<(unsigned char)0, (unsigned char)2>'
/usr/bin/ld: seqan3/search/detail/search_scheme_algorithm.hpp:848: undefined reference to `seqan3::detail::optimum_search_scheme<(unsigned char)0, (unsigned char)3>'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
gmake[3]: *** [CMakeFiles/read_mapper_step2_snippet.dir/build.make:100: tutorial/11_read_mapper/read_mapper_step2_snippet] Error 1

Adding a WORKAROUND macro is a bit verbose, but I don't want the linker error to mask other potential issues.

Copy link

vercel bot commented Feb 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
seqan3 ✅ Ready (Inspect) Visit Preview Feb 27, 2024 0:01am

@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Feb 26, 2024
// PR2165 / __cpp_lib_tuple_like (C++23): std::apply requires tuple-like.
// In C++23, this means std::array, std::pair, std::tuple, and std::ranges::subranges. Nothing else.
// https://en.cppreference.com/w/cpp/utility/tuple/tuple-like
std::apply(expander, as_base());
Copy link
Member Author

@eseiler eseiler Feb 26, 2024

Choose a reason for hiding this comment

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

Could also be

std::apply(expander, static_cast<base_type &>(*this));

but I prefer the as_base()-way

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, as_base() is nicer

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.17%. Comparing base (0146855) to head (4311ad5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3240   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files         269      269           
  Lines       11854    11856    +2     
=======================================
+ Hits        11638    11640    +2     
  Misses        216      216           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Feb 26, 2024
@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Feb 26, 2024
@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Feb 27, 2024
@seqan-actions seqan-actions added lint [INTERNAL] signal for linting and removed lint [INTERNAL] signal for linting labels Feb 27, 2024
@eseiler eseiler enabled auto-merge February 27, 2024 12:47
@eseiler eseiler merged commit a1997ca into seqan:main Feb 27, 2024
34 checks passed
@eseiler eseiler deleted the fix/cpp23 branch February 27, 2024 12:54
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