jeremyletang / rust-sfml

SFML bindings for Rust
Other
639 stars 88 forks source link

Failed when compiling CSFML #316

Closed Cg1340 closed 5 months ago

Cg1340 commented 1 year ago

It looks like an import is needed <cstdint>, but it is not imported.

OS: Windows 11 x64 C&C++ Compiler: Mingw-w64 with version 13.1.0 of gcc rustc: 1.72.0

PS D:\Code\musicplayer-continue> cargo build
   Compiling sfml v0.21.0
The following warnings were emitted during compilation:

warning: Custom SFML include dir: D:\SFML-2.6.0\include
warning: CSFML/src/Audio/Sound.cpp:74:60: error: 'int64_t' has not been declared
warning:    74 | extern "C" void sfSound_setPlayingOffset(sf::Sound *sound, int64_t timeOffset) {
warning:       |                                                            ^~~~~~~
warning: CSFML/src/Audio/Sound.cpp:103:12: error: 'int64_t' does not name a type
warning:   103 | extern "C" int64_t sfSound_getPlayingOffset(const sf::Sound *sound) {
warning:       |            ^~~~~~~
warning: CSFML/src/Audio/Sound.cpp:3:1: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
warning:     2 | #include <SFML/Audio.hpp>
warning:   +++ |+#include <cstdint>
warning:     3 | #include <cstddef>

error: failed to run custom build command for `sfml v0.21.0`

Caused by:
  process didn't exit successfully: `D:\Code\musicplayer-continue\target\debug\build\sfml-66243c0e90a514ed\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-changed=CSFML
  cargo:rerun-if-env-changed=SFML_INCLUDE_DIR
  cargo:rerun-if-env-changed=SFML_LIBS_DIR
  cargo:rerun-if-env-changed=SFML_STATIC
  cargo:warning=Custom SFML include dir: D:\SFML-2.6.0\include
  TARGET = Some("x86_64-pc-windows-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-pc-windows-gnu")
  cargo:rerun-if-env-changed=CXX_x86_64-pc-windows-gnu
  CXX_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CXX_x86_64_pc_windows_gnu
  CXX_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CXX
  HOST_CXX = None
  cargo:rerun-if-env-changed=CXX
  CXX = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CXXFLAGS_x86_64-pc-windows-gnu
  CXXFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CXXFLAGS_x86_64_pc_windows_gnu
  CXXFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CXXFLAGS
  HOST_CXXFLAGS = None
  cargo:rerun-if-env-changed=CXXFLAGS
  CXXFLAGS = None
  cargo:rerun-if-env-changed=CXX_x86_64-pc-windows-gnu
  CXX_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CXX_x86_64_pc_windows_gnu
  CXX_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CXX
  HOST_CXX = None
  cargo:rerun-if-env-changed=CXX
  CXX = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CXXFLAGS_x86_64-pc-windows-gnu
  CXXFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CXXFLAGS_x86_64_pc_windows_gnu
  CXXFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CXXFLAGS
  HOST_CXXFLAGS = None
  cargo:rerun-if-env-changed=CXXFLAGS
  CXXFLAGS = None
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/System/Clock.o" "-c" "CSFML/src/System/Clock.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/System/Sleep.o" "-c" "CSFML/src/System/Sleep.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/System/InputStream.o" "-c" "CSFML/src/System/InputStream.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/System/SfString.o" "-c" "CSFML/src/System/SfString.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/System/SfStdString.o" "-c" "CSFML/src/System/SfStdString.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/System/SfStdVector.o" "-c" "CSFML/src/System/SfStdVector.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/Audio/Listener.o" "-c" "CSFML/src/Audio/Listener.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/Audio/Music.o" "-c" "CSFML/src/Audio/Music.cpp"
  exit code: 0
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/Audio/Sound.o" "-c" "CSFML/src/Audio/Sound.cpp"
  cargo:warning=CSFML/src/Audio/Sound.cpp:74:60: error: 'int64_t' has not been declared

  cargo:warning=   74 | extern "C" void sfSound_setPlayingOffset(sf::Sound *sound, int64_t timeOffset) {

  cargo:warning=      |                                                            ^~~~~~~

  cargo:warning=CSFML/src/Audio/Sound.cpp:103:12: error: 'int64_t' does not name a type

  cargo:warning=  103 | extern "C" int64_t sfSound_getPlayingOffset(const sf::Sound *sound) {

  cargo:warning=      |            ^~~~~~~

  cargo:warning=CSFML/src/Audio/Sound.cpp:3:1: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?

  cargo:warning=    2 | #include <SFML/Audio.hpp>

  cargo:warning=  +++ |+#include <cstdint>

  cargo:warning=    3 | #include <cstddef>

  exit code: 1

  --- stderr

  error occurred: Command "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "CSFML/src/" "-I" "D:\\SFML-2.6.0\\include" "-Wall" "-Wextra" "--std=c++17" "-DCSFML_SYSTEM_EXPORTS" "-DCSFML_AUDIO_EXPORTS" "-DCSFML_WINDOW_EXPORTS" "-DCSFML_GRAPHICS_EXPORTS" "-o" "D:\\Code\\musicplayer-continue\\target\\debug\\build\\sfml-f1fdb55fbe5649eb\\out\\CSFML/src/Audio/Sound.o" "-c" "CSFML/src/Audio/Sound.cpp" with args "g++.exe" did not execute successfully (status code exit code: 1).
fl3xice commented 11 months ago

You solve this?

Cg1340 commented 11 months ago

Yeah, just include a header file cstdint in CSFML/src/Audio/Sound.cpp

shane-tran-whitmire commented 9 months ago

Interesting. This seems like a simple fix. You could open up a PR for it. The main maintainer and I don't use windows, so we just don't see mingw issues... ever.

Cg1340 commented 5 months ago

Oh, sorry, I think that I can close this issue now.