Reputation: 1033
I'm new to rust and would like to debug my Rust code using Clion (19.3 currently) and followed this answer to switch the compiler from MSVC to GNU, Now when I run my program (in debug) I get this error from Clion:
com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: Error creating process <Program Path>, (error 50).
Though running without debugging works fine.
If I google the error I get this issue on github which essentially says use a 64bit compiler on a 64bit app. The compiler I added is 64 bit and since I installed the 64 bit version of rust I assume that the programs that it outputs are 64bit... (though I don't know enough about rust to be 100% sure)
Running rustup show
returns this:
rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\User\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-gnu (default)
stable-x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-gnu (default)
rustc 1.42.0 (b8cedc004 2020-03-09)
Which is where I'm getting the idea that the correct toolchain is being used (as it says x86_64
all over the place).
Where as I going wrong? and what is miss configured?
Upvotes: 1
Views: 1451
Reputation: 1033
Turns out that I'm super dumb and had the Clion pointing at a 32 bit install rather than the 64 bit install. I ended up following this guide by Jetbrains themselves: https://blog.jetbrains.com/clion/2019/10/debugging-rust-code-in-clion/
On Windows, go to Settings | Build, Execution, Deployment | Toolchain and set either Cygwin or MinGW as your working environment. Then, run rustup toolchain list and check the first line: it should be one of the gnu versions matching the bitness of the debugger. For example, if you’re working on MinGW (32-bit), the default toolchain should be i686-pc-windows-gnu. If you’re on MinGW64, it should be x86_64-pc-windows-gnu. You can set the appropriate toolchain by running rustup default "toolchain_name".
Jetbrains have release an updated blog post that shows some improvements they have made to the debug process, for example on windows you no longer need to change settings in order to get debugging to work! https://blog.jetbrains.com/rust/2021/10/19/debugging-rust-in-jetbrains-ides-state-of-affairs/
Upvotes: 1