-
Notifications
You must be signed in to change notification settings - Fork 10
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
Set environment variables for CC and CXX to allow building C/C++ wrapper crates #41
Comments
Nice idea, I didn't know there were crates with C dependencies that are able to run, but I surely wouldn't like to miss a chance at supporting them! There are just 2 things to clarify before actually making the change (which would take minimal practical effort):
|
The problem is that while the Environment variables should be the best thing for this, as they are made to describe the environment a program runs in. As for whether those flags are used by other code, they should be fine, but i need to check whether build dependencies of packages (that should be built for the host target, as they are part of build scripts) are affected by this change and if so, if there's another way forward. |
Interestingly, this also sort of relates to rust3ds/ctru-rs#133 — In that case, the build script is figuring out the paths to the compilers using the existing
This would be my concern too, but luckily I think it should be safe for All that said — does this configuration need to be in Maybe it's a little more convenient to preset the flags, but I don't think we can guarantee that every crate using @Meziu thoughts? |
I wasn't aware of that, that clears my original doubt.
@ian-h-chamberlain In my opinion, simplifying the building process (for the most common cases) is the reason why Following that logic, I believe As my original vision for this tool, we should strive for as much compatibility as possible within the boundaries of |
Oh i didn't see that, that's great then As for the inclusion, i agree with Meziu, the whole reason I'm gonna try writing a patch for |
With this setup I managed to run Did I miss something? Could you follow up on this issue? |
I was trying to build imgui-rs, to make a library that provides an interface between
imgui
and the 3DS system, to allow for easy creation of GUI applications, and i ran into a problem. (what little code i wrote is here)imgui-rs
, like many crates that wrap a C or C++ library, uses the cc crate to build the C dependency. The problem is that when the C dependency is being built, it targets the host system's architecture, because theCC
,CXX
and other standard environment variables aren't being overridden bycargo-3ds
.By manually setting the following environment variables, i was able to build the
imgui-rs
crate, thezstd
crate and other C wrappers without any issues, linking or otherwise.CRATE_CC_NO_DEFAULTS=1
as documented here, to override the default build configuration (that would build for the host target).CXX=/opt/devkitpro/devkitARM/bin/arm-none-eabi-g++
(the path has to not be hardcoded, of course)CC=/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc
(same thing here as before)All the variables in
/opt/devkitpro/3dsvars.sh
(same thing here with the path), as documented hereWith all of these set, the crates build fine with no extra warnings or anything.
The text was updated successfully, but these errors were encountered: