Skip to content

Error while compiling a git dep #4740

@trescenzi

Description

@trescenzi

So I'm trying to build Chip, I've got an upgrade to v1 otp here, and it works except it fails to build the first time with an error that's not particularly obvious. I have a hunch it has to do with Lamb, upgrade to v1 otp here, failing to build it's benchmark module in the test folder.

Details

  • gleam version: gleam 1.11.1
  • OS: Mac OS v15.5 (24F74)
  • Elixir Version output since it depends on elixir as well:
Erlang/OTP 28 [erts-16.0.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Elixir 1.18.4 (compiled with Erlang/OTP 27)

Steps to reproduce

  • git clone https://github.com/trescenzi/chip.git
  • cd chip
  • git checkout upgrade-to-erlang-otp-v1
  • gleam build
  • error occurs
  • gleam build
  • build succeeds

It's also possible to reproduce with the project I'm working on that has my Chip upgrade as a dependency via a dockerfile:

  • git clone https://github.com/trescenzi/points.git
  • Edit the Dockerfile to remove lines 7 & 8(these are the workaround)
  • docker build .

The docker build will always fail since the state is always clean.

Error output

 I  ~/c/chip upgrade-to-erlang-otp-v1• λ gleam build                                                                                                                                          15:01:32
Downloading packages
 Downloaded 8 packages in 0.31s
  Compiling deep_merge
  Compiling statistex
  Compiling benchee
  Compiling gleam_stdlib
  Compiling gleam_erlang
  Compiling gleam_otp
  Compiling gleeunit
  Compiling lamb
/Users/trescenzi/code/chip/build/dev/erlang/lamb/_gleam_artefacts/lamb_erlang_ffi.erl:99:33: Warning: ambiguous call of overridden auto-imported BIF error/1 --
use erlang:error/1 or "-compile({no_auto_import,[error/1]})." to resolve name clash
%   99|             {invalid, lists:map(fun error/1, Errors)}
%     |                                 ^

    warning: :benchmark.query_find_record/1 is undefined (module :benchmark is not available or is yet to be defined)
    │
 19 │           @lamb.count(table, @benchmark.query_find_record(index))
    │                                         ~
    │
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:19:41: Lamb.Artifacts.IndexedBenchmark.run/1
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:22:42: Lamb.Artifacts.IndexedBenchmark.run/1

    warning: :benchmark.random/1 is undefined (module :benchmark is not available or is yet to be defined)
    │
 26 │       before_each: fn _ -> @benchmark.random(100_000) end,
    │                                       ~
    │
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:26:39: Lamb.Artifacts.IndexedBenchmark.run/1

    warning: :benchmark.query_find_record/1 is undefined (module :benchmark is not available or is yet to be defined)
    │
 46 │           @lamb.count(table, @benchmark.query_find_record(group))
    │                                         ~
    │
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:46:41: Lamb.Artifacts.BaggedBenchmark.run/1
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:49:42: Lamb.Artifacts.BaggedBenchmark.run/1
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:58:41: Lamb.Artifacts.BaggedBenchmark.run/1
    └─ build/dev/erlang/lamb/_gleam_artefacts/benchmark.ex:61:42: Lamb.Artifacts.BaggedBenchmark.run/1

  Compiling chip
escript: exception error: no match of right hand side value
                 {error,{already_started,compiler}}
  in function  gleam@@compile_erl__escript__1751__223696__517199__1122:compile_elixir/2 (/Users/trescenzi/code/chip/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl:118)
  in call from gleam@@compile_erl__escript__1751__223696__517199__1122:compile_package/3 (/Users/trescenzi/code/chip/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl:41)
  in call from gleam@@compile_erl__escript__1751__223696__517199__1122:compile_package_loop/0 (/Users/trescenzi/code/chip/build/dev/erlang/gleam_stdlib/_gleam_artefacts/gleam@@compile.erl:19)
  in call from escript:run/2 (escript.erl:906)
  in call from escript:start/1 (escript.erl:420)
  in call from init:start_it/1
  in call from init:start_em/1
  in call from init:do_boot/3
error: Shell command failure

There was a problem when running the shell command `escript`.

gleam.toml for my Chip fork

In case it's helpful here's the toml. You can find it here too.

name = "chip"
version = "1.1.1"
description = "A Gleam registry library"
licences = ["Apache-2.0"]

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
#
repository = { type = "github", user = "chouzar", repo = "chip" }
gleam = ">= 1.4.0"
# links = [{ title = "Website", href = "https://gleam.run" }]

[documentation]
pages = [
    { title = "as a local pubsub", path = "guides/as-local-pubsub.html", source = "./test/guides/as-local-pubsub.md" },
    { title = "as a subject index", path = "guides/as-subject-index.html", source = "./test/guides/as-subject-index.md" },
    { title = "as part of supervisor", path = "guides/as-part-of-supervisor.html", source = "./test/guides/as-part-of-supervisor.md" },
]

[dependencies]
gleam_stdlib = ">= 0.36.0 and < 2.0.0"
gleam_erlang = ">= 1.0.0 and < 2.0.0"
gleam_otp = ">= 1.0.0 and < 2.0.0"
lamb = { git = "https://github.com/trescenzi/lamb.git", ref = "9b9b0e2" }

[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
benchee = ">= 1.3.0 and < 2.0.0"

Gleam logs

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