tadeuszjt / doodad

Imperative Language Compiler
MIT License
2 stars 0 forks source link

Bolang in docker #1

Closed ShootGan closed 6 months ago

ShootGan commented 2 years ago

Hi, I'm trying to run boolang on ubuntu in docker but i'm stack on cabal test. I really dont know how to deal with it so maybe you can help me. Error looks like this:

> [21/21] RUN cabal test:
#25 0.286 Warning: The test command is a part of the legacy v1 style of cabal usage.
#25 0.286
#25 0.287 Please switch to using either the new project style and the new-test command
#25 0.287 or the legacy v1-test alias as new-style projects will become the default in
#25 0.287 the next version of cabal-install. Please file a bug if you cannot replicate a
#25 0.287 working v1- use case with the new-style commands.
#25 0.287
#25 0.287 For more information, see: https://wiki.haskell.org/Cabal/NewBuild
#25 0.287
#25 4.113 Resolving dependencies...
#25 4.114 Warning: solver failed to find a solution:
#25 4.114 Could not resolve dependencies:
#25 4.114 [__0] trying: bolang-2.4 (user goal)
#25 4.114 [__1] next goal: base (dependency of bolang)
#25 4.114 [__1] rejecting: base-4.12.0.0/installed-4.1... (conflict: bolang =>
#25 4.114 base^>=4.13.0.0)
#25 4.114 [__1] fail (backjumping, conflict set: base, bolang)
#25 4.114 After searching the rest of the dependency tree exhaustively, these were the
#25 4.114 goals I've had most trouble fulfilling: bolang, base
#25 4.114 Trying configure anyway.
#25 4.115 Configuring bolang-2.4...
#25 4.300 cabal: Encountered missing dependencies:
#25 4.300 HUnit -any,
#25 4.300 base >=4.13.0.0 && <4.14,
#25 4.300 llvm-hs >=9.0.0 && <9.1,
#25 4.300 llvm-hs-pure >=9.0.0 && <9.1,
#25 4.300 split -any
#25 4.300
------
executor failed running [/bin/sh -c cabal test]: exit code: 1
tadeuszjt commented 2 years ago

Hi ShootGan

I'm fairly new to cabal but I think changing the base requirement line to "base >= 4.0.0.0" might get past it. I will work on this and commit a new cabal file that works across more machines.

Really nice to see someone interested in the project!

Tadeusz

ShootGan commented 2 years ago

So i fix this, and now i have something like this

------
 > [27/27] RUN cabal test:
#31 0.480 Warning: The test command is a part of the legacy v1 style of cabal usage.
#31 0.480
#31 0.480 Please switch to using either the new project style and the new-test command
#31 0.480 or the legacy v1-test alias as new-style projects will become the default in
#31 0.480 the next version of cabal-install. Please file a bug if you cannot replicate a
#31 0.480 working v1- use case with the new-style commands.
#31 0.480
#31 0.481 For more information, see: https://wiki.haskell.org/Cabal/NewBuild
#31 0.481
#31 1.486 Resolving dependencies...
#31 1.490 Configuring bolang-2.4...
#31 1.899 cabal: Missing dependency on a foreign library:
#31 1.899 * Missing (or bad) C library: gc
#31 1.899 This problem can usually be solved by installing the system package that
#31 1.900 provides this library (you may need the "-dev" version). If the library is
#31 1.900 already installed but in a non-standard location then you can use the flags
#31 1.900 --extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
#31 1.900 library file does exist, it may contain errors that are caught by the C
#31 1.900 compiler at the preprocessing stage. In this case you can re-run configure
#31 1.900 with the verbosity flag -v3 to see the error messages.
#31 1.900
------
executor failed running [/bin/sh -c cabal test]: exit code: 1

I will be working on that.

Paweł

tadeuszjt commented 2 years ago

Yeah, this is required just in case you didn't know what gc was: https://github.com/ivmai/bdwgc

ShootGan commented 2 years ago

I have bdwgc but I'm not sure how to link it using lgc

tadeuszjt commented 2 years ago

Hi ShootGan

