# Kakoune.cr

**URL:** <https://discuss.kakoune.com/t/kakoune-cr/1605>\
**Category:** Terminal Tools\
**Created:** [February 24, 2021, 10:10am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605 "2021-02-24T10:10:24Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 9, 2021, 1:14pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/21 "2021-03-09T13:14:33Z")

</div>

Just added the support for static builds.

You don’t need [Crystal](https://crystal-lang.org) but [Docker](https://docker.com) for building.

### Installation

Run `make install static=yes` or `make release` for static builds.

The latter generates a `target/release.zip` that you can ship everywhere.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 9, 2021, 1:17pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/22 "2021-03-09T13:17:44Z")

</div>

> People are complaining about it’s being written in Crystal, but I don’t see it as a problem (specially if you can provide binaries in its releases).

I added it too. =D

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [March 9, 2021, 3:08pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/23 "2021-03-09T15:08:53Z")

</div>

@alexherbo2 you should add static builds for the major platforms to the github project (a lot of Go & Rust projects do this) … not sure if there is an upcharge or if it is free on github, but I am sure some of us would donate a bit to get those binaries up.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 9, 2021, 3:39pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/24 "2021-03-09T15:39:49Z")

</div>

I don’t know how to do. I have read @TeddyDD’s gist but I don’t understand all the lines.

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [March 9, 2021, 7:28pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/25 "2021-03-09T19:28:29Z")

</div>

It is a github action responding to push or pull\_request (merge) to master. It fires up a docker – builds kcr and then adds to to the github releases page (I think).

If Crystal can cross-compile for Mac from a linux docker, doing a similar thing for Mac would be straightforward. I wonder if Crystal could output both arm and intel builds for the Mac?

---

<div class="post-metadata">

