Open montetzouma opened 3 years ago
Judging from the error, it looks like it has trouble compiling the C dependencies of the physics engine. I have never compiled apecs-phsyics
on Windows, and I'm not sure what's going on or how to go about fixing it.
Luckily for you, you don't need apecs-physics
at all for the shmup
example. You should be able to build just that executable with stack build examples:shmup
, can you confirm if that works?
Thanks for helping. I tried stack build examples:shmup
but it comes up with the same error message I'm afraid. It might be a general problem of apecs (on Windows?) as I tried building the following project and it generated the same error as well.
Unity Tutorial Project in Haskell with Apecs and SDL2
Strange, maybe stack
doesn't know not to build other dependencies when building just 1 executable. Does stack build examples:simple
work? Does stack build apecs
work?
stack build apecs
did not produce any message, good or bad. I believe it was already built in one of my previous attempts.stack build examples:simple
produced the same error regarding apecs-physics
.I think a temporary workaround could be to just delete all executables that rely on apecs-physics
from examples.cabal
. That is, delete all lines from 35 to the end of file, and try building the executables again.
I'm afraid it's the same error even after deleting the lines from examples.cabal
.
I also tried creating a new stack project with only the code from shmup
in its Main
and listing as dependencies only apecs
, apecs-gloss
, linear
and random
but it came up with the same error.
Perhaps then the apecs
library itself depends on apecs-physics
? Or there is a way to manually install the C dependencies of apecs-physics
(presumably Chipmunk?) to circumvent this error?
Ohhhhhhhh I realize what it is now, I forgot that apecs-gloss
depends on apecs-physics
...
The options for fixing this are
apecs-physics
,apecs-gloss
into a separate package, andapecs-gloss
to build without the physics parts.Option 1 is obviously nicest, but I don't have a windows dev environment to try and reproduce on. I'll have a think about whether I prefer 2 or 3.
Just to be sure though, can you make sure that you can build the gloss
package on windows?
Strange. I've certainly built projects with apecs-gloss on windows with stack.
I can confirm that gloss
builds fine on Windows.
@jonascarpay thanks for helping! Let me know if you decide to implement either 2 or 3 (although after @dpwiz 's comment the issue might be different?). I'm not experienced with these kind of things but I'm happy to help with implementing 1 if you decide to try that.
@dpwiz Hmm, thanks for the input. When you built it, was that as a dependency, or from the apecs project folder? This project is still on LTS 13, so maybe it's just a GHC version issue.
@montetzouma, can you try building with --resolver=lts-18
?
It gives the same error with stack build --resolver=lts-18
.
Mind you, I had to add the following extra dependencies (suggested by stack
) in stack.yaml
otherwise the build was failing.
extra-deps:
- directory-1.3.6.2@sha256:6e5f3e0adfe94483d5754d97d741b7d23a5e085d47176075b1955d4fa78f37aa,2811
- time-1.10@sha256:536801b30aa2ce66da07cb19847827662650907efb2af4c8bef0a6276445075f,5738
- process-1.6.13.2@sha256:9733aa8a27b3e6c0f08a87a5c7287b3b73302d396f68f5655f9990a641368e3e,2845
- Cabal-3.2.1.0@sha256:8743076ec022296f9771d962000c9ca3a0fe02e68c37b992c63e382a675f791d,27482
I've tested my game and the latest lts-18 is broken*, while lts-18.5 builds and runs all right.
*Something to do with GHC internal packages.
This looks like it https://github.com/commercialhaskell/stackage/issues/6176
Unfortunately, both stack build --resolver=lts-18.5
and stack build examples:shmup --resolver=lts-18.5
fail with the same error as above for me.
@dpwiz maybe your game uses gloss
or sdl
instead of apecs-gloss
?
I attach the full build log in case it is helpful.
build.log
Definitely apecs-gloss (:
You can try building it too, but I'd expect the result will be the same: https://gitlab.com/dpwiz/spacemar
@dpwiz I have successfully built and run spacemar with stack
! This probably means that I have been doing something wrong with shmup
or there is a workaround for solving the issue. I will try to look into your code over the next couple of days and see what differences I can spot. Thanks for providing your project!
The problem appears to be with apecs-physics-0.4.5
.
Adding
extra-deps:
- apecs-physics-0.4.4
in stack.yaml
(as @dpwiz had in his game) fixes the issue and everything runs fine.
Thanks everyone for your help!
@jonascarpay Let me know if I can help in some way with fixing this :)
@montetzouma Glad you found a workaround.
So, apecs-physics
0.4.5 broke the Windows build. 0.4.5 was about bumping Chipmunk2D from 7.0.2 to 7.0.3, in response to issues with the linux build, the exact changes for which can be found here. I don't immediately see how those changes could cause it not to find pthread_cond_wait
, but it might be related to https://github.com/slembcke/Chipmunk2D/issues/194 since they're both about linking error related to cpHastySpace.c
.
I don't know if this issue is with GHC, Chipmunk, Cabal, or apecs-physics
, and I'm not really in a position to investigate it myself. For now, I'll leave this issue open so that people with the same issue will at least find your workaround. It is unfortunate though, so if anybody is able to better investigate that would be very welcome.
@dpwiz Can I add a link to your game in the project README?
@jonascarpay I'd be honored (:
There's some kind of fix mentioned in 194.
If it works, it would be possible to graft it on a vendored copy while waiting for upstream.
I cloned the apecs project and tried to build it with stack, so that I can try the shmup example. However, stack build came up with the following error. Is this an actual issue or am I doing something wrong? Thanks!