surge-synthesizer / surge

Synthesizer plug-in (previously released as Vember Audio Surge)
https://surge-synthesizer.github.io/
GNU General Public License v3.0
3.13k stars 400 forks source link

FreeBSD / Clang18 build fails: error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled] #7730

Open yurivict opened 3 months ago

yurivict commented 3 months ago

Bug Description:

In file included from /wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/surge-release_xt_1.3.2/libs/fmt/src/os.cc:13:
In file included from /wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/surge-release_xt_1.3.2/libs/fmt/include/fmt/os.h:16:
/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/surge-release_xt_1.3.2/libs/fmt/include/fmt/format.h:2747:23: error: use of infinity is undefined behavior due to the currently enabled floating-point options [-Werror,-Wnan-infinity-disabled]
 2747 |   constexpr T inf = T(std::numeric_limits<double>::infinity());
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Surge XT Version 1.3.2

Reproduction Steps: regular build

Computer Information (please complete the following!):

log

baconpaul commented 3 months ago

Which compiler are you using? Thanks

baconpaul commented 3 months ago

Oh I see you say that. Clang 18.

yurivict commented 3 months ago

-Wno-nan-infinity-disabled is a workaround.

baconpaul commented 2 months ago

So in a bit of a mystery, using clang-18.1 on windows I don't get any error building surge at head.

I havent' tried on linux - we just fixed our pipeline actions to use 18.1

yurivict commented 2 months ago

So in a bit of a mystery, using clang-18.1 on windows I don't get any error building surge at head.

The c++ library that is used impacts errors generated by clang.

baconpaul commented 2 months ago

Yeah definitely a libc or other os provided dep generating the error not on of our deps.

yurivict commented 2 months ago

You can easily reproduce the problem using these steps:

  1. Install the FreeBSD VM image into VirtualBox.
  2. Boot FreeBSD
  3. Install git: pkg install git
  4. Check out the ports tree: git clone https://git.FreeBSD.org/ports.git /usr/ports
  5. cd /usr/ports/audio/surge-synthesizer-xt-lv2
  6. Install dependencies: pkg install -A `make missing`
  7. Build: make

The options mitigating the problem are in the Makefile there.

baconpaul commented 2 months ago

Is that an ironic use of the word easily? ;)

yurivict commented 2 months ago

It's easy because there are well-described steps without much chance of failure. Compare this to the situation when original research is needed with many unknowns.