Skip to content

.mll tests fail when running ./scripts/ninja.js build #5337

@kevinbarabash

Description

@kevinbarabash

I get the following output when running ./scripts/ninja.js build (after running the other steps in CONTRIBUTING.md):

./scripts/ninja.js build
rescript: [91/1832] stubs/libbs_hash.a
+ cc -shared -flat_namespace -undefined suppress                    -Wl,-no_compact_unwind  -o stubs/dllbs_hash.so stubs/ext_basic_hash_stubs.o     
+ ar rc stubs/libbs_hash.a  stubs/ext_basic_hash_stubs.o; ranlib stubs/libbs_hash.a
rescript: [830/1832] test/arith_lexer.ml
FAILED: test/arith_lexer.ml
/bin/sh: test/arith_lexer.mll: Permission denied
rescript: [831/1832] test/number_lexer.ml
FAILED: test/number_lexer.ml
/bin/sh: test/number_lexer.mll: Permission denied
rescript: [834/1832] test/simple_lexer_test.ml
FAILED: test/simple_lexer_test.ml
/bin/sh: test/simple_lexer_test.mll: Permission denied
rescript: [1828/1832] test/unsafe_this.cmj
FAILED: cannot make progress due to previous errors.
Command failed: /Users/kevinbarabash/projects/rescript-compiler/darwin/ninja.exe native all
please run "./scripts/ninja.js config" first

The contents of jscomp/build.ninja is

subninja compiler.ninja
stdlib = stdlib-406
bsc = ../darwin/bsc.exe
subninja runtime/build.ninja
subninja others/build.ninja
subninja $stdlib/build.ninja
subninja test/build.ninja
o all: phony runtime others $stdlib test

which means that $ocamllex in jscomp/test/build.ninja is undefined. As a result when rule mll that makes use of $ocamllex tries to run, it instead ends up trying to execute the .mll files instead of running ocamllex.

rule mll
    command = $ocamllex $in
    generator = true

o test/arith_lexer.ml : mll test/arith_lexer.mll
o test/number_lexer.ml : mll test/number_lexer.mll
o test/simple_lexer_test.ml : mll test/simple_lexer_test.mll

I was able to fix this by updating ninja.js to include a line in jscomp/build.ninja that sets:

ocamllex = ocamllex.opt

I'm not familiar with the ninja build system so I'm not sure if this is the right fix. If it is, let me know and I can submit a PR with my change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions