Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.41k stars 142 forks source link

binaryStl: replace `float32LE` with `floatLE` from `Data.ByteString.Builder` #411

Closed sorki closed 2 years ago

sorki commented 2 years ago

This allows us to get rid of storable-endian dependency and transitively problematic byteorder.

Golden test infra doesn't include binary formats so that needs fixing / refactoring.

dannypike commented 2 years ago

@sorki I've just tried building this PR on Windows (out of curiousity) and, although I don't see the error with byteorder any more, I do get a similar error for two other modules now:

Configuring library for OneTuple-0.3.1..
D:\Users\peter\AppData\Local\Temp\ghcF9C4.o.tmp: renameFile:renamePath:MoveFileEx "\\\\?\\D:\\Users\\peter\\AppData\\Local\\Temp\\ghcF9C4.o.tmp" Just "\\\\?\\D:\\Users\\peter\\AppData\\Local\\Temp\\ghcF9C4.o": does not exist (The system cannot find the file specified.)
Failed to build OneTuple-0.3.1. The failure occurred during the configure
step.
Build log (
D:\Users\peter\AppData\Roaming\cabal\logs\ghc-9.0.1\OneTuple-0.3.1-c05f8b1918e798f93e5c9a0245694fde97f6782c.log
):
Configuring library for OneTuple-0.3.1..
D:\Users\peter\AppData\Local\Temp\ghcF9C4.o.tmp: renameFile:renamePath:MoveFileEx "\\\\?\\D:\\Users\\peter\\AppData\\Local\\Temp\\ghcF9C4.o.tmp" Just "\\\\?\\D:\\Users\\peter\\AppData\\Local\\Temp\\ghcF9C4.o": does not exist (The system cannot find the file specified.)

Failed to build blaze-markup-0.8.2.8. The failure occurred during the
configure step.
Build log (
D:\Users\peter\AppData\Roaming\cabal\logs\ghc-9.0.1\blaze-markup-0.8.2.8-ff7dd8e4528f2a59dd3e064198ca0b8d0fbc91f2.log
):
Configuring library for blaze-markup-0.8.2.8..
D:\Users\peter\AppData\Local\Temp\ghcF9B4.o.tmp: renameFile:renamePath:MoveFileEx "\\\\?\\D:\\Users\\peter\\AppData\\Local\\Temp\\ghcF9B4.o.tmp" Just "\\\\?\\D:\\Users\\peter\\AppData\\Local\\Temp\\ghcF9B4.o": does not exist (The system cannot find the file specified.)
cabal.exe: Failed to build OneTuple-0.3.1 (which is required by
exe:extopenscad from implicit-0.3.0.1 and exe:docgen from implicit-0.3.0.1).
See the build log above for details.

The log files say that it couldn't find a temporary file called, for example ghcF9B4.o but, when I look there is a file called ghcF9B4.tmp in the folder.

So, does this mean that blaze-markup-0.8.2.8 and OneTuple-0.3.1 could have the same problem? Or have I misunderstood what you are doing in this PR?

sorki commented 2 years ago

@dannypike Aah. It looks like a race condition in Cabal that needs fixing, not much we can do about it in ImplicitCAD anymore I'm afraid.

One more thing you can try to is a cabal build -j1 to limit parallelism to 1 core. If it doesn't help we can try filing an issue in Cabal repository, similar to e.g. https://github.com/haskell/cabal/issues/5458

dannypike commented 2 years ago

@sorki Thank you, that helped.

Running cabal build -j1 got the error down to a missing zlib library:

Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
 - zlib-0.6.2.3 (lib) (requires build)
 - JuicyPixels-3.3.7 (lib) (requires build)
 - implicit-0.3.0.1 (lib) (first run)
 - implicit-0.3.0.1 (exe:extopenscad) (first run)
 - implicit-0.3.0.1 (exe:docgen) (first run)
Configuring library for zlib-0.6.2.3..
cabal.exe: The pkg-config package 'zlib' is required but it could not be
found.

cabal.exe: Failed to build zlib-0.6.2.3 (which is required by exe:extopenscad
from implicit-0.3.0.1 and exe:docgen from implicit-0.3.0.1). The failure
occurred during the configure step.

Is there a way that you know of to get that working, too?

sorki commented 2 years ago

@sorki Thank you, that helped.

Cool!

Is there a way that you know of to get that working, too?

I believe the following commit will fix that - https://github.com/Haskell-Things/ImplicitCAD/pull/411/commits/da1b9470b832acdaa4344906017395a04bd9bad1, try pulling the branch.

dannypike commented 2 years ago

I believe the following commit will fix that - da1b947, try pulling the branch.

@sorki I now have extopenscad up and running on Windows, by using this branch.

Thanks a lot!