View Issue Details

IDProjectCategoryView StatusLast Update
0010041ardourbugspublic2025-11-20 14:21
Reporterlyican53 Assigned To 
PrioritynormalSeveritytweakReproducibilityalways
Status newResolutionopen 
PlatformGNUOSLinuxOS Version(any)
Summary0010041: The affection of gcc bug 79700(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700) when build with gcc < 14
DescriptionThe gcc bug 79700: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79700 described that std::fabsf is missed from cmath
But in the source code of ardour : https://github.com/Ardour/ardour:
I find the source code file named libs/surfaces/maschine2/m2device.h (https://github.com/Ardour/ardour/blob/master/libs/surfaces/maschine2/m2device.h) used the std::fabsf by including <cmath>:

27 #include <cmath>
...
65 protected:
66 void bump_blink () {
67 _blink_counter = (_blink_counter + 1) % 12;
68 _blink_shade = std::fabsf (1.f - _blink_counter / 6.f);
69 }

I tried to build with gcc 12, then error occurred:
m2device.h:68:45: error: 'fabsf' is not a member of 'std'; did you mean 'fabs'?

And I search for many related workarounds in other github repos, there are many similar situations, and they replaced the std::fabsf to std::fabs.
So I think maybe these workarounds can also work in aurdour.
Steps To ReproduceI did not try to build the whole ardour project. But I try my best to reproduce the problem might be encountered in building process:
I first try to construct a cpp code that is similar to m2device.h:
#include <cmath>
float blink_shade(int blink_counter) {
    return std::fabsf(1.f - blink_counter / 6.f);
}

int main() {
    return blink_shade(1) == 0.f;
}

I used the gcc-12 to build this file:g++-12 -std=c++11 m2device_fabsf_repro.cpp -o m2device_fabsf_repro
and the error is :
m2device_fabsf_repro.cpp: In function 'float blink_shade(int)':
m2device_fabsf_repro.cpp:6:17: error: 'fabsf' is not a member of 'std'; did you mean 'fabs'?
    6 | return std::fabsf(1.f - blink_counter / 6.f);
      | ^~~~~
      | fabs


Then I tried to simulate the build process in Ardour. I constructed a simple situation to include the m2device.h:

#include <cmath>
#include "stubs/hidapi.h"
#include "stubs/cairomm/refptr.h"
#include "stubs/cairomm/surface.h"
#include "stubs/pbd/signals.h"

#include "../test_projects/ardour/libs/surfaces/maschine2/m2device.h"

int main() {
    // No need to instantiate; inclusion alone triggers the std::fabsf reference.
    return 0;
}

build with: g++-12 -std=c++11 -I stubs m2device_header_repro.cpp -o /tmp/m2device_header_repro
and error occurred:
gccbug/../test_projects/ardour/libs/surfaces/maschine2/m2device.h: In member function 'void ArdourSurface::M2Device::bump_blink()':
gccbug/../test_projects/ardour/libs/surfaces/maschine2/m2device.h:68:45: error: 'fabsf' is not a member of 'std'; did you mean 'fabs'?
   68 | _blink_shade = std::fabsf (1.f - _blink_counter / 6.f);
      | ^~~~~
      | fabs
So I think if we build Ardour with gcc < 14 , the m2device.h will cause the compiler error due to gcc bug 79700

Tagsgcc

Activities

lyican53

2025-11-20 13:53

reporter   ~0029530

this is the code to reproduce this affection
reproduce.zip (19,258 bytes)

lyican53

2025-11-20 14:06

reporter   ~0029531

similar workarounds in GitHub: https://github.com/le-smog/GameJam2023/commit/1826b19d9ed16aa363e2b6a1dc4c1e40054972cc

x42

2025-11-20 14:21

administrator   ~0029532

Well, for the case at hand we could just use C99 `fabsf` instead of std::

keep in mind that machine ctrl surface is currently not useful, and not compiled by default.

Issue History

Date Modified Username Field Change
2025-11-20 13:52 lyican53 New Issue
2025-11-20 13:52 lyican53 Tag Attached: gcc
2025-11-20 13:53 lyican53 Note Added: 0029530
2025-11-20 13:53 lyican53 File Added: reproduce.zip
2025-11-20 14:06 lyican53 Note Added: 0029531
2025-11-20 14:21 x42 Note Added: 0029532