Use of env vars like CFLAGS
doesn't appear to support cross compilation
#10
Labels
enhancement
New feature or request
CFLAGS
doesn't appear to support cross compilation
#10
This is a re-post/elaboration of a comment I made on reddit
Looking at the use of
CFLAGS
, etc, env variables, it would be a good idea to mirror the pattern used in thecc
crate. From thecc
readme:We used this specific mechanism (of resolving most specific to least specific without combining/appending) to best support the cross compilation of C code.
The relevant code in inline-c appears here:
inline-c-rs/src/run.rs
Lines 149 to 162 in 7bd0f5e
Given the desire to integrate
CFLAGS
/etc that are provided by the program rather than the environment, I'm not sure exactly what should be done here. TheCFLAGS
/etc from the environment are usually supplied in order for compilation to be functional. Given this, it seems unwise to have program supplied values replace those from the environment. Appending the program supplied values to the environment supplied values might be the best choice.Additionally, it would be good to examine the splitting methodology used for these variables. In some cases,
CFLAGS
/etc may contain spaces. This is more common on windows when one might need to provide a path to some directory within theLDFLAGS
orCFLAGS
(or for plainCC
).On a related note: the handling of
LDFLAGS
using-Wl
probably isn't compatible with how other users interpretLDFLAGS
(which are normally passed to the link step without extra munging).The text was updated successfully, but these errors were encountered: