-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
can't use gcc-ar as Bazel's ar #3760
Comments
The problem is to decide what are arguments and what are objects. Not for ar, but for msvc, emscripten, and for all exotic wrapper scripts people have. We currently hardcode some logic for linking, and we need to get rid of it as it is confusing, and people actually started relying on the fact that some flags will be moved to the params file and then params file is placed elsewhere as the original flag. We definitely don't want to put more logic for ar. I see 2 ways forward:
For the short term, I'd suggest using wrapper scripts for your build, in which you'd read the content of params file, and shuffle it as you require. |
A fairly general solution would be to be add a (I'm not actually sure what the reason for the special-casing in |
Yes, what you propose is what I had in mind for the first point. It should work (I'm not aware of any reason why it shouldn't). This would solve the same problem That said, for this to work I would have to migrate all internal crosstools to action_configs/features. I'll have to do it at some point, but before that I want to do some more radical experiments with crosstool this quarter. So I won't have time to work on this feature request before EO2017. But again, you'd need to have a custom crosstool, and with that you can use workaround with wrapper scripts, so you shouldn't be blocked. |
Yep, I agree this is low priority. Thanks for weighing in, though. |
I have the same problem trying to link with lto. |
Your custom wrapper script would read the param file and exec |
Still don't understand how this should work. The argument to the wrapper script I create doesn't receive a parameter file as far as I can tell. How can I access the parameter file? |
ping on the above question |
Such questions are probably better asked on a designated help forum like Stack overflow.
|
Update: Our current plan is to remove special casing of C++ command lines completely, and instead make it all or nothing, like the rest of other actions are doing. That doesn't change anything for the current issue re Re above questions, I'll need a repro, which platform are you running on, what compiler version, do you have your own CROSSTOOL? I agree that this issue is not the right place to discuss this. Feel free to open a separate issue with as much info as you have, and clean problem statement. Thanks! |
This should reproduce for you @mhlopko . git clone https://github.com:mpictor/bazel-amd64-crosstool
git checkout lto-gcc-ar-bug
bazel build --crosstool_top=//tools/amd64_compiler:toolchain --cpu=k8 --verbose_failures //:lib My results:
$
|
I think I don't understand the problem? The command line is:
And |
ah, ok. thanks! |
Wrapper script that I'm using:
|
gcc provides a wrapper,
gcc-ar
, over binutilsar
that passes the proper--plugin
option so thatar
can understand LTO objects.gcc-ar
does some dodgy munging of the command line, which causes it to fail if all arguments are passed via param file, which is precisely how Bazel likes to pass ar arguments. Would it be possible to work around this in Bazel by putting the ar mode argument on the command line rather than the param file?The text was updated successfully, but these errors were encountered: