Open
Description
I tried to build gcc-14 with rust enabled, but It fails to build.
It needs some changes to build
1 -
--- a/gcc/rust/checks/errors/borrowck/rust-borrow-checker.cc
+++ b/gcc/rust/checks/errors/borrowck/rust-borrow-checker.cc
@@ -20,6 +20,11 @@
#include "rust-function-collector.h"
#include "rust-bir-builder.h"
#include "rust-bir-dump.h"
+
+#ifdef _WIN32
+#define NO_OLDNAMES
+#include <direct.h>
+#endif
namespace Rust {
namespace HIR {
to recognize _mkdir
function
2 -
--- a/gcc/rust/expand/rust-proc-macro.cc
+++ b/gcc/rust/expand/rust-proc-macro.cc
@@ -102,6 +102,7 @@
} // namespace
+#ifndef _WIN32
template <typename Symbol, typename Callback>
bool
register_callback (void *handle, Symbol, std::string symbol_name,
@@ -125,6 +126,7 @@
#define REGISTER_CALLBACK(HANDLE, SYMBOL, CALLBACK) \
register_callback (HANDLE, SYMBOL, #SYMBOL, CALLBACK)
+#endif
const ProcMacro::ProcmacroArray *
load_macros_array (std::string path)
dlsym is a posix function, so it doesn't exist on Windows.
3 -
--- a/gcc/rust/parse/rust-parse.cc
+++ b/gcc/rust/parse/rust-parse.cc
@@ -89,7 +89,7 @@
// Source: rustc compiler
// (https://github.com/rust-lang/rust/blob/9863bf51a52b8e61bcad312f81b5193d53099f9f/compiler/rustc_expand/src/module.rs#L174)
#if defined(HAVE_DOS_BASED_FILE_SYSTEM)
- path.replace ('/', '\\');
+ std::replace (path.begin(), path.end(), '/', '\\');
#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
return path;
gcc doesn't accept path.replace ('/', '\\')