surge-synthesizer / surge

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

FreeBSD Build fails: build sets invalid option '-Wno-nan-infinity-disabled' [-Werror,-Wunknown-warning-option] #7754

Open yurivict opened 1 month ago

yurivict commented 1 month ago

Bug Description: See the log.

Surge XT Version

Reproduction Steps: Regular build.

Expected Behavior: A clear and concise description of what you expected to happen.

Screenshots: If applicable, add screenshots/GIF/videos to help explain your problem.

Computer Information (please complete the following!):

Additional Information: I think that the unknown warning -Wno-nan-infinity-disabled from some of the dependencies is elevated to the error status by the -Werror option that you set.

baconpaul commented 1 month ago

Link to #7730

looks like we don’t work with clang 18 yup

yurivict commented 1 month ago

Actually I would like to correct my original post.

The problem occurs with clang-16. clang-18 fixed the problem.

nan-infinity-disabled isn't known to the earlier clang which is elevated to error by -Werror.

baconpaul commented 1 month ago

Hmm

paul ~/dev/music/surge (release-xt/1.3.4) % grep -r "infinity-disabled" cmake libs src CMakeLists.txt scripts 
paul ~/dev/music/surge (release-xt/1.3.4) % 

I can't find where we set that. Is your build process changing flags somewhere? or have you changed the source of some of the libraries?

baconpaul commented 1 month ago

Yeah i looked in your log. At the top is this


--MAKE_ENV--
NINJA_STATUS="[%p %s/%t] " XDG_DATA_HOME=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work  XDG_CONFIG_HOME=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work  XDG_CACHE_HOME=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/.cache  HOME=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work TMPDIR="/tmp" PATH=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin PKG_CONFIG_LIBDIR=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES DESTDIR=/wrkdirs/usr/ports/audio/surge-synthesizer-xt-lv2/work/stage PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -Wno-nan-infinity-disabled -O3 -ffast-math -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing "  CPP="cpp" CPPFLAGS="-isystem /usr/local/include"  LDFLAGS=" -fstack-protector-strong -L/usr/local/lib " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -Wno-nan-infinity-disabled -O3 -ffast-math -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -DPLUGIN_API="" -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Dstrnicmp16=strncasecmp -O3 -ffast-math -isystem /usr/local/include " BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444"
--End MAKE_ENV--

with the relevant section being

CFLAGS="-O2 -pipe  -Wno-nan-infinity-disabled  ...

so it is definitely the case that if you set -Wno-nan-infinity-disabled and then use a compiler that doesn't support it with a package that compilers with Werror on, it will fail, because you've configured it in an error state I guess.

Where does that segment come from? It's not me though so nothing to be done here I don't think!

yurivict commented 1 month ago

I couldn't find -Wno-nan-infinity-disabled either, but it appears after configure is done. Some dependency adds it, but I couldn't track down which one.

In order to isolate from such issues, it's best to disable -Werror in production builds. Some projects use cmake option for this, like ${PROJECT_NAME}_USE_WERROR.

yurivict commented 1 month ago

NINJA is used to build it by the ports framework. It doesn't add any -Wxx arguments.

baconpaul commented 1 month ago

The -Wno.... is in your log that you shared so it is definitely being added by your build system.

I guess I could add a skip werror flag sure when i'm next in the cmake. but really the solution is to not add arbitrary build flags to the build!

baconpaul commented 1 month ago

Oh or just add Wno-unknown-warning-option to the warnings we bypass I guess (and I suppose you could do the same in your eng to patch now).

seems like there’s two things

  1. if clang version is 18 surge needs to add the no man Infinity flag thing which would fix 7730
  2. If build type is released add the no unknown warning thing if the compiler is clang any version

and that should do it right?

yurivict commented 1 month ago

Ah, yes .... Sorry, I didn't notice the obvious.

-Wno-nan-infinity-disabled' was added to mitigate this bug: https://github.com/surge-synthesizer/surge/issues/7730

baconpaul commented 1 month ago

Right. So where you added that perhaps also add -Wno-unknown-warning-option and then this one will be fixed until we fix 7730? See what I mean

yurivict commented 1 month ago

Yes, that's what I am doing.