-
Notifications
You must be signed in to change notification settings - Fork 841
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
Stack build causing linker error on Mac OSX Sierra #3487
Comments
Can you try rebuilding with GHC 8.2.1 with a command line |
Below is what I executed:
And then I was able to successfully Doing And trying to install via
|
Alright, let's next see if the problem occurs with GHC outside of a project. Can you create a Hello World-style Haskell file (
It would also be informative if compiling a C file produces any errors. One thing I'm afraid of here: this looks more likely to be an issue at the GHC layer than either the Cabal or Stack layers, so we may not be able to do much to help you. |
A quick Google of the error message also indicates this may be a configuration error with your C toolchain, where you have some 32-bit libraries installed. |
It appears that things built correctly using the command you mentioned above:
And compiling a C file:
gcc info:
|
Interesting. Can you try running the following two commands as well?
|
Run inside of the project
Second command:
|
Potentially related? |
I'm starting to run out of ideas. The biggest difference I see between the raw GHC invocation that worked above and the invocation that Cabal is making is that the latter is doing a static compilation. What happens if you compile with:
|
So I should run this on a "Hello, world" Main.hs? Here's the output on that:
|
Looks like we have a winner: GHC is unable to do static linking. Why that's the case, however, I don't know. Adding a |
Just bumped into this while trying to build cpphs-1.20.8 (reproduced multiple times). Tried cleaning both global and local stack directories, no dice. |
FWIW, the project I was trying to build is https://github.com/Lemmih/lhc |
Spent a bit of time on this. Specifically, tried building cpphs-1.20.8 with stack and cabal (inside nix-shell) from source. The former fails, the latter succeeds.
So it's likely to either be a difference in library versions or flags (or maybe something else). |
Okay, I think i've figured it out. I also had ghc installed globally via brew. So I removed
This forced ghc to be downloaded and cpphs was successfully built. @snoyberg, could you confirm that this might be the cause? |
It looks like you took a few different actions, and one of them fixed the problem. They all seem to point at a root cause of a different version of GHC already being installed, and forcing a new installation, which seems reasonable to me. |
same problem here, I prepend /usr/bin in front of /usr/local/bin in the path , then it works |
I think #4366 resolves this (there's a workaround). @soulomoon would you confirm, please, and then close if it does? |
I don't have llvm installed so no for #4366, but the reason is similar, /usr/local/bin is where my brew install most of the binaries, so it might be binaries there have the same names as those in /usr/bin. But I have not not pinpoint the exact binaries yet. |
these are the two binaries stop me @dbaynard and they are from |
@soulomoon I failed to run
|
Perhaps a previous build was aborted and left #14533 - Make GHC more robust against PC crashes by using atomic writes In general, when we get issues like this, we should try to look at the object file where the symbols should come from and see if they are cut off. |
This happened to me and it was indeed binutils, more specifically the one homebrew installed. Once I uninstalled the homebrew one everything worked. |
@pwm how did you get everything working after you removed the binutils. I tried doing the same but the build now fails complaining it cannot find ar |
i fixed the ar problem now by creating a new project but still it wont compile on mac |
@NikosEfthias |
I've managed to successfully build hakyll on MacOS Big Sur 11.5.2 with stack by removing brew binutils. I've also been having Undefined symbols errors. |
I am closing given the passage of time. |
macOS 10.12.6 (16G29) (Sierra)
Fresh uninstall/reinstall of XCode (accepted terms)
brew as package manager
I blew away all stuff related to ghc, stack, and cabal and then installed this way
https://haskell-lang.org/get-started
Writing the little HelloWorld.hs script worked fine and showed
Hello, World
However, doing
Resulted in this:
Expected
Successful
stack build
Stack version
Method of installation
https://haskell-lang.org/get-started
The text was updated successfully, but these errors were encountered: