-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Allow build scripts to output -C flags #1293
Comments
Usage of |
where So, I'm using:
within Portability is the responsibility of the build script, isn't it? (figuring out what the system has and choosing flags on that basis) |
Right now our workflow is like this:
|
These do not necessarily seem like flags that a build script is responsible for:
Is this not necessary on all crates being compiled?
Already taken care of :)
Is this actually necessary to run the resulting binary? Flags like this often assume some method of execution whereas other methods like
Like |
@michaelwu can you clarify the reason for some of those args in the Servo Gonk build? |
I ran the following:
(
I guess one of them is necessary? I'll poke a bit further |
The sysroot was what we needed.
|
I don't remember. Most if not all are derived from what the Android build system gives us, and it's very likely that every single thing is needed. -mandroid might be the only thing we can omit. |
Hmm and I remember thinking the Android linker doesn't support rpath, but that was a long time ago when I was actually doing android linker hacks. |
What about sysroot? That's the only one we seem to really need; the rest can be moved into -L, -l, and LD_LIBRARY_PATH |
@Manishearth also suggested that a more amenable solution might be to pass the array of -Ls to build.rs somehow. Not sure how. (env var seems like a bad idea since then it needs parsing again). Right now, our alternatives appear to be:
|
Similar issue here. I'm building for an ARM core and the last step involves passing |
It occurs to me there is another option:
|
We'd still need to collect all the -l flags. Makes more sense to directly hardcode it, in that case. FWIW I tried to build it statically (needed these changes ). It's quite hackish and the final binary just crashes (probably due to the hacks). I'm probably doing something wrong here, but it shouldn't be this hard anyway. There's nothing stopping the programmer from shelling out to a makefile and calling rustc from there with the necessary link args; so we're not really adding new, unstable, functionality if we add We've already got two examples of where current rustc-flags support is inadequate; I really think that adding link-args to it would be a good idea. Even if its just allowed for the final binary (avoiding crosscrate issues). Alternatively, as mentioned before, provide the rustc invocation to the build script, preferably in a structured form. Admittedly, in Servo's case, there is a workaround: Use bash or python to parse the output, extract the invocation, and rerun it. But this seems worse and even less portable/stable. |
cc #544. |
Currently, build scripts can only modify the
-l
and-L
flags that are passed to rustc.Would it be possible to include
-C
in those, at least-C link-args
?The text was updated successfully, but these errors were encountered: