technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

Trouble starting REPL on ubuntu 18.04 #2789

Closed BenLeadbetter closed 1 year ago

BenLeadbetter commented 2 years ago

I'm having trouble starting lein repl with a fresh install on ubuntu 18.04.

Disclaimer: This is my first "Hello, world!" clojure project, so I'm probably missing something obvious. Any help is much appreciated! :-)

Here are some steps to get to my issue:

  1. Install the openjdk sudo apt install openjdk-8-jdk

  2. Install latest lein

    • copy this file to /usr/local/bin/lein
    • sudo chmod +x /usr/local/bin/lein
  3. create this minimal project file in a clean dir

    (defproject overtone-tutorial "1.0.0"
    :dependencies [[overtone/overtone "0.10.3"]]
    :native-path "native"
    :source-paths ["src"])
  4. run lein repl

    • a bunch of dependencies are retreived
    • I see the following status print to the std out nREPL server started on port 37073 on host 127.0.0.1 - nrepl://127.0.0.1:37073, but I do not get any more output, or a user=> prompt. The session just hangs until I terminate it.

Am I missing something?? Thanks in advance!

winks commented 2 years ago

Hi, while it's probably not helpful this doesn't look like a general problem and I just tried to repro (I do have a different jdk package installed though) and can't (see below).

Can you maybe retry on another machine or via:

docker run --rm -it ubuntu:18.04 /bin/bash
λ(florian@nihil ~/tmp) $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic
λ(florian@nihil ~) $ uname -a
Linux nihil 5.4.0-65-generic #73~18.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
λ(florian@nihil ~) $ dpkg -l |grep jdk
ii  openjdk-11-jdk:amd64                   11.0.14+9-0ubuntu2~18.04                        amd64        OpenJDK Development Kit (JDK)
ii  openjdk-11-jdk-headless:amd64          11.0.14+9-0ubuntu2~18.04                        amd64        OpenJDK Development Kit (JDK) (headless)
ii  openjdk-11-jre:amd64                   11.0.14+9-0ubuntu2~18.04                        amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-11-jre-headless:amd64          11.0.14+9-0ubuntu2~18.04                        amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jdk-headless:amd64           8u312-b07-0ubuntu1~18.04                        amd64        OpenJDK Development Kit (JDK) (headless)
ii  openjdk-8-jre-headless:amd64           8u312-b07-0ubuntu1~18.04                        amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
λ(florian@nihil ~) $ cd tmp
λ(florian@nihil ~/tmp) $ wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
--2022-03-23 16:50:50--  https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13544 (13K) [text/plain]
Saving to: ‘lein’

lein                                                        100%[========================...=====>]  13,23K  --.-KB/s    in 0,001s

2022-03-23 16:50:50 (10,6 MB/s) - ‘lein’ saved [13544/13544]

λ(florian@nihil ~/tmp) $ chmod +x lein
λ(florian@nihil ~/tmp) $ vi project.clj

# I cut out the original run here because I didn't have DEBUG and used Java 11...

λ(florian@nihil ~/tmp) $ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -version                                                                                                                                                          
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-8u312-b07-0ubuntu1~18.04-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
λ(florian@nihil ~/tmp) $ JAVA_CMD=/usr/lib/jvm/java-8-openjdk-amd64/bin/java DEBUG=1 ./lein repl
Leiningen's classpath: /home/florian/.lein/self-installs/leiningen-2.9.8-standalone.jar
Applying task repl to []
Applying task javac to nil
Running javac with [@/tmp/.leiningen-cmdline1470219929842258305.tmp]
Applying task compile to nil
All namespaces already AOT compiled.
nREPL server started on port 40699 on host 127.0.0.1 - nrepl://127.0.0.1:40699
REPL-y 0.5.1, nREPL 0.8.3
Clojure 1.9.0-alpha17
OpenJDK 64-Bit Server VM 1.8.0_312-8u312-b07-0ubuntu1~18.04-b07
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=>
BenLeadbetter commented 2 years ago

Hey! Thanks for having a look.

Hmm .. I can confirm that when I ran my repro steps in a docker container with the ubuntu 18.04 image it all ran fine - no hanging :-/.

Any ideas on what I could try to help me debug this hang on my machine?

technomancy commented 2 years ago

What happens if you remove the overtone dependency? Are you able to launch a repl in other projects? What about outside a project?

BenLeadbetter commented 2 years ago

Ok, so I've downloaded the clojure command line tools and I can successfully start a REPL with the command.

> clj

I've never started a REPL via lein on any other project file, so I don't know if the issue is particular to this project. Regarding removing the overtone dependency, I naively deleted the dependencies line from project file in my original post, but it looks like it doesn't parse correctly. This is the error I get:

> lein repl
Error: Could not find or load main class clojure.main
Subprocess failed (exit code: 1)

Could you suggest a minimal project file, without dependencies, for me to try?

technomancy commented 2 years ago

You can create a minimal project with lein new whatever.

BenLeadbetter commented 2 years ago

So, I create a blank project with lein new test_project; I run > lein repl from the project root and I get the same hanging behaviour:

nREPL server started on port 39721 on host 127.0.0.1 - nrepl://127.0.0.1:39721

and it hangs there. Never get a prompt.

technomancy commented 2 years ago

Hm; well without a way to reproduce the problem I don't think I can give much advice about how to fix it, but there is a workaround; you could try lein trampoline repl which will bypass nrepl and just do a fully in-process repl. You won't be able to connect your editor to it, but if the problem has something to do with the port, you could possibly work around it.

BenLeadbetter commented 2 years ago

Interestingly > lein trampoline repl hangs straight away. I get no output at all after running this command in a fresh project.

technomancy commented 1 year ago

If we can get some more details here on how to reproduce the problem we can reopen this issue, but in its present state it is not actionable.