WEBVTT

00:00:00.460 --> 00:00:04.400
A project needs a newer version of a tool
than your system will hand over.

00:00:05.020 --> 00:00:09.300
Before you can do any work on it, you have
to track down that version yourself.

00:00:09.780 --> 00:00:11.720
Count the steps it takes to get there,

00:00:12.140 --> 00:00:15.640
and you have a fair test
of anything that offers to help.

00:00:16.440 --> 00:00:19.800
This is the OCX Podcast for engineers

00:00:19.860 --> 00:00:23.320
who install tools on laptops
and in pipelines.

00:00:23.940 --> 00:00:24.773
I'm Vera.

00:00:24.800 --> 00:00:25.633
And I'm Max.

00:00:26.220 --> 00:00:30.940
This episode assumes one thing from last
time: the registry you already run

00:00:30.980 --> 00:00:35.300
can hand out a tool with a build
for each platform behind one name.

00:00:35.740 --> 00:00:38.280
Today, we start with nothing installed

00:00:38.680 --> 00:00:41.400
and stop once that version is on screen.

00:00:41.740 --> 00:00:44.920
Your project just raised
the minimum CMake it needs.

00:00:45.540 --> 00:00:48.960
You pull the change onto your Ubuntu
laptop, open a terminal,

00:00:49.260 --> 00:00:50.660
and run the configure step.

00:00:51.140 --> 00:00:54.560
It stops at the very first
check with this:

00:00:55.380 --> 00:00:59.060
CMake 3.31 or higher is required.

00:00:59.720 --> 00:01:03.160
You are running version 3.28.3.

00:01:03.640 --> 00:01:07.291
You didn't pick that older one.
It's simply what the system shipped with,

00:01:07.640 --> 00:01:09.520
and until now, that was fine.

00:01:09.840 --> 00:01:11.900
That's how a long-term release works.

00:01:12.400 --> 00:01:16.220
It holds its version still,
and it does that on purpose.

00:01:16.780 --> 00:01:20.540
The same freeze held back episode
zero's runner in a pipeline.

00:01:21.220 --> 00:01:25.180
This time it's on your desk, and your
project has already moved past it.

00:01:25.460 --> 00:01:29.380
The project setup instructions
don't give you a single answer.

00:01:30.060 --> 00:01:35.160
Ubuntu 24.04 has no newer CMake,
and none is on the way,

00:01:35.820 --> 00:01:37.500
so they give you branches.

00:01:38.020 --> 00:01:40.860
The vendor's own package
repository for a start,

00:01:41.480 --> 00:01:43.680
or pip inside a virtual environment.

00:01:44.140 --> 00:01:48.860
Or an archive you unpack into a folder
of its own and add to your path

00:01:48.900 --> 00:01:49.733
by hand.

00:01:50.460 --> 00:01:54.200
Someone even asked the project's
maintainers whether they had to upgrade

00:01:54.220 --> 00:01:58.460
the whole operating system
for this, and the answer was no.

00:01:58.980 --> 00:02:00.980
All of them work on somebody's machine.

00:02:01.560 --> 00:02:06.220
Which one fits this laptop is your call,
and you have to make it before you've run

00:02:06.260 --> 00:02:07.511
the version you came for.

00:02:07.700 --> 00:02:10.960
Trying a version of a tool
should take one install

00:02:11.300 --> 00:02:14.280
and one command that names
the version you want.

00:02:14.700 --> 00:02:18.260
With the CMake that came
with the system left exactly where it is.

00:02:18.640 --> 00:02:23.420
And a second version asked for later
shouldn't move the first one either.

00:02:23.820 --> 00:02:26.080
We're testing a package
manager against that,

00:02:26.640 --> 00:02:28.641
one that installs tools from a registry.

00:02:29.180 --> 00:02:30.620
It's called OCX.

00:02:31.020 --> 00:02:32.920
That laptop doesn't have it yet,

00:02:33.420 --> 00:02:36.660
and the system CMake
is still the only one on it.

00:02:36.900 --> 00:02:40.920
The install on that Ubuntu laptop
is a single line for its shell.

00:02:41.660 --> 00:02:43.480
That line hands the shell a script,

00:02:43.760 --> 00:02:46.311
and you'd want to know what
it does before it runs.

00:02:46.620 --> 00:02:49.620
It works out the platform,
fetches the archive,

00:02:49.860 --> 00:02:53.800
and checks that download against
the checksum in the release manifest.

00:02:54.460 --> 00:02:56.580
Once it matches, its job is done.

00:02:56.980 --> 00:03:00.300
The handoff goes to the OCX
binary it just fetched,

00:03:00.620 --> 00:03:03.220
which carries on with a step
called self-setup.

00:03:03.620 --> 00:03:05.240
That split matters.

00:03:05.800 --> 00:03:10.820
The fetching and checking are one way
to reach that step, but not the only one.

00:03:11.240 --> 00:03:13.891
If you won't pipe a script
at all, you don't need it.

00:03:14.220 --> 00:03:16.960
Download the archive
by hand and run self-setup.

00:03:17.340 --> 00:03:18.173
By default,

00:03:18.440 --> 00:03:22.620
the setup step at the end
of the install edits your shell profiles.

00:03:23.260 --> 00:03:27.440
On Linux, it also writes a file
that sets your path for the session.

00:03:27.960 --> 00:03:31.140
Those are files people
guard closely, me included.

00:03:31.780 --> 00:03:34.081
Mine should stay exactly
the way I wrote them.

00:03:34.600 --> 00:03:36.640
One flag skips both edits.

00:03:37.260 --> 00:03:38.311
If you didn't use it,

00:03:38.600 --> 00:03:42.760
open a new terminal and ask OCX
what it found on this machine.

00:03:43.440 --> 00:03:47.660
It answers with its own version,
the registry it uses by default,

00:03:48.040 --> 00:03:48.940
the platform.

00:03:49.240 --> 00:03:50.560
And which C library.

00:03:50.980 --> 00:03:53.800
Episode zero named the libc tax,

00:03:54.220 --> 00:03:57.420
and here the tool names
the C library it found.

00:03:58.100 --> 00:04:01.360
That's on screen before you've
even asked for CMake.

00:04:01.700 --> 00:04:03.480
For the CMake your project needs,

00:04:03.840 --> 00:04:08.760
you ask OCX's package exec
to run 3.31 and print its version.

00:04:09.180 --> 00:04:13.340
There's no refresh step beforehand
and no install step either.

00:04:14.040 --> 00:04:17.600
The first time it says
the package isn't on the laptop yet

00:04:17.959 --> 00:04:19.210
and that it's pulling it.

00:04:19.519 --> 00:04:22.140
After the pull, CMake itself answers,

00:04:22.700 --> 00:04:25.160
version 3.31.12.

00:04:25.620 --> 00:04:29.080
That's the CMake the project
asked for on a laptop

00:04:29.140 --> 00:04:32.000
whose own package manager
couldn't supply it.

00:04:32.720 --> 00:04:37.340
Run it again and it doesn't pull anything
because the download stays on disk.

00:04:37.720 --> 00:04:40.721
You got there without touching
the system's package sources,

00:04:41.020 --> 00:04:44.000
building a virtual environment,
or upgrading anything.

00:04:44.340 --> 00:04:48.700
Running CMake through package exec
doesn't put anything on your path.

00:04:49.360 --> 00:04:52.600
No link goes into any folder
your shell searches.

00:04:53.080 --> 00:04:55.620
Nothing landing on my path
is one half of it.

00:04:56.180 --> 00:05:00.360
The other half is what CMake can see
of my own setup while it's running.

00:05:00.720 --> 00:05:05.080
The package's settings sit on top
of yours, not instead of them.

00:05:05.740 --> 00:05:10.560
For CMake, the package declares
just one, and it's the search path.

00:05:10.940 --> 00:05:14.080
A variable I've exported
still reaches CMake in there,

00:05:14.620 --> 00:05:18.320
and a tool already on my path
resolves inside the run too.

00:05:18.740 --> 00:05:23.460
When a run succeeds, part of the reason
could be something you set up yourself.

00:05:23.720 --> 00:05:27.620
You asked for a CMake release and got
a patch number you never typed.

00:05:28.140 --> 00:05:29.391
Where did that come from?

00:05:29.500 --> 00:05:33.160
The version you write after
the package's name is a tag.

00:05:33.780 --> 00:05:37.700
That tag means the newest
patch it has in that release.

00:05:38.080 --> 00:05:40.800
Which means changing
the tag changes the answer.

00:05:41.460 --> 00:05:44.060
Make it 4.0, run the same command,

00:05:44.320 --> 00:05:47.020
and CMake reports 4.0.7.

00:05:47.300 --> 00:05:49.520
There's no switching step in between,

00:05:50.220 --> 00:05:54.360
and a missing tag fails
with its own exit code instead

00:05:54.400 --> 00:05:55.740
of guessing one for you.

00:05:56.100 --> 00:05:58.740
Good, because a typo should stop the run.

00:05:59.380 --> 00:06:01.660
But running a version isn't installing it.

00:06:02.080 --> 00:06:05.900
And that laptop's second
project wants 4.0 every day.

00:06:06.220 --> 00:06:11.300
Installing versions side by side takes
its own command: package install.

00:06:12.020 --> 00:06:14.520
The project's 3.31 goes in,

00:06:14.920 --> 00:06:19.100
and 4.0 goes in beside it,
with nothing overwritten.

00:06:19.580 --> 00:06:22.700
The stock CMake packages from apt, DNF,

00:06:22.800 --> 00:06:25.320
and Homebrew ship one version at a time.

00:06:25.680 --> 00:06:27.840
To pick between
the versions you installed,

00:06:28.340 --> 00:06:33.080
OCX keeps one folder for CMake,
always at the same address.

00:06:33.800 --> 00:06:36.640
Select decides
which version you find in it.

00:06:37.000 --> 00:06:40.240
Select 4.0, and that's
the CMake in that folder.

00:06:40.920 --> 00:06:44.900
Select 3.31, and the same folder
gives you that one instead.

00:06:45.300 --> 00:06:50.460
The route you needed, asking for a version
and leaving the system's copy alone,

00:06:50.900 --> 00:06:53.760
was never in the project's
setup instructions.

00:06:54.080 --> 00:06:57.960
On that Ubuntu laptop, the project's
configure step runs again.

00:06:58.680 --> 00:07:01.280
Now, it goes through OCX's package exec,

00:07:01.660 --> 00:07:03.940
asking for CMake 3.31.

00:07:04.280 --> 00:07:05.120
And this time,

00:07:05.340 --> 00:07:09.380
it gets past the version check
and goes on to write the build files.

00:07:09.840 --> 00:07:12.620
Ask the shell afterwards
which CMake it finds,

00:07:12.920 --> 00:07:15.680
and it's still the system's at 3.28.

00:07:16.200 --> 00:07:17.700
The release kept its freeze.

00:07:18.100 --> 00:07:21.420
The project's setup instructions
can drop their branches, too:

00:07:22.060 --> 00:07:24.700
the install line
for your shell and, under it,

00:07:24.940 --> 00:07:27.180
the package exec for the configure step.

00:07:27.580 --> 00:07:31.100
That's a change the project makes
once in its own instructions.

00:07:31.720 --> 00:07:34.121
Nobody has to wait
for the distribution to move.

00:07:34.340 --> 00:07:38.900
We've stayed with the commands this whole
time and the versions they printed back.

00:07:39.300 --> 00:07:42.100
I'd like to look underneath
that at the disk itself.

00:07:42.800 --> 00:07:44.401
When the second version arrived,

00:07:44.580 --> 00:07:47.831
what actually happened there
with the first one already in place?

00:07:48.240 --> 00:07:50.060
That's where episode three goes.

00:07:50.720 --> 00:07:52.060
Every version at once,

00:07:52.700 --> 00:07:53.820
nothing overwritten.

00:07:54.440 --> 00:07:57.440
Everything's at ocx.sh.

00:07:58.540 --> 00:08:01.100
Same toolchain on every laptop.

00:08:01.480 --> 00:08:02.760
And in CI.

00:08:03.540 --> 00:08:04.680
See you next episode.

