jpmens / jo

JSON output from a shell
http://jpmens.net/2016/03/05/a-shell-command-to-create-json-jo/
Other
4.66k stars 156 forks source link

How to get jo installed on Ubuntu? #171

Closed ssallmen-pro closed 2 years ago

ssallmen-pro commented 2 years ago

I thought to try jo in one of my projects but I am not able to install the latest version of it on Ubuntu Focal. To try out the tool, first I tried by installing jo directly from Debian package in a Ubuntu docker container:

$ docker run -it ubuntu:focal

root@351632576f66:/# apt-get update; apt-get install jo
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [843 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1275 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [25.8 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [988 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1585 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2013 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1058 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [29.4 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1136 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [25.2 kB]
Fetched 21.2 MB in 19s (1108 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  jo
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 17.1 kB of archives.
After this operation, 44.0 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 jo amd64 1.1-1 [17.1 kB]
Fetched 17.1 kB in 0s (62.5 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package jo.
(Reading database ... 4127 files and directories currently installed.)
Preparing to unpack .../archives/jo_1.1-1_amd64.deb ...
Unpacking jo (1.1-1) ...
Setting up jo (1.1-1) ...
root@351632576f66:/# jo -v
jo 1.0

As you can see I got it installed, but the version is 1.0, not even close to the latest version. Then, I tried by installing from source in tar-ball. Since the output from that is quite long, I am attaching it as a file in here. build-jo-in-ubuntu-focal.log

As you can see, there are some warnings coming and the makefile generation is not successful. How I can get the latest version of jo installed either from Debian package or from source?

ssallmen-pro commented 2 years ago

I even tried to go further by installing the missing pandoc but that did not help either. And, I would more prefer the Debian package to avoid the time building takes since I would need to do that quite often as my project is related to running a GitHub Actions workflow, in which I would use jo only as one small part to replace my own bash script to update some JSON configuration files.

gromgit commented 2 years ago

Ubuntu doesn't seem to be up-to-speed with jo. Homebrew is, but I suspect you might not want to pull in Yet Another Package Manager to GitHub Actions, so you're best served building from source.

The error you're getting suggests you don't have pkg-config installed. Try apt install pkg-config, then autoreconf -i and ./configure again.

ssallmen-pro commented 2 years ago

Thanks @gromgit! I got it installed and working now in a plain Ubuntu docker container. I just have to try out what is the fastest and easiest way to get all things prepared to get jo since the GitHub Actions (company local) runner that I need to use for running my workflow, where I will then need jo, is a Docker container that is spin up from an image every time separately, and I can't add anything to the runner image itself. So, I will need to do all the installations for every workflow run in the workflow, and that has to be fast. If the runner image does not yet have all the needed stuff for building jo from source, I will probably need to discard that idea since the installation of all the dependencies for building from source will take way too much time from the run. Build itself is fast though. Need to check also the possibility, and speed, of installing brew and using that to install jo. Thanks for the hint!

gromgit commented 2 years ago

Since you're playing in Docker-land, you might want to check out Homebrew's official Dockerfile, which is used by their own CI infrastructure for all Linux build stuff. You can probably substitute any user from your company's image in place of the linuxbrew user, but the /home/linuxbrew/.linuxbrew base directory is non-negotiable if you want to use pre-compiled Homebrew bottles instead of building from source.