Open MehdiChinoune opened 4 months ago
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
_mkdir
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 ('/', '\\')
path.replace ('/', '\\')
Proposed patch: https://github.com/lhmouse/MINGW-packages/blob/5859d27b2b6101204a08ad9702cb2937f8797be9/mingw-w64-gcc/0100-rust-fix.patch
I've been trying to set up a CI in #2979, there is a small problem remaining but when it'll be merged this should'nt happen anymore.
I tried to build gcc-14 with rust enabled, but It fails to build. It needs some changes to build
1 -
to recognize
_mkdir
function2 -
dlsym is a posix function, so it doesn't exist on Windows.
3 -
gcc doesn't accept
path.replace ('/', '\\')