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

fix potentially broken install_name_tool #2284

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

angerman
Copy link
Collaborator

We by default try to pull the one from the targetCC, only if that fails fall back to the bintools one.

We by default try to pull the one from the targetCC, only if that fails fall back to the bintools one.
@angerman angerman requested a review from hamishmack November 29, 2024 12:42
@angerman angerman merged commit 5ce912e into master Dec 4, 2024
5127 of 5161 checks passed
@angerman angerman deleted the angerman/fix-install_name_tool branch December 4, 2024 01:52
@thomasjm
Copy link
Contributor

Hi @angerman , any chance I could ask you a follow-up question about this?

I have a problem that seems very similar to the original issue, but it happens when trying to link my final executable. Everything up until the final linking works great, thanks to this patch. But then I see an error like this:

       > /nix/store/3npblfzpc62lnby7l43hh1ql2k4ybd8j-clang-wrapper-16.0.6/bin/ld: line 269: 58495 Segmentation fault: 11  /nix/store/r4z0c8m95f6gp0zyrcxg0mr6m9fmsnn0-cctools-binutils-darwin-16.0.6-973.0.1/bin/ld @<(printf "%q\n" ${extraBefore+"${extraBefore[@]}"} ${params+"${params[@]}"} ${extraAfter+"${extraAfter[@]}"})
       > clang-16: error: linker command failed with exit code 139 (use -v to see invocation)
       > ghc-9.8.2: `cc' failed in phase `Linker'. (Exit code: 1)

As you can see, it mentions /nix/store/...-clang-wrapper-16.0.6/bin/ld, but it also mentions /nix/store/.../cctools-binutils-darwin-16.0.6-973.0.1/bin/ld.

You had said on the other issue (https://gitlab.haskell.org/ghc/ghc/-/issues/25478) that the binutils one contains an install_name_tool that corrupts dylibs. Is it possible that the ld it includes will also cause problems?

Any help would be greatly appreciated, I'm at a loss for how to debug this or even to identify if a given dylib is corrupted or not.

@thomasjm
Copy link
Contributor

thomasjm commented Dec 12, 2024

Interestingly, I got it to build successfully by passing these configureFlags, to set it to just use the system ld:

--ghc-options="-optl=-fuse-ld=/usr/bin/ld"

and doing this reproduces the same error:

--ghc-options="-optl=-fuse-ld=${pkgs.clang_16}/bin/ld"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants