3.3.5 built fine but 3.3.6 (both pl1 and pl2) don't. Both arm* and mips* have LDBL_PREC=53 but 3.3.6 builds fine on mips*, so the issue is Clang-related. It seems -O1 (or higher) combined with -ffast-math makes it emit references to sincos() rather than sin() + cos(). ../libbench2/libbench2.a(verify-lib.o): In function `aphase_shift': verify-lib.c:(.text+0x580): undefined reference to `sincos' ../libbench2/libbench2.a(verify-lib.o): In function `tf_shift': verify-lib.c:(.text+0x1440): undefined reference to `sincos' verify-lib.c:(.text+0x1794): undefined reference to `sincos' cc: error: linker command failed with exit code 1 (use -v to see invocation) https://lists.freebsd.org/pipermail/freebsd-pkg-fallout/Week-of-Mon-20170703/498191.html # fftw3 https://lists.freebsd.org/pipermail/freebsd-pkg-fallout/Week-of-Mon-20170703/498192.html # fftw3-float https://lists.freebsd.org/pipermail/freebsd-pkg-fallout/Week-of-Mon-20170703/498863.html # fftw3-long
Affected FreeBSD versions: 11.0 (clang 3.8), 11.1 (clang 4.0), 12.0 (clang500-import). Workarounds: define USE_GCC=yes or drop -ffast-math.
Err, -ffast-math is a group of flags. The issue is caused by -funsafe-math-optimizations.
Here's a test case: $ cat a.c #include <stdio.h> #include <math.h> int main(int argc, char *argv[]) { printf("%Lf\n", cosl(5)); printf("%Lf\n", sinl(5)); return 0; } $ cc a.c -lm -O1 -funsafe-math-optimizations /tmp/a-718f07.o: In function `main': a.c:(.text+0x18): undefined reference to `sincos' cc: error: linker command failed with exit code 1 (use -v to see invocation)
(In reply to Jan Beich from comment #1) Are you sure 12 is affected?
(In reply to mikael.urankar from comment #4) > Are you sure 12 is affected? Ah, you're right! When writing comment 1 I've only checked whether sincos is emitted but not if libm contains it. comment 3 example builds fine on 12.0 with clang 4.0 and clang 5.0.
Created attachment 184300 [details] Disable unsafe-math-optimizations on armv6 This patch should disable "unsafe-math-optimizations" on armv6. I'm not sure at what point it started working on 12.x, so I just used a generic version check. I don't have the ability to test this, so any feedback would be appreciated.
The 11 branch is missing this commit which solved the problem on 12: base r319047
(In reply to mikael.urankar from comment #7) Ok, I'll change it to check for less than 1200032, then. Thanks!
or you can use (untested) CFLAGS_armv6= -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos \ -fno-builtin-sincosf -fno-builtin-sinf -fno-builtin-cosf \ -fno-builtin-sincosl -fno-builtin-sinl -fno-builtin-cosl
A commit references this bug: Author: jhale Date: Mon Jul 31 11:58:28 UTC 2017 New revision: 446955 URL: https://svnweb.freebsd.org/changeset/ports/446955 Log: Fix build on armv6. The -funsafe-math-optimizations flag in Clang (pulled in by -ffast-math) is emitting references to the sincos() function which is not implemented on versions of FreeBSD < 1200032. Workaround by adding -fno-unsafe-math-optimizations to armv6 CFLAGS. /bin/sh ../libtool --tag=CC --mode=link /nxb-bin/usr/bin/cc -D_THREAD_SAFE -pthread -O2 -pipe -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -o bench bench-bench.o bench-hook.o bench-fftw-bench.o ../threads/libfftw3_threads.la ../libfftw3.la ../libbench2/libbench2.a -lm libtool: link: /nxb-bin/usr/bin/cc -D_THREAD_SAFE -pthread -O2 -pipe -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -o .libs/bench bench-bench.o bench-hook.o bench-fftw-bench.o ../threads/.libs/libfftw3_threads.so ../.libs/libfftw3.so ../libbench2/libbench2.a -lm -pthread -Wl,-rpath -Wl,/usr/local/lib ./libbench2/libbench2.a(verify-lib.o): In function `aphase_shift': verify-lib.c:(.text+0x578): undefined reference to `sincos' ./libbench2/libbench2.a(verify-lib.o): In function `tf_shift': verify-lib.c:(.text+0x13a0): undefined reference to `sincos' verify-lib.c:(.text+0x16e4): undefined reference to `sincos' cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[3]: *** [Makefile:400: bench] Error 1 gmake[3]: Leaving directory '/wrkdirs/usr/ports/math/fftw3/work/fftw-3.3.6-pl2/tests' gmake[2]: *** [Makefile:684: all-recursive] Error 1 gmake[2]: Leaving directory '/wrkdirs/usr/ports/math/fftw3/work/fftw-3.3.6-pl2' gmake[1]: *** [Makefile:549: all] Error 2 gmake[1]: Leaving directory '/wrkdirs/usr/ports/math/fftw3/work/fftw-3.3.6-pl2' *** Error code 1 PR: 220590 Submitted by: jbeich Changes: head/math/fftw3/Makefile
A commit references this bug: Author: jhale Date: Mon Jul 31 12:16:28 UTC 2017 New revision: 446956 URL: https://svnweb.freebsd.org/changeset/ports/446956 Log: MFH: r446955 Fix build on armv6. The -funsafe-math-optimizations flag in Clang (pulled in by -ffast-math) is emitting references to the sincos() function which is not implemented on versions of FreeBSD < 1200032. Workaround by adding -fno-unsafe-math-optimizations to armv6 CFLAGS. /bin/sh ../libtool --tag=CC --mode=link /nxb-bin/usr/bin/cc -D_THREAD_SAFE -pthread -O2 -pipe -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -o bench bench-bench.o bench-hook.o bench-fftw-bench.o ../threads/libfftw3_threads.la ../libfftw3.la ../libbench2/libbench2.a -lm libtool: link: /nxb-bin/usr/bin/cc -D_THREAD_SAFE -pthread -O2 -pipe -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -o .libs/bench bench-bench.o bench-hook.o bench-fftw-bench.o ../threads/.libs/libfftw3_threads.so ../.libs/libfftw3.so ../libbench2/libbench2.a -lm -pthread -Wl,-rpath -Wl,/usr/local/lib ./libbench2/libbench2.a(verify-lib.o): In function `aphase_shift': verify-lib.c:(.text+0x578): undefined reference to `sincos' ./libbench2/libbench2.a(verify-lib.o): In function `tf_shift': verify-lib.c:(.text+0x13a0): undefined reference to `sincos' verify-lib.c:(.text+0x16e4): undefined reference to `sincos' cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[3]: *** [Makefile:400: bench] Error 1 gmake[3]: Leaving directory '/wrkdirs/usr/ports/math/fftw3/work/fftw-3.3.6-pl2/tests' gmake[2]: *** [Makefile:684: all-recursive] Error 1 gmake[2]: Leaving directory '/wrkdirs/usr/ports/math/fftw3/work/fftw-3.3.6-pl2' gmake[1]: *** [Makefile:549: all] Error 2 gmake[1]: Leaving directory '/wrkdirs/usr/ports/math/fftw3/work/fftw-3.3.6-pl2' *** Error code 1 PR: 220590 Submitted by: jbeich Approved by: ports-secteam (blanket) Changes: _U branches/2017Q3/ branches/2017Q3/math/fftw3/Makefile
A commit references this bug: Author: jbeich Date: Wed Oct 10 21:44:42 UTC 2018 New revision: 481771 URL: https://svnweb.freebsd.org/changeset/ports/481771 Log: math/fftw3: drop FreeBSD 11.1 support per EOL PR: 220590 (for tracking) Changes: head/math/fftw3/Makefile