Failing build on Ubuntu 18.0.4

Description

We're using Conan as a package manager (cassandra-driver/2.13.0/bincrafters/stable), which comes pre-built for GCC with stdlibc++. We're using Clang 9.0.0 and libc+, which requires us to build the code from source. The library doesn't compile due to warnings being treated as errors. Example below (I had to manually remove the -Werror flag, due to error: missing in the output).

src/utils.cpp:106:65: warning: 'ptr_fun<int, int>' is deprecated [-Wdeprecated-declarations]
std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun<int, int>(::isspace))));

This is a good example where -Werror can be harmful. It's a great way to minimize warnings during development, but would ease the usage of the library a lot of we can remove that compiler flag through CMake. I'm more than happy to contribute if possible! It's hard to catch up with all new different compilers so this can be a very minor change resulting in a big improvement for us consumers of this library.

clang version 10.0.0 (top of tree, same error on 9.0.0)
cmake version 3.16.0-rc1
Ubuntu 18.04.3 LTS
Compiler flags: -stdlib=libc++
Linker flags: -lc++

Environment

None

Activity

Show:
Michael Fero
November 2, 2019, 5:57 AM

Sorry for the inconvenience -Werror has caused you. We build against clang; however the default version installed in Ubuntu 18.04 LTS is 6.0.0 and we like to stay on base packages whenever possible. I do understand LLVM has installation packages available for newer stable versions of clang so your complaint is understandable. We may investigate removing -Werror in the future and delegating only on our CI, but for now I have created a patch that should address your issue by disabling the deprecated warning as error.

Would you be able to apply the following patch and ensure this works for your use case?

Fredrik Slättman
November 2, 2019, 6:29 AM

I will apply the patch and get back to you latest on Monday. Thank you.

Fredrik Slättman
November 2, 2019, 9:01 PM

Instead of applying the fix I created a PR with removing std::ptr_fun, since it’s deprecated since C++11. And completely removed in C++17.

 

Michael Fero
November 3, 2019, 12:45 AM
Edited

Thank you for the PR, but unfortunately we cannot use lambda features that were introduced in C++11; as our code base is C++03 compliant and the C API is C98/99 compliant. There are older compilers that we still support that do not have C++11 support.

Assignee

Unassigned

Reporter

Fredrik Slättman

Labels

None

PM Priority

None

Reproduced in

None

External issue ID

None

Doc Impact

None

Reviewer

Michael Penick

Size

None

Priority

Major