rust-math/fftw

Compiling on macOS fails

maxk11 opened this issue · 2 comments

Hello!

I just tried to compile my project which depends on fftw-src, unfortunately my Mac won't compile and I can't figure out why.

RUST_BACKTRACE=full cargo build
   Compiling rawpointer v0.1.0
   Compiling rustc-serialize v0.3.24
   Compiling ansi_term v0.11.0
   Compiling itertools v0.7.11
   Compiling num-complex v0.2.3
   Compiling coreaudio-sys v0.2.3
   Compiling fftw-src v0.3.0
   Compiling matrixmultiply v0.1.15
   Compiling ndarray v0.12.1
   Compiling coreaudio-rs v0.9.1
   Compiling cpal v0.10.0
error: failed to run custom build command for `fftw-src v0.3.0`

Caused by:
  process didn't exit successfully: `/Users/max/Development/MyProjecttest/target/debug/build/fftw-src-7becbacca0ec1524/build-script-build` (exit code: 101)
--- stdout
Running: "./configure" "--with-pic" "--enable-static" "--prefix=/Users/max/Development/MyProjecttest/target/debug/build/fftw-src-e2f282ac7efc1251/out" "--enable-single"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... x86_64-apple-darwin19.0.0
checking host system type... x86_64-apple-darwin19.0.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for C compiler vendor... clang
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin19.0.0 file names to x86_64-apple-darwin19.0.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin19.0.0 file names to toolchain format... func_convert_file_noop
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin19.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for ocamlbuild... no
checking whether C compiler accepts -mtune=native... yes
checking whether C compiler accepts -fstrict-aliasing... yes
checking whether C compiler accepts -ffast-math... yes
checking whether C compiler accepts -O3 -fomit-frame-pointer -mtune=native -fstrict-aliasing -ffast-math... yes
checking for ANSI C header files... (cached) yes
checking libintl.h usability... no
checking libintl.h presence... no
checking for libintl.h... no
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking c_asm.h usability... no
checking c_asm.h presence... no
checking for c_asm.h... no
checking intrinsics.h usability... no
checking intrinsics.h presence... no
checking for intrinsics.h... no
checking for stdint.h... (cached) yes
checking mach/mach_time.h usability... yes
checking mach/mach_time.h presence... yes
checking for mach/mach_time.h... yes
checking sys/sysctl.h usability... yes
checking sys/sysctl.h presence... yes
checking for sys/sysctl.h... yes
checking altivec.h usability... no
checking altivec.h presence... no
checking for altivec.h... no
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for long double... yes
checking for hrtime_t... no
checking size of int... 4
checking size of unsigned int... 4
checking size of long... 8
checking size of unsigned long... 8
checking size of long long... 8
checking size of unsigned long long... 8
checking size of size_t... 8
checking size of ptrdiff_t... 8
checking for uintptr_t... yes
checking size of float... 4
checking size of double... 8
checking size of fftw_r2r_kind... 4
checking for working alloca.h... yes
checking for alloca... yes
checking for working strtod... yes
checking for vprintf... yes
checking for _doprnt... no
checking for sin in -lm... yes
checking for BSDgettimeofday... no
checking for gettimeofday... yes
checking for gethrtime... no
checking for read_real_time... no
checking for time_base_to_time... no
checking for drand48... yes
checking for sqrt... yes
checking for memset... yes
checking for posix_memalign... yes
checking for memalign... no
checking for _mm_malloc... no
checking for _mm_free... no
checking for clock_gettime... yes
checking for mach_absolute_time... yes
checking for sysctl... yes
checking for abort... yes
checking for sinl... yes
checking for cosl... yes
checking for snprintf... yes
checking whether sinl is declared... yes
checking whether cosl is declared... yes
checking whether sinq is declared... no
checking whether cosq is declared... no
checking whether memalign is declared... no
checking whether drand48 is declared... yes
checking whether srand48 is declared... yes
checking whether posix_memalign is declared... yes
checking for _rtc intrinsic... no
checking for isnan... yes
checking whether C compiler accepts -mpreferred-stack-boundary=4... no
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... gfortran
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether gfortran accepts -g... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for gfortran option to produce PIC... -fno-common
checking if gfortran PIC flag -fno-common works... yes
checking if gfortran static flag -static works... no
checking if gfortran supports -c -o file.o... yes
checking if gfortran supports -c -o file.o... (cached) yes
checking whether the gfortran linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin19.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking how to get verbose linking output from gfortran... -v
checking for Fortran 77 libraries of gfortran...  -L/usr/local/Cellar/gcc/9.2.0_2/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0 -L/usr/local/Cellar/gcc/9.2.0_2/lib/gcc/9/gcc/x86_64-apple-darwin19/9.2.0/../../.. -lgfortran -lquadmath -lm
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking whether a cycle counter is available... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating support/Makefile
config.status: creating genfft/Makefile
config.status: creating kernel/Makefile
config.status: creating simd-support/Makefile
config.status: creating dft/Makefile
config.status: creating dft/scalar/Makefile
config.status: creating dft/scalar/codelets/Makefile
config.status: creating dft/simd/Makefile
config.status: creating dft/simd/common/Makefile
config.status: creating dft/simd/sse2/Makefile
config.status: creating dft/simd/avx/Makefile
config.status: creating dft/simd/avx-128-fma/Makefile
config.status: creating dft/simd/avx2/Makefile
config.status: creating dft/simd/avx2-128/Makefile
config.status: creating dft/simd/avx512/Makefile
config.status: creating dft/simd/kcvi/Makefile
config.status: creating dft/simd/altivec/Makefile
config.status: creating dft/simd/vsx/Makefile
config.status: creating dft/simd/neon/Makefile
config.status: creating dft/simd/generic-simd128/Makefile
config.status: creating dft/simd/generic-simd256/Makefile
config.status: creating rdft/Makefile
config.status: creating rdft/scalar/Makefile
config.status: creating rdft/scalar/r2cf/Makefile
config.status: creating rdft/scalar/r2cb/Makefile
config.status: creating rdft/scalar/r2r/Makefile
config.status: creating rdft/simd/Makefile
config.status: creating rdft/simd/common/Makefile
config.status: creating rdft/simd/sse2/Makefile
config.status: creating rdft/simd/avx/Makefile
config.status: creating rdft/simd/avx-128-fma/Makefile
config.status: creating rdft/simd/avx2/Makefile
config.status: creating rdft/simd/avx2-128/Makefile
config.status: creating rdft/simd/avx512/Makefile
config.status: creating rdft/simd/kcvi/Makefile
config.status: creating rdft/simd/altivec/Makefile
config.status: creating rdft/simd/vsx/Makefile
config.status: creating rdft/simd/neon/Makefile
config.status: creating rdft/simd/generic-simd128/Makefile
config.status: creating rdft/simd/generic-simd256/Makefile
config.status: creating reodft/Makefile
config.status: creating threads/Makefile
config.status: creating api/Makefile
config.status: creating mpi/Makefile
config.status: creating libbench2/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating doc/FAQ/Makefile
config.status: creating tools/Makefile
config.status: creating tools/fftw_wisdom.1
config.status: creating tools/fftw-wisdom-to-conf
config.status: creating m4/Makefile
config.status: creating fftw.pc
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

--- stderr
thread 'main' panicked at 'failed to execute `"./configure" "--with-pic" "--enable-static" "--prefix=/Users/max/Development/MyProjecttest/target/debug/build/fftw-src-e2f282ac7efc1251/out" "--enable-single"`: No such file or directory (os error 2)', /Users/max/.cargo/registry/src/github.com-1ecc6299db9ec823/fftw-src-0.3.0/build.rs:128:13
stack backtrace:
   0:        0x1040025c5 - backtrace::backtrace::libunwind::trace::h5374dc6304209fb0
                               at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1:        0x1040025c5 - backtrace::backtrace::trace_unsynchronized::hc6c40d142cd2a86c
                               at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2:        0x1040025c5 - std::sys_common::backtrace::_print_fmt::h070478e0aa6dc01e
                               at src/libstd/sys_common/backtrace.rs:76
   3:        0x1040025c5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h66f38d4abb2e41c1
                               at src/libstd/sys_common/backtrace.rs:60
   4:        0x104022c70 - core::fmt::write::h4f487e714088986d
                               at src/libcore/fmt/mod.rs:1030
   5:        0x103ffd71b - std::io::Write::write_fmt::h7bd7b6fe8b47c5fb
                               at src/libstd/io/mod.rs:1412
   6:        0x10400445a - std::sys_common::backtrace::_print::hcf7e952e5633d242
                               at src/libstd/sys_common/backtrace.rs:64
   7:        0x10400445a - std::sys_common::backtrace::print::hbc3f189fef9884dc
                               at src/libstd/sys_common/backtrace.rs:49
   8:        0x10400445a - std::panicking::default_hook::{{closure}}::heee79636c241547c
                               at src/libstd/panicking.rs:196
   9:        0x104004165 - std::panicking::default_hook::hfcbd07059d15441e
                               at src/libstd/panicking.rs:210
  10:        0x104004b27 - std::panicking::rust_panic_with_hook::h0c4b67125f55410a
                               at src/libstd/panicking.rs:473
  11:        0x10400469d - std::panicking::continue_panic_fmt::h0e74ab2b215a1401
                               at src/libstd/panicking.rs:380
  12:        0x10402ef8e - std::thread::local::fast::Key<T>::try_initialize::hcdc98eb893033f5a
  13:        0x10377566f - build_script_build::run::h3084bae935ca40b9
                               at /Users/max/.cargo/registry/src/github.com-1ecc6299db9ec823/fftw-src-0.3.0/build.rs:128
  14:        0x1037750e2 - build_script_build::build_fftw::hbd8211b50647c590
                               at /Users/max/.cargo/registry/src/github.com-1ecc6299db9ec823/fftw-src-0.3.0/build.rs:107
  15:        0x103774bf5 - build_script_build::download_archive_unix::h856e9ae03b1ec14a
                               at /Users/max/.cargo/registry/src/github.com-1ecc6299db9ec823/fftw-src-0.3.0/build.rs:101
  16:        0x103775a72 - build_script_build::main::h04b4af8bbc90ff90
                               at /Users/max/.cargo/registry/src/github.com-1ecc6299db9ec823/fftw-src-0.3.0/build.rs:141
  17:        0x10377af62 - std::rt::lang_start::{{closure}}::haf9045e08fd844ed
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/rt.rs:64
  18:        0x104004578 - std::rt::lang_start_internal::{{closure}}::h63f39619c053dac6
                               at src/libstd/rt.rs:49
  19:        0x104004578 - std::panicking::try::do_call::ha1a4587e2a4eb439
                               at src/libstd/panicking.rs:292
  20:        0x10400be4f - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  21:        0x104004f8e - std::panicking::try::h840ae8cb372083d2
                               at src/libstd/panicking.rs:271
  22:        0x104004f8e - std::panic::catch_unwind::hae56a990bf6a45eb
                               at src/libstd/panic.rs:394
  23:        0x104004f8e - std::rt::lang_start_internal::hcf96e32a124891dc
                               at src/libstd/rt.rs:48
  24:        0x10377af42 - std::rt::lang_start::h1520e100a35f328d
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/rt.rs:64
  25:        0x103775e12 - build_script_build::main::h04b4af8bbc90ff90

I tried the ./configure ... command in a separate shell and it works just fine (exit code is 0).

System Stats are:

neofetch --off
max@Maxs-MacBook-Pro-2.local
-----------------------------------
OS: macOS 10.15.1 19B2106 x86_64
Host: MacBookPro16,1
Kernel: 19.0.0
Uptime: 1 hour, 5 mins
Packages: 40 (brew)
Shell: zsh 5.7.1
Resolution: 1920x1080
DE: Aqua
WM: Quartz Compositor
WM Theme: Blue (Dark)
Terminal: iTerm2
Terminal Font: HackNerdFontComplete-Regular 13
CPU: Intel i9-9980HK (16) @ 2.40GHz
GPU: Intel UHD Graphics 630, AMD Radeon Pro 5500M
Memory: 7464MiB / 16384MiB

Rust Version:

rustc 1.39.0 (4560ea788 2019-11-04)
rustup check
stable-x86_64-apple-darwin - Up to date : 1.39.0 (4560ea788 2019-11-04)

Any help is greatly appreciated :)

duane commented

You can get around this by:

  1. Installing fftw via some other mechanism (e.g. brew install fftw if you use homebrew).
  2. Using the "system" library feature when depending on fftw:
[dependencies.fftw]
version = "^0.5.0"
default-features = false
features = ["system"]

I believe the default-features = false bit is unnecessary but I think it makes it a little more explicit what the intention is.

I have the same problem, @duane's advice to use system feature helped me to make it work with fftw = "0.6.0"

I tried to dig this problem and found that I can successfully execute this ./configure ... command inside FFTW source downloaded by fttw-src. If I manually reproduce actions fftw-src's build.rs does (download source, unpack and execute ./configure ...) then everything works fine too. config.log files are virtually identical in both cases and differ only by some random paths which change from run to run, both config.log ends with configure: exit 0. Probably it is some problem in environment variables or such kind of stuff which can differ between running from Rust and terminal.