Hacker News new | ask | show | jobs
by superkuh 2851 days ago
The problem with modern cmake is that it cannot run on older systems. So if you want to use it you end up either static compiling an incredibly hard and tedious depedency tree or have to use some just released OS.

What I want out of a make system isn't bleeding edge features. I want to be able to use it for more than 3 years.

6 comments

A nice tip is that you can install a very recent CMake from pip with most systems.

Just `pip install cmake` and then you can require version 3.12 and don't have to worry about ancient Ubuntu packages or whatever.

On systems were you don't need to do this (new enough) it'll work. On systems where you need to do this it will break things. And because it's pip, it'll be incredibly hard to figure out what broke and how to fix it.
In general you can avoid pip breaking things by doing so inside a virtualenv. The following should work on at least the last few years' worth of OSes:

    $ virtualenv /tmp/ve
    $ /tmp/ve/bin/pip install -U pip setuptools
    $ /tmp/ve/bin/pip install cmake
    $ /tmp/ve/bin/cmake ...
    $ rm -rf /tmp/ve
On some OSes (e.g. Debian and derivatives) you'll need to install virtualenv itself from the OS first, but that won't break things because it's from the OS.

On sufficiently old OSes, you may need to set PIP_INDEX_URL=https://pypi.org/simple/ and PIP_TRUSTED_HOST="pypi.org files.pythonhosted.org" to disable certificate verification. (I'm not sure of a good way to work around this problem. In theory, Python 3 would solve it, but those same old OSes have an old enough Python 3 that the latest version of setuptools fails, and I can't figure out how to install an old enough setuptools.)

Also - if you need to unbreak your system Python, in general it suffices to ensure that /usr/local/lib and ~/.local/lib have no pythonX.Y directories with anything in them. (Empty directories are fine.) At my last job where we needed to give non-sysadmins root access on certain machines, I added a Nagios check to /usr/local/lib/python*, which was remarkably effective at catching problems before they turned inexplicable.

Well, the first page touches briefly on this:

> You should at least install it locally. It's easy (1-2 lines in many cases), and you'll find that 5 minutes of work will save you hundreds of lines and hours of CMakeLists.txt writing

I agree that it's cumbersome wanting to use tools that are not readily available in most commonly used systems. On the other hand, wanting to keep support for old systems that you may only hypothetically want to use shouldn't be limiting your choice of tools (or better versions of a tool). Achieving an easy and straightforward means of installing should be a goal for the tool itself, as it is the case for latest versions of CMake (assuming that phrase about 1-2 lines is true).

I agree that 3 years, or even 5, is an acceptable amount of time to keep using the same version of a tool. I'm currently at CMake 3.5, the one that comes with Ubuntu 16.04

> The problem with modern cmake is that it cannot run on older systems.

... uh ? they ship fully static binaries that work all the way back to centos 5 and other 10+ year old linux distros

https://cmake.org/download/

What systems does modern CMake not support?
Android NDK supports CMake 3.6 only for example.
There are two different things: CMake support within the NDK (by Google) and NDK support in CMake. The later is usually easy to use and supports many NDK revisions.

See: https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7....

There are plans to eventually update cmake support.

https://android.googlesource.com/platform/ndk/+/master/docs/...

But I guess you already know how slowly things in the NDK progress anyway.

If so, that sounds like a lacking of the Android NDK and not the other way around.
Sure, doesn't change anything for me.
I have a 3 something version running on OpenSuSE 11.2 (that thing is ancient) . Spend maybe a day disabling various features to make it compile. Still didn't run into anything that needed cmake to support encryption.
The problem with modern cmake is the huge amount of dependencies it requires.
The only required dependency to build CMake is libuv. Are you talking about something else?