grovesNL / spirv_cross

Safe Rust wrapper around SPIRV-Cross
Apache License 2.0
86 stars 42 forks source link

Unable to build on MacOS #176

Open spencerkohan opened 2 years ago

spencerkohan commented 2 years ago

So I am trying to fork this library in order to add the functionality to be able to list types via the reflection API. As far as I can tell, it's only possible to query a type given the id, but if there's already a way to get all the type id's, that would already solve my problem.

But if that is not the case, I am running into an issue building this library locally.

I have cloned the repo to my workstation, and I am trying to build with cargo:

cargo build

And I get the following error:

The following warnings were emitted during compilation:

warning: clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_cfg.cpp'
warning: clang: error: no input files
warning: clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_cross.cpp'
warning: clang: error: no input files
warning: clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_cross_parsed_ir.cpp'
warning: clang: error: no input files
warning: src/wrapper.cpp:4:10: fatal error: 'vendor/SPIRV-Cross/spirv_cross_util.hpp' file not found
warning: #include "vendor/SPIRV-Cross/spirv_cross_util.hpp"
warning:          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: 1 error generated.
warning: clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_parser.cpp'
warning: clang: error: no input files

error: failed to run custom build command for `spirv_cross v0.23.1 (/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/spirv_cross)`

Caused by:
  process didn't exit successfully: `/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-4fa09f7a5a708f06/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-apple-darwin")
  HOST = Some("aarch64-apple-darwin")
  CXX_aarch64-apple-darwin = None
  CXX_aarch64_apple_darwin = None
  HOST_CXX = None
  CXX = None
  CXXFLAGS_aarch64-apple-darwin = None
  CXXFLAGS_aarch64_apple_darwin = None
  HOST_CXXFLAGS = None
  CXXFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,llvm14-builtins-abi,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,v8.1a,v8.2a,v8.3a,v8.4a,vh")
  CXX_aarch64-apple-darwin = None
  CXX_aarch64_apple_darwin = None
  HOST_CXX = None
  CXX = None
  CXXFLAGS_aarch64-apple-darwin = None
  CXXFLAGS_aarch64_apple_darwin = None
  HOST_CXXFLAGS = None
  CXXFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,llvm14-builtins-abi,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,v8.1a,v8.2a,v8.3a,v8.4a,vh")
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" "-DSPIRV_CROSS_WRAPPER_NO_EXCEPTIONS" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-DSPIRV_CROSS_WRAPPER_MSL" "-std=c++14" "-o" "/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-d81183c040bf4aa5/out/src/vendor/SPIRV-Cross/spirv_cross_parsed_ir.o" "-c" "src/vendor/SPIRV-Cross/spirv_cross_parsed_ir.cpp"
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" "-DSPIRV_CROSS_WRAPPER_NO_EXCEPTIONS" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-DSPIRV_CROSS_WRAPPER_MSL" "-std=c++14" "-o" "/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-d81183c040bf4aa5/out/src/vendor/SPIRV-Cross/spirv_cross.o" "-c" "src/vendor/SPIRV-Cross/spirv_cross.cpp"
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" "-DSPIRV_CROSS_WRAPPER_NO_EXCEPTIONS" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-DSPIRV_CROSS_WRAPPER_MSL" "-std=c++14" "-o" "/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-d81183c040bf4aa5/out/src/wrapper.o" "-c" "src/wrapper.cpp"
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" "-DSPIRV_CROSS_WRAPPER_NO_EXCEPTIONS" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-DSPIRV_CROSS_WRAPPER_MSL" "-std=c++14" "-o" "/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-d81183c040bf4aa5/out/src/vendor/SPIRV-Cross/spirv_cfg.o" "-c" "src/vendor/SPIRV-Cross/spirv_cfg.cpp"
  cargo:warning=clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_cfg.cpp'
  cargo:warning=clang: error: no input files
  exit status: 1
  running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" "-DSPIRV_CROSS_WRAPPER_NO_EXCEPTIONS" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-DSPIRV_CROSS_WRAPPER_MSL" "-std=c++14" "-o" "/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-d81183c040bf4aa5/out/src/vendor/SPIRV-Cross/spirv_parser.o" "-c" "src/vendor/SPIRV-Cross/spirv_parser.cpp"
  cargo:warning=clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_cross.cpp'
  cargo:warning=clang: error: no input files
  exit status: 1
  cargo:warning=clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_cross_parsed_ir.cpp'
  cargo:warning=clang: error: no input files
  cargo:warning=src/wrapper.cpp:4:10: fatal error: 'vendor/SPIRV-Cross/spirv_cross_util.hpp' file not found
  cargo:warning=#include "vendor/SPIRV-Cross/spirv_cross_util.hpp"
  cargo:warning=         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  exit status: 1
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=clang: error: no such file or directory: 'src/vendor/SPIRV-Cross/spirv_parser.cpp'
  cargo:warning=clang: error: no input files
  exit status: 1

  --- stderr

  error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-Wall" "-Wextra" "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" "-DSPIRV_CROSS_WRAPPER_NO_EXCEPTIONS" "-DSPIRV_CROSS_WRAPPER_GLSL" "-DSPIRV_CROSS_WRAPPER_HLSL" "-DSPIRV_CROSS_WRAPPER_MSL" "-std=c++14" "-o" "/Users/spencerkohan/projects/rust/vulkan_dsl/spirv_cross/target/debug/build/spirv_cross-d81183c040bf4aa5/out/src/wrapper.o" "-c" "src/wrapper.cpp" with args "c++" did not execute successfully (status code exit status: 1).

So it looks like it's having trouble finding a header from the spire-cross cpp implementation.

Is there a step I am missing to make this work? I have the Vulkan SDK installed locally. Also this library works fine if I include it as a cargo dependency.

charles-r-earp commented 1 year ago

Try git submodule update --init --recursive.