ValdemarGr / mezel

Scala BSP implementation for Bazel.
Apache License 2.0
16 stars 2 forks source link

Mezel project is not importable out of the box #39

Open susliko opened 1 week ago

susliko commented 1 week ago

While trying to import mezel build (i mean the mezel repo itself), these logs are being written to metals.log:

2024.09.02 19:07:12 INFO  2: workspace/buildTargets: cache miss for derivedEnv, running action
2024.09.02 19:07:12 INFO  BSP server: java.util.NoSuchElementException: key not found: output_base
2024.09.02 19:07:12 INFO  BSP server:   at scala.collection.immutable.Map$EmptyMap$.apply(Map.scala:223)
2024.09.02 19:07:12 INFO  BSP server:   at scala.collection.immutable.Map$EmptyMap$.apply(Map.scala:219)
2024.09.02 19:07:12 INFO  BSP server:   at mezel.BspServerOps.outputBaseFromSource$$anonfun$1(BSPServer.scala:310)
2024.09.02 19:07:12 INFO  BSP server:   at get @ mezel.CancellableTask$.make$$anonfun$1$$anonfun$1(CancellableTask.scala:19)
2024.09.02 19:07:12 INFO  BSP server:   at map @ fs2.concurrent.SignallingRef$$anon$4.get(Signal.scala:257)
2024.09.02 19:07:12 INFO  BSP server:   at flatMap @ mezel.BspServerOps.get(BSPServer.scala:301)
2024.09.02 19:07:12 INFO  BSP server:   at map @ mezel.BspServerOps.outputBaseFromSource(BSPServer.scala:310)
2024.09.02 19:07:12 INFO  BSP server:   at map @ mezel.BspServerOps.outputBaseFromSource(BSPServer.scala:310)
2024.09.02 19:07:12 INFO  BSP server:   at map @ mezel.BspServerOps.outputBaseFromSource(BSPServer.scala:312)
2024.09.02 19:07:12 INFO  BSP server:   at map @ mezel.BspServerOps.mkTasks(BSPServer.scala:370)
2024.09.02 19:07:12 INFO  BSP server:   at get @ mezel.CancellableTask$.make$$anonfun$1$$anonfun$1(CancellableTask.scala:19)
2024.09.02 19:07:12 INFO  BSP server:   at map @ fs2.concurrent.SignallingRef$$anon$4.get(Signal.scala:257)
2024.09.02 19:07:12 INFO  BSP server:   at flatMap @ mezel.BspServerOps.get(BSPServer.scala:301)
2024.09.02 19:07:12 INFO  BSP server:   at flatMap @ mezel.BspServerOps.derivedEnv$$anonfun$2(BSPServer.scala:317)
2024.09.02 19:07:12 INFO  BSP server:   at flatMap @ mezel.BspServerOps.derivedEnv$$anonfun$2(BSPServer.scala:317)
2024.09.02 19:07:12 INFO  BSP server:   at as @ mezel.Main$.main$$anonfun$1$$anonfun$1(Main.scala:58)
ValdemarGr commented 1 week ago

Can you run bazel info in the project.

 ✘ valde@nixos  ~/git/mezel   main  bazel info 
bazel-bin: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/execroot/_main/bazel-out/k8-fastbuild/bin
bazel-genfiles: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/execroot/_main/bazel-out/k8-fastbuild/bin
bazel-testlogs: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/execroot/_main/bazel-out/k8-fastbuild/testlogs
character-encoding: file.encoding = ISO-8859-1, defaultCharset = ISO-8859-1
command_log: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/command.log
committed-heap-size: 155MB
execution_root: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/execroot/_main
gc-count: 13
gc-time: 58ms
install_base: /home/valde/.cache/bazel/_bazel_valde/install/7e26c0f1b3f6b658dee2b9a9a80ffbb2
java-home: /home/valde/.cache/bazel/_bazel_valde/install/7e26c0f1b3f6b658dee2b9a9a80ffbb2/embedded_tools/jdk
java-runtime: OpenJDK Runtime Environment (build 21+35) by Azul Systems, Inc.
java-vm: OpenJDK 64-Bit Server VM (build 21+35, mixed mode) by Azul Systems, Inc.
local_resources: RAM=32011MB, CPU=16.0
max-heap-size: 8392MB
output_base: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc
output_path: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/execroot/_main/bazel-out
package_path: %workspace%
release: release 7.1.2
repository_cache: /home/valde/.cache/bazel/_bazel_valde/cache/repos/v1
server_log: /home/valde/.cache/bazel/_bazel_valde/b38cc3c8af6e82d3fafc60d8b18e56bc/java.log.nixos.valde.log.java.20240902-181740.140423
server_pid: 140423
used-heap-size: 46MB
workspace: /home/valde/git/mezel

