Skip to content

Fix build issues with deprecated functions in C++17#1468

Merged
dbogdanov merged 1 commit into
MTG:masterfrom
fergarciadlc:fix/cpp11-deprecated-functions
Apr 1, 2025
Merged

Fix build issues with deprecated functions in C++17#1468
dbogdanov merged 1 commit into
MTG:masterfrom
fergarciadlc:fix/cpp11-deprecated-functions

Conversation

@fergarciadlc
Copy link
Copy Markdown
Contributor

Overview

This PR fixes build errors encountered when compiling Essentia with C++17 due to the removal of functions deprecated in C++11 (std::bind1st, std::binary_function). These deprecated functions have been replaced by the recommended alternatives (std::bind with placeholders and direct implementation without inheriting from std::binary_function).

Motivation

Ensures compatibility and successful compilation with modern C++ standards (C++17 and newer), improving maintainability and future-proofing the codebase.

Related Issues and Pull Requests

Solution

Inspired by the work of @wo80 in commit c98daf9, this PR updates the codebase by:

  • Removing the use of std::binary_function, which was deprecated in C++11 and removed in C++17.
  • Replaced deprecated std::bind1st with std::bind using placeholders (std::placeholders::_1).

These changes align with the ongoing efforts to modernize the build system, as discussed in Issue #1398, which focuses on migrating to CMake and enhancing compatibility with newer toolchains.

Testing

The updates have been tested using the lightweight Waf (with the --std=c++17 flag) build system with the following configuration:

ESS_DIR=$(pwd)
python3 waf configure --build-static --static-dependencies --std=c++17 --lightweight= --out=$ESS_DIR/build/
python3 waf -v
python3 waf install  # May require sudo privileges

Testing was conducted on an Apple Silicon M1 system running macOS Sonoma 14.7.3.

Notes:

  • While this PR focuses on updating deprecated functions, it does not address the broader build system migration to CMake.
  • Further testing on other platforms and configurations is recommended to ensure comprehensive compatibility.

- `std::binary_function` is deprecated in C++11 and removed in C++17: https://en.cppreference.com/w/cpp/utility/functional/binary_function
- `std::binary_function` is deprecated in C++11 and removed in C++17: https://en.cppreference.com/w/cpp/utility/functional/bind12
@dbogdanov dbogdanov merged commit 1f48684 into MTG:master Apr 1, 2025
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