emoon / bgfx-rs

Rust wrapper for BGFX
BSD 2-Clause "Simplified" License
113 stars 7 forks source link

Unable to compile on MacOS 12.0.1 M1 Max #4

Closed tcaer closed 2 years ago

tcaer commented 2 years ago

Hi, I'm unable to build this crate on my MacOS setup. I attached the logs below but I believe it has to do with this issue: bx/include/bx/bx.h:34:2: error: unknown type name 'constexpr'. It seems like on MacOS you may need to specify support for c++11 -std=c++11.

warning:                                                              ^
warning: bgfx/include/bgfx/bgfx.h:20:29: note: expanded from macro 'BGFX_INVALID_HANDLE'
warning: #define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
warning:                             ^
warning: bgfx/include/bgfx/bgfx.h:1329:41: error: expected expression
warning:                         , VertexLayoutHandle _layoutHandle = BGFX_INVALID_HANDLE
warning:                                                              ^
warning: bgfx/include/bgfx/bgfx.h:20:29: note: expanded from macro 'BGFX_INVALID_HANDLE'
warning: #define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
warning:                             ^
warning: bgfx/include/bgfx/bgfx.h:1969:32: error: expected expression
warning:         bool init(const Init& _init = {});
warning:                                       ^
warning: 3 warnings and 20 errors generated.
warning: bgfx/include/bgfx/bgfx.h:3718:40: error: expected expression
warning:                 , VertexLayoutHandle _layoutHandle = BGFX_INVALID_HANDLE
warning:                                                      ^
warning: bgfx/include/bgfx/bgfx.h:20:29: note: expanded from macro 'BGFX_INVALID_HANDLE'
warning: #define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
warning:                             ^
warning: bgfx/include/bgfx/bgfx.h:3749:40: error: expected expression
warning:                 , VertexLayoutHandle _layoutHandle = BGFX_INVALID_HANDLE
warning:                                                      ^
warning: bgfx/include/bgfx/bgfx.h:20:29: note: expanded from macro 'BGFX_INVALID_HANDLE'
warning: #define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
warning:                             ^
warning: bgfx/include/bgfx/bgfx.h:3780:40: error: expected expression
warning:                 , VertexLayoutHandle _layoutHandle = BGFX_INVALID_HANDLE
warning:                                                      ^
warning: bgfx/include/bgfx/bgfx.h:20:29: note: expanded from macro 'BGFX_INVALID_HANDLE'
warning: #define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
warning:                             ^
warning: In file included from bgfx/src/shader.cpp:6:
warning: In file included from bgfx/src/bgfx_p.h:23:
warning: In file included from bgfx/src/config.h:9:
warning: bx/include/bx/bx.h:34:2: error: unknown type name 'constexpr'
warning:         constexpr int32_t kExitSuccess = 0;
warning:         ^
warning: bx/include/bx/bx.h:34:19: error: expected ';' after top level declarator
warning:         constexpr int32_t kExitSuccess = 0;
warning:                          ^
warning:                          ;
warning: bx/include/bx/bx.h:35:2: error: unknown type name 'constexpr'
warning:         constexpr int32_t kExitFailure = 1;
warning:         ^
warning: bx/include/bx/bx.h:35:19: error: expected ';' after top level declarator
warning:         constexpr int32_t kExitFailure = 1;
warning:                          ^
warning:                          ;
warning: bx/include/bx/bx.h:39:2: error: unknown type name 'constexpr'
warning:         constexpr bool isTriviallyCopyable();
warning:         ^
warning: bx/include/bx/bx.h:54:2: error: unknown type name 'constexpr'
warning:         constexpr Ty min(const Ty& _a, const Ty& _b);
warning:         ^
warning: bx/include/bx/bx.h:54:12: warning: variable templates are a C++14 extension [-Wc++14-extensions]
warning:         constexpr Ty min(const Ty& _a, const Ty& _b);
warning:                   ^
warning: bx/include/bx/bx.h:54:14: error: expected ';' at end of declaration
warning:         constexpr Ty min(const Ty& _a, const Ty& _b);
warning:                     ^
warning:                     ;
warning: bx/include/bx/bx.h:54:25: error: unknown type name 'Ty'
warning:         constexpr Ty min(const Ty& _a, const Ty& _b);
warning:                                ^
warning: bx/include/bx/bx.h:54:39: error: unknown type name 'Ty'
warning:         constexpr Ty min(const Ty& _a, const Ty& _b);
warning:                                              ^
warning: bx/include/bx/bx.h:54:15: error: C++ requires a type specifier for all declarations
warning:         constexpr Ty min(const Ty& _a, const Ty& _b);
warning:                      ^
warning: bx/include/bx/bx.h:58:2: error: unknown type name 'constexpr'
warning:         constexpr Ty max(const Ty& _a, const Ty& _b);
warning:         ^
warning: bx/include/bx/bx.h:58:12: warning: variable templates are a C++14 extension [-Wc++14-extensions]
warning:         constexpr Ty max(const Ty& _a, const Ty& _b);
warning:                   ^
warning: fatal error: too many errors emitted, stopping now [-ferror-limit=]
warning: 3 warnings and 20 errors generated.
warning: 3 warnings and 20 errors generated.
warning: 3 warnings and 20 errors generated.
warning: 3 warnings and 20 errors generated.