The error would indicate that output_base should be missing from the bazel info result.

susliko commented 1 week ago

output_base is there 🤔

bazel-bin: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/execroot/_main/bazel-out/k8-fastbuild/bin
bazel-genfiles: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/execroot/_main/bazel-out/k8-fastbuild/bin
bazel-testlogs: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/execroot/_main/bazel-out/k8-fastbuild/testlogs
character-encoding: file.encoding = ISO-8859-1, defaultCharset = ISO-8859-1
command_log: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/command.log
committed-heap-size: 79MB
execution_root: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/execroot/_main
gc-count: 16
gc-time: 270ms
install_base: /home/susliko/.cache/bazel/_bazel_susliko/install/7e26c0f1b3f6b658dee2b9a9a80ffbb2
java-home: /home/susliko/.cache/bazel/_bazel_susliko/install/7e26c0f1b3f6b658dee2b9a9a80ffbb2/embedded_tools/jdk
java-runtime: OpenJDK Runtime Environment (build 21+35) by Azul Systems, Inc.
java-vm: OpenJDK 64-Bit Server VM (build 21+35, mixed mode) by Azul Systems, Inc.
local_resources: RAM=31747MB, CPU=20.0
max-heap-size: 8325MB
output_base: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34
output_path: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/execroot/_main/bazel-out
package_path: %workspace%
release: release 7.1.2
repository_cache: /home/susliko/.cache/bazel/_bazel_susliko/cache/repos/v1
server_log: /home/susliko/.cache/bazel/_bazel_susliko/3852ffcdcaa877196f667c6b5932ee34/java.log.nblx-std-0013d0.susliko.log.java.20240902-192925.142431
server_pid: 142431
used-heap-size: 38MB
workspace: /home/susliko/opt/programming/public/mezel
susliko commented 1 week ago

It's also preceded by

2024.09.02 19:37:49 INFO  BSP server: WARNING: Failed to start process
2024.09.02 19:37:49 INFO  BSP server: java.io.IOException: error=2, No such file or directory
2024.09.02 19:37:49 INFO  BSP server:   at com.zaxxer.nuprocess.internal.LibJava10.Java_java_lang_ProcessImpl_forkAndExec(Native Method)
2024.09.02 19:37:49 INFO  BSP server:   at com.zaxxer.nuprocess.linux.LinuxProcess.prepareProcess(LinuxProcess.java:158)
2024.09.02 19:37:49 INFO  BSP server:   at com.zaxxer.nuprocess.linux.LinuxProcess.start(LinuxProcess.java:69)
2024.09.02 19:37:49 INFO  BSP server:   at com.zaxxer.nuprocess.linux.LinProcessFactory.createProcess(LinProcessFactory.java:40)
2024.09.02 19:37:49 INFO  BSP server:   at com.zaxxer.nuprocess.NuProcessBuilder.start(NuProcessBuilder.java:260)
2024.09.02 19:37:49 INFO  BSP server:   at mezel.CatsProcess$.$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$1$$anonfun$2$$anonfun$2$$anonfun$1(CatsProcess.scala:80)
ValdemarGr commented 1 week ago

Thats seems helpful.

Recently a PR was merged to support apple processors, I suppose that may have caused issues?

https://github.com/ValdemarGr/mezel/pull/38

ValdemarGr commented 1 week ago

Can you verify that the problem was introduced between 0.2.6 and 0.2.7?

susliko commented 1 week ago

Trying older versions gives the same results

susliko commented 1 week ago

How to make use of mezel-local.json? I could debug which path causes "No such file or directory"

ValdemarGr commented 1 week ago

How to make use of mezel-local.json? I could debug which path causes "No such file or directory"

sbt assembly should produce a target/mezel.jar.

Mezel expects bazel to be on PATH. It seems like you use bazelisk, could that be related to the issue? I use an alias for bazelisk named bazel.