I maintain a rather complicated framework which is not listed on Hackage. So I was building an app using it, when discovered I needed to add a small function to the framework to make it work, so I added it. Went to build the framework, and it builds perfectly.
Now I go to bump the version of the framework in stack.yaml . And I run stack build
, and it starts checking out and building the latest version, and…linker error!
Wait, linker error? I thought this wasn’t supposed to be possible in a pure Haskell program.
And yet here it is:
cubix > [1 of 4] Compiling Examples.Multi.Syntax
cubix >
cubix > <no location info>: error:
cubix > dlopen(/private/tmp/stack-37c90e04df5ecf99/cubix-0.0.0/.stack-work/dist/x86_64-osx/Cabal-3.8.1.0/build/libHScubix-0.0.0-JlXfM6V5PObCqpL8fDmy45-ghc9.4.5.dylib, 0x0005): symbol not found in flat namespace '_compstratzm0zi1zi0zi3zm1YpMv9EB0qD2skM8X0jPr8_DataziCompziMultiziStrategyziClassification_hasAnySort_closure'
(Probably relevant: “asAnySort” is the name of the function that I just added.)
I’ve tried stack clean
and rm -rf .stack-work
, and it didn’t help. And I don’t know what else to try, nor what could be causing this issue.
I have pushed a small reproduction to GitHub - cubix-framework/cubix-sample-app at linker-bug-repro . Cloning this branch and merely running “stack build” should produce the issue, although I haven’t tested on another computer.
So, is this a bug in Stack, or is there some weird setting I got wrong?
P.S.: Another weird thing is that it seems to be compiling the test executables that come with my framework, when the sample app only depends on the library. Anyone know how to get it to skip the executables?