I've been developing on void linux which has bdwgc as a package so it works after installing with 'sudo xbps-install gc'. After your issue opened I've been getting it working on a debian machine. I have the same problem as you now, I have bdwgc installed but cabal still gives the missing library error.

If you can find out how to install bdwgc manually such that cabal recognises it then that would be really helpful!

In the meantime if you want to use bolang, remove the 'extra-libraries: gc' line from bolang.cabal and use the compiler with the -c flag to build to object files. Eg: 'cabal run bolang -- -c main' then link and build the object files into an executable using gcc - Eg: 'gcc -lm -lgc build/ lang/build/ std/build/* -o main' then './main'.

Let me know how you get on.

Tadeusz

ShootGan commented 2 years ago

I install libgc-dev by apt and this resolve Missing (or bad) C library: gc but a new error appeared. I haven't tried to fix it yet.

#32 1.186 Resolving dependencies...
#32 1.190 Configuring bolang-2.4...
#32 1.533 Preprocessing executable 'bolang' for bolang-2.4..
#32 1.603 unused terminals: 4
#32 1.661 Building executable 'bolang' for bolang-2.4..
#32 1.736 [ 1 of 23] Compiling Args             ( compiler/Args.hs, dist/build/bolang/bolang-tmp/Args.o )
#32 1.877 [ 2 of 23] Compiling Error            ( compiler/Error.hs, dist/build/bolang/bolang-tmp/Error.o )
#32 2.480 [ 3 of 23] Compiling JIT              ( compiler/JIT.hs, dist/build/bolang/bolang-tmp/JIT.o )
#32 2.580 [ 4 of 23] Compiling Lexer            ( dist/build/bolang/bolang-tmp/Lexer.hs, dist/build/bolang/bolang-tmp/Lexer.o )
#32 3.663 [ 5 of 23] Compiling Monad            ( compiler/Monad.hs, dist/build/bolang/bolang-tmp/Monad.o )
#32 3.663
#32 3.663 compiler/Monad.hs:71:36: error:
#32 3.663     Not in scope: type constructor or class `MonadFail'
#32 3.663     Perhaps you meant `MonadFix' (imported from Control.Monad.Identity)
#32 3.663    |
#32 3.663 71 | instance (Monad m, MonadFail m) => MonadFail (BoMT s m) where
#32 3.663    |                                    ^^^^^^^^^
#32 3.663
#32 3.663 compiler/Monad.hs:87:47: error:
#32 3.663     Not in scope: type constructor or class `MonadFail'
#32 3.663     Perhaps you meant `MonadFix' (imported from Control.Monad.Identity)
#32 3.663    |
#32 3.663 87 | instance (Monad m, MonadFail m, MonadIO m) => MonadFail (InstrCmpT s m) where
#32 3.663    |                                               ^^^^^^^^^
#32 3.663
#32 3.663 compiler/Monad.hs:90:47: error:
#32 3.663     Not in scope: type constructor or class `MonadFail'
#32 3.663     Perhaps you meant `MonadFix' (imported from Control.Monad.Identity)
#32 3.663    |
#32 3.663 90 | instance (Monad m, MonadFail m, MonadIO m) => MonadFail (ModuleCmpT s m) where
#32 3.663    |                                               ^^^^^^^^^
#32 3.663 [ 6 of 23] Compiling SymTab           ( compiler/SymTab.hs, dist/build/bolang/bolang-tmp/SymTab.o )
#32 3.663 [ 7 of 23] Compiling Trace            ( compiler/Trace.hs, dist/build/bolang/bolang-tmp/Trace.o )
#32 3.663 [ 8 of 23] Compiling Type             ( compiler/Type.hs, dist/build/bolang/bolang-tmp/Type.o )
#32 3.664 [ 9 of 23] Compiling AST              ( compiler/AST.hs, dist/build/bolang/bolang-tmp/AST.o )
#32 3.952 [12 of 23] Compiling Parser           ( dist/build/bolang/bolang-tmp/Parser.hs, dist/build/bolang/bolang-tmp/Parser.o )
tadeuszjt commented 2 years ago

Ah, I fixed those last night so git pull and it should be working.

Brilliant, couldn't find a gc package for debian so I thought it didn't exist.