Fork me on GitHub
#beginners
<
2022-07-18
>
FHE04:07:43

So...I asked about this over a year ago when I was trying to install Clojure on a different machine. Here I am again and the linux-install method here still doesn't work?? https://clojure.org/guides/install_clojure#_linux_instructions

FHE04:07:41

I run these commands, as specified:

curl -O 
chmod +x linux-install-1.11.1.1149.sh
sudo ./linux-install-1.11.1.1149.sh
and then I get the following error on the last command: Downloading and expanding tar % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16.9M 100 16.9M 0 0 8982k 0 0:00:01 0:00:01 --:--:-- 8980k /usr/bin/gzip: 1: ELF: not found /usr/bin/gzip: 3: : not found /usr/bin/gzip: 4: Syntax error: "(" unexpected tar: Child returned status 2 tar: Error is not recoverable: exiting now

lsenjov04:07:41

That's... how I install it. What shell are you using?

phronmophobic04:07:47

what happens when you try to run gzip by itself?

phronmophobic04:07:35

I'm not super familiar with WSL, but maybe all of the expected prerequisites aren't there?

phronmophobic04:07:44

does the following work?

$ echo 'hi' | gzip | gzip -d
hi

FHE04:07:58

How does one report to the maintainers of that Clojure installation guide that there may be an issue with it? Clearly they have updated the clojure-tools version between early 2021 and now, so the guide is being looked after, but somehow it just still doesn't work (at least for me, on a freshly installed WSL/WSL2!).

FHE04:07:18

...and is there some way to get that method working?

FHE04:07:43

Well, I did check and see that despite my efforts to get WSL2 going, it was still on WSL1, so I uninstalled Linux (Ubuntu 22.04 LTS), ran wsl --set-default-version 2 in PowerShell, and reinstalled Ubuntu 22.04 (from MS Store). Then I installed java (openjdk11) and rlwrap and I verified that bash and curl were pre-installed, as per https://clojure.org/guides/install_clojure#_linux_instructions. ...and this time around, when I run the three commands

curl -O 
chmod +x linux-install-1.11.1.1149.sh
sudo ./linux-install-1.11.1.1149.sh
...I still get an error after the last command, but this time around it's just sudo: ./linux-install-1.11.1.1149.sh: command not found This doesn't feel like progress. 😞

hiredman05:07:04

In the same terminal, without running anything after the sudo, what does ls -la ./linux-install-1.11.1.1149.sh show?

hiredman05:07:01

It sounds like setting the execute bit (the chmod command) didn't happen

hiredman05:07:44

The ls command above will show what the permissions are on the file and if the execute bit is set

FHE05:07:20

If I try to run that last command without sudo I get a different error: $ ./linux-install-1.11.1.1149.sh -bash: ./linux-install-1.11.1.1149.sh: Permission denied ...so it seems to be confused by 'sudo'. So anyway, why would that real command from the Clojure guide, sudo ./linux-install-1.11.1.1149.sh , yield sudo: ./linux-install-1.11.1.1149.sh: command not found ?

FHE05:07:10

OK...answered my own question! facepalm When it came to the 2nd of the 3 commands, chmod +x linux-install-1.11.1.1149.sh, I wanted to know what that command did, so I tried running it without the +x hoping it would show me the original state of whatever file attributes chmod commands affect. (That didn't work, since as I later found out chmod doesn't work to see attributes, only change them, and ls is used to see them) Then when I wanted to run the original command, I filled in -x instead of +x , just because most switches I've ever used have been with minus symbols and not plus symbols!

FHE05:07:11

After running the proper commands (with +x in the 2nd one), everything seems to be installed. I would still be interested in why the alternate method (via brow) was recommended to me last time instead of the linux-install method.

lsenjov05:07:34

s/brow/brew? At a guess? Brew isn't maintained by the clj core team

lispyclouds05:07:44

@UH5SE3NM9 Homebrew or brew is a package manager that's more prevalent on MacOS and has a Linux version too https://docs.brew.sh/Homebrew-on-Linux Since the clojure brew tap is maintained and regularly updated every clojure release it's an easier option.

lispyclouds05:07:35

The same brew tap works for both mac and Linux, hence its a recommendation too, specially on developer machines. On Linux servers for example setting up brew is overkill and people generally use the install shell script.

FHE06:07:59

OK, good to hear some other people actually use the linux-install method. I'll do that for now. ...and one day maybe I'll figure out what the advantages of brew would be.

lispyclouds06:07:22

Primary advantage there is you can run “brew upgrade” and it can go check for updates and install them. Similar to apt or some other package manager. Hence it's easier for dev machines, you don't have to find the install script and run it every time.

lispyclouds06:07:00

The shell script method is easier on servers as mostly we'd fix the version being installed and the script is invoked via some automation, generally not a human.

Drew Verlee14:07:02

While we're on the topic, im used to apt-get installing packages. Why wouldn't they be the default way on Linux?

lispyclouds14:07:59

yeah it should work on debian based ones, but then everyone isnt on those

lispyclouds14:07:42

also they update at a slower pace that the official releases, i guess thats why it isnt recommended maybe?

lispyclouds14:07:04

apt clojure is still at 1.10 i think

seancorfield19:07:59

@U0DJ4T5U1 Also a lot of these package manages for Linux tend to require "build from source" for distributions and building all of the pieces to make Clojure's CLI completely installable from source is very hard (it depends on tools.deps which depends on Clojure itself which depends on spec which also depends on Clojure so you end up having to bootstrap it all from an old version of Clojure pre-spec I think).

👍 1
seancorfield19:07:44

@UH5SE3NM9 FWIW, I use brew on Linux because it makes it easy to upgrade regularly and also to keep lots of different versions installed so I can easily switch between them for testing.

seancorfield19:07:06

Versions I have installed for testing:

[email protected]:~/oss/next-jdbc$ ls -d /home/linuxbrew/.linuxbrew/Cellar/clojure*
/home/linuxbrew/.linuxbrew/Cellar/clojure              /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]  /home/linuxbrew/.linuxbrew/Cellar/[email protected]
🙂

seancorfield19:07:39

Which reminds me I haven't installed 1149 on this machine (I have it on my main dev machine).

👀 1
Drew Verlee21:07:31

Thanks for the info. I'll have to think about that, I guess i don't have a good conceptual model for linuxbrew vs apt-get install. I just do what the instructions say most of the time 🙂 .

aaelony19:07:08

what is the best way to go from a maven pom file to deps.edn or project.clj?

seancorfield19:07:46

The Clojure CLI (and tools.deps) can use pom.xml directly. What is your use case / problem?

aaelony19:07:43

That is exactly what I am looking for. Is there an example or documentation?

aaelony19:07:50

In my case, I did not write the maven pom file. I would like to generate a deps.edn file from the POM file because I will want to add things via deps.edn rather than thd pom

aaelony19:07:04

the pom file has deps that serve as a starting point

seancorfield19:07:33

It's probably mentioned in the official deps and CLI docs on http://clojure.org -- but probably only in passing that deps have to be deps.edn or pom.xml or via git?

seancorfield19:07:19

And that may only be true for dependencies, not the primary project but you could use :local/root "." I suspect from the command-line...

seancorfield19:07:29

Then you could probably use -Stree to visualize the deps more easily and take the top level of that and make deps.edn from it...? Depending on how complex the pom.xml file is, it may be easier/faster to just write deps.edn yourself...

aaelony19:07:37

hmmm, was hoping for an easy one-liner to convert pom to deps.edn

seancorfield19:07:48

None that I know of...

seancorfield19:07:14

There's a one-liner to create/update pom.xml from a deps.edn file, but not the other way around.

aaelony19:07:26

I haven't followed clj details in a bit so will likely need to get up to speed on cli first then

aaelony19:07:04

yeah, I am seeking the opposite direction, from POM to deps

seancorfield19:07:14

Why does the project have pom.xml and not a Clojure deps file (either deps.edn or project.clj) in the first place?

dpsutton19:07:15

it might be easier to just declare a folder containing that pom as a local/root? I think you could get it for free that way. Presumably you just want all that stuff on the classpath so you can get a repl going?

seancorfield19:07:38

Yeah, that's why I suggested the :local/root approach above...

aaelony19:07:42

A Java person handed me a pom file

dpsutton19:07:52

ah missed it. sorry both of you

aaelony19:07:44

thank you this is all useful info, but I will need to read up on the docs

seancorfield19:07:28

Probably the easiest thing is to create a simple project (say with deps-new), create a java-lib folder in it and copy the pom.xml file there, then add a dep of java-lib/java-lib {:local/root "java-lib"} to the project deps.edn and you should be off to the races.

👍 1
seancorfield19:07:08

That should at least let you get a REPL up and running as Dan suggested.

aaelony19:07:25

awesome! many thanks!!

dpsutton19:07:30

one other thought, not sure if i’ve seen it mentioned, if you can get your hands on a jar this all goes away. just use the jar. clj -Sdeps '{:deps {:local/root "location/lib.jar"}}

💯 1
aaelony20:07:21

btw, this is excellent, thanks again!!

aaelony20:07:43

thanks again to you both