**Author:** ![vbauerster](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/v/85e7bf/32.png) [@vbauerster](https://discuss.kakoune.com/u/vbauerster)\
**Post date:** [March 10, 2021, 6:19am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/26 "2021-03-10T06:19:41Z")

</div>

I was able to cross-compile on Mac for Linux arm64 using [this](https://hugopl.github.io/2019/04/28/Crystal-on-raspberry-pi.html) guide. Command I used:

```auto
crystal build --cross-compile --target "aarch64-unknown-linux-gnu" --release -o kcr src/cli.cr

```

llvm target for Mac x86\_64 would be:

```auto
❯ /usr/local/opt/llvm/bin/llvm-config --host-target
x86_64-apple-darwin20.3.0

```

so to cross-compile on Linux for Mac there is need to replace target with `x86_64-apple-darwin20.3.0` or I suppose just `x86_64-apple-darwin` will suffice.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [March 10, 2021, 7:34am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/27 "2021-03-10T07:34:26Z")

</div>

Cross-compiling can be difficult, because it’s not just about emitting a binary for the target platform, it also involves linking with libraries for the target platform.

I haven’t tried it with Crystal, but in my experience:

- anything can cross-compile for Linux, because Linux has a stable syscall interface which means the compiler can just hard-code things
- it’s possible to cross-compile for Windows as long as you’re using the MinGW toolchain, since it includes definitions of Windows APIs and freely-distributable libraries to link against
- only Windows can build Windows binaries using the Visual C++ toolchain, since Microsoft only permits them to be installed on Windows
- only macOS can build macOS binaries, since Apple only allows the compiler and toolchain to be installed on Apple hardware

GitHub Actions does provide macOS build agents, so you can build macOS binaries automatically. However, [GitHub does not (yet) have macOS build agents running the latest OS version with the latest build tools](https://github.com/actions/virtual-environments/issues/2486), so building ARM binaries is not possible.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 11, 2021, 2:19pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/28 "2021-03-11T14:19:50Z")

</div>

Just added a release with static builds for Linux.

> **[Releases · alexherbo2/kakoune.cr](https://github.com/alexherbo2/kakoune.cr/releases)**
>
> .cr/releases

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [March 11, 2021, 3:58pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/29 "2021-03-11T15:58:01Z")

</div>

@alexherbo2 amazing! Next up Mac? 🙂

This actually reduces my stress about using this as a drop in replacement for connect.kak a great deal (I might swap to it once Mac builds are up).

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 11, 2021, 4:07pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/30 "2021-03-11T16:07:45Z")

</div>

Next is macOS, but I haven’t a strong experience with GitHub Actions yet.

---

<div class="post-metadata">

**Author:** ![andreyorst](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/andreyorst/32/29_2.png) [@andreyorst](https://discuss.kakoune.com/u/andreyorst)\
**Post date:** [March 11, 2021, 8:04pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/31 "2021-03-11T20:04:58Z")

</div>

> [@alexherbo2](#):
>
> Just added a release with static builds for Linux.

Great! While you’re still on this, usually archives are named against the target you’ve built the executable for. So in this case I guess it would be someting like `kakoune_cr-x86_64-unknown-linux-musl.tar.gz`. This way it helps to distinguish platforms, when there are several builds

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [March 12, 2021, 3:10am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/32 "2021-03-12T03:10:11Z")

</div>

Honestly – static builds in Crystal, Rust, Go with Github actions really open up the field for lots of interesting stuff like this… and honestly the first language with a great “Kakoune Support” library that makes it super easy to interact with kak, that can also do static builds could become a defacto winner.

---

<div class="post-metadata">

**Author:** ![basbebe](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/b/8edcca/32.png) [@basbebe](https://discuss.kakoune.com/u/basbebe)\
**Post date:** [March 14, 2021, 7:11am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/33 "2021-03-14T07:11:42Z")

</div>

Anyone familiar enough with homebrew (macOS package manager) to add kakoune.cr there?

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [March 15, 2021, 12:50am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/34 "2021-03-15T00:50:26Z")

</div>

@basbebe as someone who newly converted from linux to mac for my daily driver (M1 chip reasons). I have been wanting this (specifically the build from source with native M1 support) so I might jump on it. Kakoune stable builds are already in it.

That said, I have zero experience with it.

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 16, 2021, 10:55am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/35 "2021-03-16T10:55:04Z")

</div>

macOS is now supported! 🥳

> <https://github.com/alexherbo2/kakoune.cr/commit/bafabddbe6ba4821c096044309502eeac00fbdd2>

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 16, 2021, 11:03am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/36 "2021-03-16T11:03:45Z")

</div>

I took your recommendation to name according to the [target triple](https://llvm.org/docs/LangRef.html#target-triple) thanks!

They are now named [`kakoune.cr-nightly-x86_64-unknown-linux-musl.zip`](https://github.com/alexherbo2/kakoune.cr/releases/download/nightly/kakoune.cr-nightly-x86_64-unknown-linux-musl.zip) and [`kakoune.cr-nightly-x86_64-apple-darwin.zip`](https://github.com/alexherbo2/kakoune.cr/releases/download/nightly/kakoune.cr-nightly-x86_64-apple-darwin.zip).

---

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [March 16, 2021, 2:46pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/37 "2021-03-16T14:46:22Z")

</div>

@alexherbo2 very cool, and acts as a guide for anyone else building Kakoune plugins in Crystal – are you paying any additional for these builds?

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 16, 2021, 9:28pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/38 "2021-03-16T21:28:23Z")

</div>

@robertmeta No, GitHub offers it for free.

If you want to get started with the GitHub Actions, I suggest you to follow the “Get started with Actions” from their [homepage](https://github.com/features/actions) and read the “Quickstart”.

After reading it, take one of your projects and start to experiment by creating a private fork, so you will not pollute your main repo.

There are plenty of contributed [GitHub Actions on the Marketplace](https://github.com/marketplace/actions), but I wanted to stick with the minimum and use the CLI tools I knew as if I were to build locally.

In the [Quickstart](https://docs.github.com/en/actions/quickstart), you can quickly get what is done and start tweaking your own [`.github/workflows/release.yml`](https://github.com/alexherbo2/kakoune.cr/blob/master/.github/workflows/release.yml).

Each job has a name, a machine to run on and steps to fulfill its purpose.

For creating the releases, I needed:

- [`gh release create [tag]`](https://cli.github.com/manual/gh_release_create) to create the release on a setup machine. In this job, I update the `nightly` tag to the latest commit and delete the previous release.
- [`gh release upload [tag] [files]`](https://cli.github.com/manual/gh_release_upload) on each machine (Linux, macOS) to push the builds into the release.

The actions (jobs) run in parallel, so you need `needs: release` to ensure the first job named `release` has finished before starting the Linux and macOS machines.

> <https://github.com/alexherbo2/kakoune.cr/blob/master/.github/workflows/release.yml>

---

<div class="post-metadata">

**Author:** ![abstractlyZach](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/abstractlyzach/32/738_2.png) [@abstractlyZach](https://discuss.kakoune.com/u/abstractlyZach)\
**Post date:** [March 28, 2021, 2:31am UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/39 "2021-03-28T02:31:29Z")

</div>

Should we deprecate [connect.kak](https://github.com/kakounedotcom/connect.kak) and [prelude.kak](https://github.com/kakounedotcom/prelude.kak)? Or maybe include links from their READMEs to kakoune.cr as their successors? I was very confused when [Autopairs](https://github.com/alexherbo2/auto-pairs.kak) stopped working for me and I had to go to its README to learn that it depends on kakoune.cr now. I think doing some of these things would prevent others from also being confused

---

<div class="post-metadata">

**Author:** ![alexherbo2](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/alexherbo2/32/1140_2.png) [@alexherbo2](https://discuss.kakoune.com/u/alexherbo2)\
**Post date:** [March 28, 2021, 12:50pm UTC](https://discuss.kakoune.com/t/kakoune-cr/1605/40 "2021-03-28T12:50:29Z")

</div>

connect.kak and the prelude were marked as archived, but @robertmeta revived them.

Sadly the README got updated and the links were removed by inadvertance.

[Previous page](https://discuss.kakoune.com/t/kakoune-cr/1605.md?page=1)

[Next page](https://discuss.kakoune.com/t/kakoune-cr/1605.md?page=3)
