Grin: error: failed to run custom build command for croaring-sys v0.3.7

Created on 31 Dec 2018  路  11Comments  路  Source: mimblewimble/grin

Env:
iMac pro - macOS Mojave 10.14.2

I had grin floonet node&miner ran smoothly and got coins mined, then I had grin&miner removed and re-git&install, got failed message like "error: failed to run custom build command for croaring-sys v0.3.7".

After investigation, I found the system is using clang with InstalledDir "/Library/Developer/CommandLineTools/usr/bin" which has an old clang version(clang-1000.10.44.4), so I switch clang to InstalledDir "/Applications/Xcode.app" which has a fresh clang version and same as my Macbook pro(build fresh grin without error).

Now I got the up-to-date clang(clang-1000.11.45.5), RUST(1.31.1) and cargo(1.31.0), but still have the same build issue. Even have "cargo clean" issued and cargo reinstalled.

Error logs

Compiling hyper-staticfile v0.3.0
Compiling reqwest v0.9.5
error: failed to run custom build command for croaring-sys v0.3.7
process didn't exit successfully: /Users/.../grin/target/release/build/croaring-sys-20d6d5c35e3a436a/build-script-build (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Wall" "-Wextra" "-std=c11" "-march=native" "-O3" "-o" "/Users/.../grin/target/release/build/croaring-sys-4f7af44253f571e8/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"
exit code: 0
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
running: "ar" "crs" "/Users/.../grin/target/release/build/croaring-sys-4f7af44253f571e8/out/libroaring.a" "/Users/.../grin/target/release/build/croaring-sys-4f7af44253f571e8/out/CRoaring/roaring.o"
exit code: 0
cargo:rustc-link-lib=static=roaring
cargo:rustc-link-search=native=/Users/.../grin/target/release/build/croaring-sys-4f7af44253f571e8/out

--- stderr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:3427:10: error: returning 'int' from a function with incompatible result type '__m128' (vector of 4 'float' values)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:2228:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3115:10: error: invalid conversion between vector type '__m256d' (vector of 4 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3133:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:971:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:982:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:992:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1021:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1032:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1042:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1126:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1136:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1144:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1154:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1164:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1172:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1182:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1192:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1200:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:3427:10: error: returning 'int' from a function with incompatible result type '__m128' (vector of 4 'float' values), err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:2228:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3115:10: error: invalid conversion between vector type '__m256d' (vector of 4 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avxintrin.h:3133:10: error: invalid conversion between vector type '__m256' (vector of 8 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:971:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:982:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:992:10: error: invalid conversion between vector type '__m512d' (vector of 8 'double' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1021:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1032:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1042:10: error: invalid conversion between vector type '__m512' (vector of 16 'float' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1126:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1136:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1144:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1154:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1164:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1172:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1182:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1192:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/avx512fintrin.h:1200:10: error: invalid conversion between vector type '__m512i' (vector of 8 'long long' values) and integer type 'int' of different size, err: true
fatal error: too many errors emitted, stopping now [-ferror-limit=], err: true
thread 'main' panicked at 'Unable to generate bindings: ()', libcore/result.rs:1009:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

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

Most helpful comment

@JohnsonYi Thanks! It worked!!

All 11 comments

clang under /Library/Developer/CommandLineTools and clang under /Applications/Xcode.app are different version.

Use "clang --version" to check the InstalledDir.

If you use a InstalledDir with "/Library/Developer/CommandLineTools/usr/bin", the clang version maybe leg behind,

Use the following command to switch to /Applications/Xcode.app
sudo xcode-select --switch /Applications/Xcode.app

The clang InstalledDir and version will be changed.
clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Compare with my iMac(build failed) and macbook(build fine) by issue "brew list -l"

I found that I installed an extra llvm by "brew install llvm" on iMac which has build issue. So I use command "brew uninstall llvm" to remove it. And package pkg-config remove&install.

Now with the newest clang and without an extra llvm installed, cargo build grin is working fine. Issue closed.

Hi I have a similar issue.
I've got the similar error for cropping-sys v0.3.7 and I tried to do similar things as above, however version of clang in my PC was not changed as below....

$ clang --version
clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

$llvm-gcc --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Does anybody have any good idea?

@maromato you have clang 7, but above has clang 10, as seen by the console output lines /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/...

Please try:

  1. make sure you don't have homebrew clang and or llvm:
brew deps --tree --installed | egrep -e "llvm|clang"
brew cask list --versions | egrep -e "llvm|clang"
brew list --versions | egrep -e "llvm|clang"
  1. upgrade Xcode if not newest

  2. if it still doesn't work to build, maybe ask the guy above for more help :) (I'm not on a mac myself currently)

@sesam I think the discrepancy between the version of clang and Xcode which happened at some point before seems to be the cause and I could not change the clang version any more after that.
Homebrew seems to keep installing older version right now and I'm wondering if there is a way to specify the version of llvm.

Here's output from the code you mentioned,
lvm|clang"
llvm

|clang"

llvm 7.0.1

Don't you have any good idea?
Thanks,

@maromato If you installed an extra llvm, just use "brew uninstall llvm" to remove it, then you will get the original llvm(apple version), try "clang --version" again to check the "InstalledDir", make sure you don't use clang under command line tools. Issue the following command to switch to the correct one,
sudo xcode-select --switch /Applications/Xcode.app

@JohnsonYi Thanks! It worked!!

@JohnsonYi Thanks! i just brew uninstall llvm@4, It worked!

nothing from above worked.
I actually had to

xcode-select --install
brew install --with-toolchain llvm
brew install pkg-config
brew install openssl

and then, as brew suggested,

If you need to have llvm first in your PATH run:
  echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc

For compilers to find llvm you may need to set:
  export LDFLAGS="-L/usr/local/opt/llvm/lib"
  export CPPFLAGS="-I/usr/local/opt/llvm/include"

(as is written in https://github.com/mimblewimble/grin/blob/master/doc/build.md now)

nothing from above worked.
I actually had to

xcode-select --install
brew install --with-toolchain llvm
brew install pkg-config
brew install openssl

and then, as brew suggested,

If you need to have llvm first in your PATH run:
  echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc

For compilers to find llvm you may need to set:
  export LDFLAGS="-L/usr/local/opt/llvm/lib"
  export CPPFLAGS="-I/usr/local/opt/llvm/include"

(as is written in https://github.com/mimblewimble/grin/blob/master/doc/build.md now)

Good for you, you found a workaround for LLVM from homebrew.

Due to macOS has a system default llvm(and clang also), you just need to have xcode up-to-date, and use the llvm and clang under InstalledDir "InstalledDir: /Applications/Xcode.app/..." and remove the extra llvm from homebrew if you did before, it will work smoothly.

And you must have pkg-config, openssl installed also for sure.

brew uninstall llvm@4 works

Was this page helpful?
0 / 5 - 0 ratings