# Generating Artifact.toml hashes

**URL:** https://discourse.julialang.org/t/generating-artifact-toml-hashes/39685
**Category:** General Usage
**Created:** [May 18, 2020, 9:18am UTC](https://discourse.julialang.org/t/generating-artifact-toml-hashes/39685 "2020-05-18T09:18:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![torrance](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torrance/32/38990_2.png) [@torrance](https://discourse.julialang.org/u/torrance)
#### Post date: [May 18, 2020, 9:18am UTC](https://discourse.julialang.org/t/generating-artifact-toml-hashes/39685/1 "2020-05-18T09:18:10Z")

</div>

Hi there,

I’m in the process of making my package relocatable, and the first steps for that are to create my shared libraries (actually, just library wrappers of C++ libraries) as artifacts. However, I’m finding the documentation to be quite light here! (ie. [8. Artifacts · Pkg.jl](https://julialang.github.io/Pkg.jl/dev/artifacts/))

I need to annotate the Artifacts.toml file with a ‘git-tree-sha1’ hash, as well as a SHA256 hash for the downloaded file itself.

So what I’ve done:

1. compiled the library
2. gzipped it (not documented, but appears that gz or some other compression is required)
3. uploaded online
4. used SHA256sum to calculate the hash of the gz file
5. used git hash-object to calculate the hash of the un-gzipped file
6. And entered these into the Artifacts.toml file

The SHA256 is correct, and the file is downloaded and un-gzipped. However the git-tree-sha1 hash fails - which is what I expected because I have no idea what a git-tree-sha1 is, and the phrase only appears online in relation to the Julia Pkg system itself!

So what is this second hash, and how do I generate it? And am I doing this correctly - or is there an automagic way I should be artifacting these libraries?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [May 18, 2020, 9:42am UTC](https://discourse.julialang.org/t/generating-artifact-toml-hashes/39685/2 "2020-05-18T09:42:41Z")

</div>

You can compute the git tree hash with `Pkg.GitTools.tree_hash`. You can see [artifacts documentation](https://julialang.github.io/Pkg.jl/v1/artifacts/#Using-Artifacts-1) about how to automatically generate an `Artifacts.toml` file.

Since you want to distribute a shared library, have you considered using [`BinaryBuilder.jl`](https://github.com/JuliaPackaging/BinaryBuilder.jl) instead? If you need some inspiration, there are hundreds of recipes already available in [`Yggdrasil`](https://github.com/JuliaPackaging/Yggdrasil/)

---

<div class="post-metadata">

### Author: ![torrance](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torrance/32/38990_2.png) [@torrance](https://discourse.julialang.org/u/torrance)
#### Post date: [May 21, 2020, 8:26am UTC](https://discourse.julialang.org/t/generating-artifact-toml-hashes/39685/3 "2020-05-21T08:26:52Z")

</div>

Thank you, I didn’t realise that the documentation there was to _build_ the artifacts file (I thought it was to use it).

I would say that it should be clearer that artifacts _must_ be tar archives.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [May 21, 2020, 9:06am UTC](https://discourse.julialang.org/t/generating-artifact-toml-hashes/39685/4 "2020-05-21T09:06:10Z")

</div>

> [@torrance](#):
>
> I would say that it should be clearer that artifacts _must_ be tar archives

You can open a pull request to clarify this point and avoid confusion to the next user 😉
