Code Monkey home page Code Monkey logo

Comments (6)

elaforge avatar elaforge commented on June 12, 2024 2

I hit this same issue when compiling the clock package (probably just the first one that uses hsc2hs) on the latest ghc-9.4.7 from ghcup. And it's easy to see that the official binary distribution at https://downloads.haskell.org/~ghc/9.4.6/ghc-9.4.6-x86_64-apple-darwin.tar.xz includes wrappers/hsc2hs-ghc-9.4.6 with -no_fixup_chains.

I tested with newer OSX and it does support that flag, though it's not documented.
So it's probably just that the binary distribution is built on a newer OS version. Since 10.13.6 is out of support, it's not a big surprise. So what you said is essentially correct, but backwards, the flag was added not removed. The workaround does work though, so thanks for that! Eventually I'll have to upgrade the OS though.

from zlib.

mengwong avatar mengwong commented on June 12, 2024 1

For anyone struggling with this: a workaround.

I edited my hsc2hs executable to remove the --lflag=-Wl,-no_fixup_chains bit on the end of HSC2HS_EXTRA

I had system-ghc: true specified so I did this under my .ghcup

others may need to do that under their ~/.stack/programs/

For example, edit ~/.stack/programs/x86_64-osx/ghc-9.4.7/bin/hsc2hs
(or the directory for your version of ghc)
(and edit the HSC2HS_EXTRA line)

from zlib.

andreasabel avatar andreasabel commented on June 12, 2024

Probably my system was broken. Fine after upgrading to macOS 12.

from zlib.

mengwong avatar mengwong commented on June 12, 2024

I encountered this recently and am minded to believe that your system was not broken.

At some point in the macos 13.4.* sequence, support for no_fixup_chains was dropped.

This led to an explicit test in configure: https://gitlab.haskell.org/ghc/ghc/-/commit/a587499c6dc8a7e7e646e9c5f246903a4cc99e56

which was backported to 9.2 and appears in 9.2.8-release (see Feb 7 2023):
https://gitlab.haskell.org/ghc/ghc/-/commits/ghc-9.2.8-release/

However, stack downloads a ghc from
https://downloads.haskell.org/~ghc/9.2.8/ghc-9.2.8-x86_64-apple-darwin.tar.bz2

This ghc does not contain the test; instead hsc2hs includes -no_fixup_chains by default.

┌─[mengwong@solo-8] - [~/tmp/ghc-9.2.8-x86_64-apple-darwin] - [2023-07-07 12:20:43]
└─[130] <> rg no_fixup_chains
wrappers/hsc2hs-ghc-9.2.8
1:HSC2HS_EXTRA="--cflag=--target=x86_64-apple-darwin--lflag=--target=x86_64-apple-darwin --lflag=-Wl,-no_fixup_chains"

Being a n00b it is not clear to me how exactly the apple-darwin tarball of 9.2.8 differs from the source release. Presumably it is in a "half-baked" state specialized for the OS. Perhaps this is where the difficulty arises.

I found that a later tarball for 9.4.5 does contain the test in configure, but not for 9.4.1.

┌─[mengwong@solo-8] - [~/tmp/ghc-9.4.5-x86_64-apple-darwin] - [2023-07-09 12:58:26]
└─[0] <> rg no_fixup_chains
configure
8115:      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld64 requires -no_fixup_chains" >&5
8116:printf %s "checking whether ld64 requires -no_fixup_chains... " >&6; }
8118:      if $CC -o conftest.o -Wl,-no_fixup_chains conftest.c > /dev/null 2>&1
8120:          LDFLAGS="-Wl,-no_fixup_chains"
8135:      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld64 requires -no_fixup_chains" >&5
8136:printf %s "checking whether ld64 requires -no_fixup_chains... " >&6; }
8138:      if $CC -o conftest.o -Wl,-no_fixup_chains conftest.c > /dev/null 2>&1
8140:          CONF_GCC_LINKER_OPTS_STAGE0="-Wl,-no_fixup_chains"
8155:      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld64 requires -no_fixup_chains" >&5
8156:printf %s "checking whether ld64 requires -no_fixup_chains... " >&6; }
8158:      if $CC -o conftest.o -Wl,-no_fixup_chains conftest.c > /dev/null 2>&1
8160:          CONF_GCC_LINKER_OPTS_STAGE1="-Wl,-no_fixup_chains"
8175:      { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ld64 requires -no_fixup_chains" >&5
8176:printf %s "checking whether ld64 requires -no_fixup_chains... " >&6; }
8178:      if $CC -o conftest.o -Wl,-no_fixup_chains conftest.c > /dev/null 2>&1
8180:          CONF_GCC_LINKER_OPTS_STAGE2="-Wl,-no_fixup_chains"


┌─[mengwong@solo-8] - [~/tmp/ghc-9.4.5-x86_64-apple-darwin] - [2023-07-09 12:58:28]
└─[0] <> cd ../ghc-9.4.1-x86_64-apple-darwin
┌─[mengwong@solo-8] - [~/tmp/ghc-9.4.1-x86_64-apple-darwin] - [2023-07-09 12:58:31]
└─[0] <> rg no_fixup_chains


┌─[mengwong@solo-8] - [~/tmp/ghc-9.4.1-x86_64-apple-darwin] - [2023-07-09 12:58:33]
└─[1] <> cd ../ghc-9.2.8-x86_64-apple-darwin
┌─[mengwong@solo-8] - [~/tmp/ghc-9.2.8-x86_64-apple-darwin] - [2023-07-09 12:58:43]
└─[0] <> rg no_fixup_chains
wrappers/hsc2hs-ghc-9.2.8
1:HSC2HS_EXTRA="--cflag=--target=x86_64-apple-darwin--lflag=--target=x86_64-apple-darwin --lflag=-Wl,-no_fixup_chains"
┌─[mengwong@solo-8] - [~/tmp/ghc-9.2.8-x86_64-apple-darwin] - [2023-07-09 12:58:44]
└─[0] <>

from zlib.

andreasabel avatar andreasabel commented on June 12, 2024

@mengwong Is this something that should be reported to the GHC team?
However, then it would be better to have a independent reproducer which could be hard to come by. (E.g. I tried it on the GitHub Action runners but was not successful, see my OP.)

from zlib.

mengwong avatar mengwong commented on June 12, 2024

I think it would be better reported to the Stack team specifically, but let's wait for some other poor soul to stumble upon this via Google search, and then they can report that they have independently reproduced the experiment.

Anybody else who is coming to this thread, please log a comment showing what version of Mac OS you're on, what version of stack you're running, and what version of ghc your project is configured with.

from zlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.