error: failed to run custom build command for `bgfx-sys v0.4.0`

Caused by:
  process didn't exit successfully: `/Users/tino/Workspace/game/target/release/build/bgfx-sys-d765467cb1cd2222/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-apple-darwin")
  CC_aarch64-apple-darwin = None
  CC_aarch64_apple_darwin = None
  HOST_CC = None
  CC = None
  CFLAGS_aarch64-apple-darwin = None
  CFLAGS_aarch64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = None
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bx/src/amalgamated.o" "-c" "bx/src/amalgamated.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bgfx/src/topology.o" "-c" "bgfx/src/topology.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bgfx/src/bgfx.o" "-c" "bgfx/src/bgfx.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bimg/src/image_decode.o" "-c" "bimg/src/image_decode.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bimg/src/image_gnf.o" "-c" "bimg/src/image_gnf.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bgfx/src/debug_renderdoc.o" "-c" "bgfx/src/debug_renderdoc.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bimg/src/image_cubemap_filter.o" "-c" "bimg/src/image_cubemap_filter.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bimg/src/image.o" "-c" "bimg/src/image.cpp"
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bgfx/src/vertexlayout.o" "-c" "bgfx/src/vertexlayout.cpp"

  --- stderr

  error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "bx/include/compat/osx" "-I" "bgfx/3rdparty/khronos" "-I" "bgfx/3rdparty" "-I" "bgfx/include" "-I" "bx/include" "-I" "bx/3rdparty" "-I" "bimg/include" "-I" "bimg/3rdparty" "-I" "bimg/3rdparty/iqa/include" "-I" "bimg/3rdparty/astc-codec/include" "-I" "bimg/3rdparty/tinyexr/deps/miniz" "-Wall" "-Wextra" "-DBGFX_CONFIG_RENDERER_WEBGPU=0" "-DBGFX_CONFIG_RENDERER_GNM=0" "-DBIMG_DECODE_ASTC=0" "-DBGFX_CONFIG_RENDERER_VULKAN=0" "-DBGFX_CONFIG_RENDERER_METAL=1" "-o" "/Users/tino/Workspace/game/target/release/build/bgfx-sys-675d35d16d980e93/out/bx/src/amalgamated.o" "-c" "bx/src/amalgamated.cpp" with args "cc" did not execute successfully (status code exit status: 1).
emoon commented 2 years ago

I will take a look

emoon commented 2 years ago

Should be fixed in 0.7.0 Let me know if it works fine for you

tcaer commented 2 years ago

Seems to work now! Thanks!