Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a script in contrib to download a cmake binary #19632

Merged
merged 2 commits into from
Dec 22, 2016
Merged

Conversation

tkelman
Copy link
Contributor

@tkelman tkelman commented Dec 17, 2016

will help on Ubuntu 14.04 and other distros when we upgrade to a
version of LLVM that requires cmake 3.4.3 or newer (#19123)

probably more useful on linux than on mac, since I assume most people on mac are getting cmake from homebrew

will help on Ubuntu 14.04 and other distros when we upgrade to a
version of LLVM that requires cmake 3.4.3 or newer
@tkelman tkelman added the domain:building Build system, or building Julia or its dependencies label Dec 17, 2016
@tkelman tkelman mentioned this pull request Dec 17, 2016
exit 1;;
esac

deps/tools/jldownload https://cmake.org/files/v$CMAKE_VERSION_MAJMIN/$FULLNAME.tar.gz
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this to the whitelist on cache.julialang.org and verified it works with this PR.

deps/tools/jldownload https://cmake.org/files/v$CMAKE_VERSION_MAJMIN/$FULLNAME.tar.gz
echo "$CMAKE_SHA256 $FULLNAME.tar.gz" | sha256sum -c -
tar -xzf $FULLNAME.tar.gz
echo "CMAKE = $PWD/$CMAKE_EXTRACTED_PATH" >> Make.user
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me ever so slightly uneasy; usually we don't touch Make.user at all. I'm not fundamentally against it, but I could see us deciding this is a bad idea in the future. Also, if we do do this, I usually use override for anything in Make.user.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to auto-set CMAKE to our possible installation downloaded paths if they exist, since they are easily calculable, and could still be easily overwritten from Make.user, so we wouldn't lose any flexibility if the user for whatever reason didn't want to use our downloaded CMAKE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMAKE variable is specifically initialized with CMAKE ?= cmake so it doesn't need override.

I'd much rather do it this way then either adding the folder to the path or replacing the CMAKE ?= cmake default with anything far more complicated that has to check the filesystem.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not so complicated, it's a simple check for the existence of the cmake binary at one location per platform. I don't think we should have our build system provide automated helper functions that rely on overrides placed in locations that are usually only user-specified. This is not so different from our handling of patchelf, only instead of relying on a USE_SYSTEM_XYZ make variable, we first check for the existence of a file.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short, I feel that if we are going to provide a helper function to download a tool, we should be able to automatically find that tool once it's been downloaded by our helper script.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users won't be prompted to run download_cmake.sh unless there is a problem during llvm cmake build time, right? And even if users do download this cmake and it gets used during build time, that shouldn't introduce new problems, should it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it actually could cause problems if a different cmake gets used to try to rebuild one of the other libraries, libgit2 or mbedtls etc that aren't as picky about version requirements

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's no different from any other kind of build dependency that changes in between builds, though. For bonus points, we could clean every cmake-using dependency when we run download_cmake.sh.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I take the approval as "good enough for now" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it a bit more, I guess where your way might make more sense is if we also want to use this on the buildbots. Is that any easier than your current scripts that are compiling it from source? We could drop back to 3.6.3 which is the last version of cmake where they provided 32 bit linux binaries.

esac

deps/tools/jldownload https://cmake.org/files/v$CMAKE_VERSION_MAJMIN/$FULLNAME.tar.gz
echo "$CMAKE_SHA256 $FULLNAME.tar.gz" | sha256sum -c -
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, sha256sum doesn't exist on OSX/BSD, it's accessed via shasum -a 256. See this part of jlchecksum to see what I mean.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a PR against your PR (man I really love git) to illustrate how I would use jlchecksum to do this more easily/portably.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script isn't all that valuable on mac. It's been discussed elsewhere that we should probably move to using cmake itself for checksumming in a can-rely-on-sha512-everywhere way. So I'm avoiding jlchecksum with the expectation that it may be rewritten in a way that relies on cmake, giving a bootstrapping issue here.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, didn't know that cmake can do checksumming by itself, we should definitely move toward that then

# Script to download newest version of cmake on linux (or mac)
# saves you the trouble of compiling it if you don't have root
set -e # stop on failure
cd "$(dirname "$0")"/.. # run in top-level directory
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we squirrel away both the downloaded tarball and the unpacked directory within deps/ somewhere? I'm not a fan of having it laying around in the top-level directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? This isn't being built from source like every single other dependency, it's downloading a binary.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems messy to me, but that's an aesthetic choice. This doesn't seem too conceptually different to me than downloading source and compiling the binary to use it during build time, like we do with e.g. patchelf, but this isn't a strong objection. At the very least, we should add .gitignore rules for wherever this does end up.

@staticfloat
Copy link
Sponsor Member

staticfloat commented Dec 22, 2016 via email

@tkelman tkelman merged commit 387e964 into master Dec 22, 2016
@tkelman tkelman deleted the tk/download_cmake branch December 22, 2016 08:08
@staticfloat
Copy link
Sponsor Member

staticfloat commented Dec 22, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants