Skip to content
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

cc-wrapper: Use response files for cc #35102

Closed
wants to merge 1 commit into from

Conversation

hamishmack
Copy link
Contributor

@Ericson2314, can you please take a look at this. I have managed
to get webkitgtk building on macOS with the latest nixpkgs
but only if I use this change to work around the command line
argument limits.

Motivation for this change

This works around issues on OS that has a limited on the number of
arguments that can be passed to a process.

Things done

This change will passes all arguments in a temporary response file,
but only if we were able to expand response params with
expandResponseParams (that way we can safely assume there are
no unexpanded response params).

It also treats -L and -l linker options passed to cc-wrapper.sh
specially. It puts these in a response file and adds that file to
the list of options with -Wl,@.... This helps avoid issues when
the wrapped cc binary itself calls the linker.

Finally because ld cannot handle response files it shrinks the -L
options in macos-sierra-reexport-hack.bash using temporary local
symlinks with short names.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This works around issues on OS that has a limited on the number of
arguments that can be passed to a process.

This change will passes all arguments in a temporary response file,
but only if we were able to expand response params with
expandResponseParams (that way we can safely assume there are
no unexpanded response params).

It also treats -L and -l linker options passed to cc-wrapper.sh
specially.  It puts these in a response file and adds that file to
the list of options with `-Wl,@...`.  This helps avoid issues when
the wrapped cc binary itself calls the linker.

Finally because ld cannot handle response files it shrinks the -L
options in macos-sierra-reexport-hack.bash using temporary local
symlinks with short names.
@Ericson2314
Copy link
Member

@hamishmack thanks for doing this! I think first we should add https://github.com/NixOS/nixpkgs/pull/29935/files back to master (the cctools-port changes have since been merged so we can drop that patch).

@Ericson2314
Copy link
Member

CC @orivej

@Ericson2314
Copy link
Member

CC @luigy

@mmahut
Copy link
Member

mmahut commented Aug 3, 2019

What is the status of this pull request?

@mmahut
Copy link
Member

mmahut commented Oct 5, 2019

Closing due to lack of activity, feel free re-open this if needed.

@mmahut mmahut closed this Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants