-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows - MinGW gcc: Compiled object always gets put in the root project directory #819
Comments
I managed to fix this and submitted a pull request #820 |
The fact that #820 worked for you is actually circumstantial. The trouble is that mingw gcc is free to generate references to symbols that are not available in msvc run-time. And when it does, it inevitably translates to linking errors later on. Simplest example is For reference. |
BTW, gnu and msvc are using different name mangling schemes, so that any references to C++ run-time will end up unlinkable. |
The issue:
I have a C file in the root of my Rust project: my_interop.c (the issue persists wherever I place it)
My build.rs script, about as simple as it can get, looks like this:
When building, the log says,
which should put the object file in
target/debug/build/my-project-.../out/get_wp_handle.o
However, I find the object file in the root directory, outside of target.
Then, in the linking step, the log says,
which is obviously because the object file got put in the root directory rather than the designated output directory.
In my build script I have tried adding
.output_dir("some/specific/dir")
but the object file still gets put at the root.The temporary solution:
If I change my build script to be
the linking step will expect the object file to be in the root directory.
It compiles as needed, and the project runs fine.
However, now the issue is that all of the other output files get put there too.
We end up a bunch of junk like this,
which isn't good for maintainability.
Full Log:
I'm new to C and all of the compiling and linking, so I'm having trouble coming up with a solution. I'm not sure if this is a problem with cc-rs or gcc.
The text was updated successfully, but these errors were encountered: