Skip to content

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

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

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

fergarciadlc
Copy link
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