Support cross compilation when compiler given as path#491
Open
mtvec wants to merge 1 commit intodistcc:masterfrom
Open
Support cross compilation when compiler given as path#491mtvec wants to merge 1 commit intodistcc:masterfrom
mtvec wants to merge 1 commit intodistcc:masterfrom
Conversation
distcc supports cross compilation by rewriting the compiler binary (for GCC) or adding the `-target` flag (for Clang). However, this currently only works when the compiler is given without a full path. That is, when the compiler is given as, for example, `/usr/bin/gcc`, nothing gets rewritten. This patch adds support for full paths by by matching on the compiler's basename instead of its full path in `argv[0]`. The implementation in this patch rewrites paths as follows: - `/path/to/clang` -> `/path/to/clang -target ...` - `/path/to/gcc` -> `<target>-gcc` I'm not quite sure if this difference in behavior between GCC and Clang is wanted. In particular, it might be better to rewrite the GCC case to `/path/to/<target>-gcc`. However,this would make the implementation a bit more complex so I'd like to discuss this before implementing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
distcc supports cross compilation by rewriting the compiler binary (for GCC) or adding the
-targetflag (for Clang). However, this currently only works when the compiler is given without a full path. That is, when the compiler is given as, for example,/usr/bin/gcc, nothing gets rewritten.This patch adds support for full paths by by matching on the compiler's basename instead of its full path in
argv[0].The implementation in this patch rewrites paths as follows:
/path/to/clang->/path/to/clang -target .../path/to/gcc-><target>-gccI'm not quite sure if this difference in behavior between GCC and Clang is wanted. In particular, it might be better to rewrite the GCC case to
/path/to/<target>-gcc. However,this would make the implementation a bit more complex so I'd like to discuss this before implementing it.