-
Notifications
You must be signed in to change notification settings - Fork 16
Description
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 the CC
, CXX
and other standard environment variables aren't being overridden by cargo-3ds
.
By manually setting the following environment variables, i was able to build the imgui-rs
crate, the zstd
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 here
With all of these set, the crates build fine with no extra warnings or anything.