Error: failed to run custom build command for `ring v0.17.7`

Dear rust community,
I've been stuck here for many hours, this annoying environment setup is driving me crazy. Please help.

my original question is posted on reddit Reddit - Dive into anything

the errors show up when I run cargo test

error: failed to run custom build command for `ring v0.17.7`

Caused by:
  process didn't exit successfully: `/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-827de3097526d2b6/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_7_
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-apple-darwin")
  HOST = Some("x86_64-apple-darwin")
  cargo:rerun-if-env-changed=CC_x86_64-apple-darwin
  CC_x86_64-apple-darwin = None
  cargo:rerun-if-env-changed=CC_x86_64_apple_darwin
  CC_x86_64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-apple-darwin
  CFLAGS_x86_64-apple-darwin = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_apple_darwin
  CFLAGS_x86_64_apple_darwin = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = Some("-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe")
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c"
...

  cargo:warning=********************

  cargo:warning=

  cargo:warning=PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:

  cargo:warning=Preprocessed source(s) and associated run script(s) are located at:

  cargo:warning=clang-4.0: note: diagnostic msg: /var/folders/70/ppz766q11wb5kg54t0ly4dnc0000gn/T/curve25519_64_adx-c43a46.c

  cargo:warning=clang-4.0: note: diagnostic msg: /var/folders/70/ppz766q11wb5kg54t0ly4dnc0000gn/T/curve25519_64_adx-c43a46.sh

  cargo:warning=clang-4.0: note: diagnostic msg: Crash backtrace is located in

  cargo:warning=clang-4.0: note: diagnostic msg: /Users/wangmiao/Library/Logs/DiagnosticReports/clang-4.0_<YYYY-MM-DD-HHMMSS>_<hostname>.crash

  cargo:warning=clang-4.0: note: diagnostic msg: (choose the .crash file that corresponds to your crash)

  cargo:warning=clang-4.0: note: diagnostic msg: 

  cargo:warning=

  cargo:warning=********************

  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 254
  cargo:warning=ToolExecError: Command env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/crypto/curve25519/curve25519_64_adx.o" "-c" "crypto/curve25519/curve25519_64_adx.c" with args "x86_64-apple-darwin13.4.0-clang" did not execute successfully (status code exit status: 254).running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/crypto/poly1305/poly1305_vec.o" "-c" "crypto/poly1305/poly1305_vec.c"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/third_party/fiat/asm/fiat_curve25519_adx_mul.o" "-c" "third_party/fiat/asm/fiat_curve25519_adx_mul.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/third_party/fiat/asm/fiat_curve25519_adx_square.o" "-c" "third_party/fiat/asm/fiat_curve25519_adx_square.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/crypto/fipsmodule/ec/p256-nistz.o" "-c" "crypto/fipsmodule/ec/p256-nistz.c"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-chacha-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/chacha-x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-aesni-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/aesni-x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-vpaes-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/vpaes-x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-x86_64-mont-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/x86_64-mont-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-x86_64-mont5-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/x86_64-mont5-macosx.S"

  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-p256-x86_64-asm-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/p256-x86_64-asm-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-aesni-gcm-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/aesni-gcm-x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-ghash-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/ghash-x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-sha512-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/sha512-x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-chacha20_poly1305_x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/chacha20_poly1305_x86_64-macosx.S"
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/184080cde1c35467-sha256-x86_64-macosx.o" "-c" "/Users/wangmiao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.7/pregenerated/sha256-x86_64-macosx.S"
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0
  exit status: 0

  --- stderr


  error occurred: Command env -u IPHONEOS_DEPLOYMENT_TARGET "/Users/wangmiao/anaconda3/bin/x86_64-apple-darwin13.4.0-clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-I" "include" "-I" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-gfull" "-DNDEBUG" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/build/ring-27f4b0dbe6fe65d5/out/crypto/curve25519/curve25519_64_adx.o" "-c" "crypto/curve25519/curve25519_64_adx.c" with args "x86_64-apple-darwin13.4.0-clang" did not execute successfully (status code exit status: 254).


warning: build failed, waiting for other jobs to finish...

It seems the cc compiler that’s invoked in Ring’s build script is the clang in your anaconda environment. Do you have a system clang installed.
If so try invoking the build not from the anaconda prompt, or deactivate it or remove it from PATH.

Anaconda and Strawberry Perl, although nice for python and perl, are known to interfere with system builds.

Thanks a lot, did I make it right

$ clang --version

clang version 4.0.1 (tags/RELEASE_401/final)

Target: x86_64-apple-darwin21.6.0

Thread model: posix

InstalledDir: /Users/wangmiao/anaconda3/bin

$ export PATH="/Library/Developer/CommandLineTools/usr/bin:/usr/bin:/Users/wangmiao/.cargo/bin:Applications/MAMP/Library/bin:/Users/wangmiao/.nvm/versions/node/v18.10.0/bin:/usr/local/opt/openssl/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS"

$ clang --version

Apple clang version 14.0.0 (clang-1400.0.29.202)

Target: x86_64-apple-darwin21.6.0

Thread model: posix

InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Then I rerun cargo test, but the mistake still persists.

I believe your guess is correct. I deactivated the base environment and activated another environment, and the error changed.

   Compiling flashlight v1.0.0 (/Users/wangmiao/Playground/GL/flashlight)
error: linking with `cc` failed: exit status: 1
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/Users/wangmiao/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin:/usr/bin:/Users/wangmiao/.cargo/bin:Applications/MAMP/Library/bin:/Users/wangmiao/.nvm/versions/node/v18.10.0/bin:/usr/local/opt/openssl/bin:/Users/wangmiao/anaconda3/envs/jina/bin:/Users/wangmiao/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "x86_64" "-m64" "/var/folders/70/ppz766q11wb5kg54t0ly4dnc0000gn/T/rustcFcCawy/symbols.o" 
...
"/Users/wangmiao/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-37be1cf71fc9b666.rlib" "/Users/wangmiao/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-11c3039f74959a20.rlib" "-framework" "SystemConfiguration" "-framework" "Security" "-framework" "CoreFoundation" "-framework" "SystemConfiguration" "-lpq" "-liconv" "-framework" "CoreFoundation" "-lSystem" "-lc" "-lm" "-L" "/Users/wangmiao/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/wangmiao/Playground/GL/flashlight/target/debug/deps/flashlight-6e01a8db1d0013f4" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: entry point (_main) undefined. for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: could not compile `flashlight` (lib test) due to previous error

So Ring now appears to compile. I think the error now has to do with your project structure. Do you have a lib named test?
How are you testing?
Can you maybe create a git repo which we can take a look?

Thank you, you've already helped me identify the main problem. I'll open a new question if needed.