Skip to content

core: Fix compile errors on GCC 14#1687

Merged
BareosBot merged 4 commits intobareos:masterfrom
csfore:include-algorithm
Feb 14, 2024
Merged

core: Fix compile errors on GCC 14#1687
BareosBot merged 4 commits intobareos:masterfrom
csfore:include-algorithm

Conversation

@csfore
Copy link
Contributor

@csfore csfore commented Jan 27, 2024

Starting in GCC 14, it will no longer include <algorithm> by default, resulting in compile errors for various projects.

https://gcc.gnu.org/gcc-14/porting_to.html

Errors:

core/src/cats/sql_get.cc:1309:42: error: cannot convert 'std::vector<std::__cxx11::basic_string<char> >::iterator' to `const char*'

  1309 | jobids.erase(std::remove(jobids.begin(), jobids.end(),
    remove_jobid),

core/src/stored/append.cc:78:3: error: `for_each' was not declared in this scope

 78 |   for_each(attributes_.begin(), attributes_.end(),

core/src/dird/ua_prune.cc:897:27: error: `remove_if' is not a member of `std'; did you mean `remove_cv'?

  897 |     prune_list.erase(std::remove_if(prune_list.begin(),
     prune_list.end(),

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Check backport line
  • Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR

@arogge
Copy link
Member

arogge commented Jan 31, 2024

Thank you for taking the time to fix this. I'll also backport this change into Bareos 23. Do you also need this in older versions (i.e. 22 and 21)?

@arogge arogge mentioned this pull request Jan 31, 2024
6 tasks
@csfore
Copy link
Contributor Author

csfore commented Jan 31, 2024

Happy to help! If it's not too much trouble, backporting to 22 would be nice, thank you!

Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

I guess you're bulding without gtest installed. There is another missing #include <algorithm> in core/src/tests/addresses_and_ports_config.cc
Would you fix that aswell or should I do it?

@csfore
Copy link
Contributor Author

csfore commented Feb 4, 2024

Sorry for the delayed response! I'll be happy to do it if you haven't already.

@arogge
Copy link
Member

arogge commented Feb 6, 2024

Sure, go on. I'll happily backport it afterwards :)

@arogge arogge mentioned this pull request Feb 13, 2024
6 tasks
csfore and others added 4 commits February 14, 2024 10:23
Starting in GCC 14, it will no longer include <algorithm> by default,
resulting in compile errors for various projects.

https://gcc.gnu.org/gcc-14/porting_to.html

Errors:

core/src/cats/sql_get.cc:1309:42: error: cannot convert
'std::vector<std::__cxx11::basic_string<char> >::iterator' to
`const char*'

  1309 | jobids.erase(std::remove(jobids.begin(), jobids.end(),
    remove_jobid),

core/src/stored/append.cc:78:3: error: `for_each' was not declared in
this scope

 78 |   for_each(attributes_.begin(), attributes_.end(),

core/src/dird/ua_prune.cc:897:27: error: `remove_if' is not a member
of `std'; did you mean `remove_cv'?

  897 |     prune_list.erase(std::remove_if(prune_list.begin(),
     prune_list.end(),

Signed-off-by: Christopher Fore <csfore@posteo.net>
@BareosBot BareosBot merged commit 09316dc into bareos:master Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants