<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>emre şahin's digital garden 🍃 - cross-compilation</title>
    <link>https://emresahin.net/tags/cross-compilation/</link>
    <description>Posts in the cross-compilation tag</description>
    <language>en</language>
    <managingEditor>contact@emresahin.net (Emre Şahin)</managingEditor>
    <lastBuildDate>Tue, 29 Sep 2026 14:57:43 +0000</lastBuildDate>
    <atom:link href="https://emresahin.net/tags/cross-compilation/rss.xml" rel="self" type="application/rss+xml"/>
    <item>
      <title>devlog 9</title>
      <published>2025-01-04T13:03:16+00:00</published>
      <updated>2025-01-04T13:03:16+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Sat, 04 Jan 2025 13:03:16 +0000</pubDate>
      <link>https://emresahin.net/devlog-9/</link>
      <guid isPermaLink="true">https://emresahin.net/devlog-9/</guid>
      <description>🐢 Today I’m planning to add cross-compilation to the Xvc 0.6.13 branch to provide more platform support. 🐇 It looks like you first need to turn off this ghost text from the blink output. It makes writing insufferable. 🐢 Yep, let’s do that first. 🐇 Now, let’s restart Neovim. 🐢 I don’t know why bli...</description>
      <category>devlog</category>
      <category>Software Development</category>
      <category>blink-cmp</category>
      <category>github-cli</category>
      <category>github-actions</category>
      <category>xvc</category>
      <category>reflinks</category>
      <category>cross-compilation</category>
      <category>rust</category>
      <category>ci-cd</category>
      <content:encoded><![CDATA[<p>🐢 Today I’m planning to add cross-compilation to the Xvc 0.6.13 branch to provide more platform support.</p>
<p>🐇 It looks like you first need to turn off this ghost text from the <code>blink</code> output. It makes writing insufferable.</p>
<p>🐢 Yep, let’s do that first.</p>
<p>🐇 Now, let’s restart Neovim.</p>
<p>🐢 I don’t know why <code>blink.cmp</code> doesn’t prioritize the emojis I use. Maybe we can just use <code>#tor</code> and <code>#rab</code> for ourselves.</p>
<p>🐇 I think over time it will learn that the emojis I defined in the snippets file should have higher priority, but let’s skip this for now. What do we need to do to add cross-compilation?</p>
<p>🐢 Maybe we can just make the completion menu wait a bit longer. It shows up almost instantly, and I want it to wait for a few more milliseconds.</p>
<p>🐇 Okay, let’s look at the config.</p>
<p>🐢 The configuration file doesn’t seem to have a key for this. Let’s search: <code>blink.cmp</code>.</p>
<p>🐇 I think the culprit is typo resistance; it causes better options to be pushed down: <a href="https://cmp.saghen.dev/configuration/reference#fuzzy">https://cmp.saghen.dev/configuration/reference#fuzzy</a></p>
<p>🐢 Let’s turn that off.</p>
<p>🐇 There is an error in the configuration file. I don’t know why it’s failing.</p>
<p>🐢 I added emojis to Espanso and checked the error message. The configuration I copied from their docs seems to be broken. The message is:</p>
<pre><code class="language-text">...share/nvim/lazy/blink.cmp/lua/blink/cmp/config/utils.lua:14: fuzzy.max_items: unexpected field found in configuration
</code></pre>
<p>I’ll just delete that line.</p>
<p>🐇 It still doesn’t prioritize snippets, but we can look into this later. Espanso seems to be a better tool for this anyway.</p>
<p>🐢 Yep. Let’s look into cross-compilation support for Rust.</p>
<p>🐇 The well-known option is <code>cross.rs</code>: <a href="https://github.com/cross-rs/cross">https://github.com/cross-rs/cross</a></p>
<p>🐢 We can start with that. Installation is from the Git repository:</p>
<pre><code class="language-bash">$ cargo install cross --git https://github.com/cross-rs/cross
    Updating git repository `https://github.com/cross-rs/cross`
    Updating git submodule `https://github.com/cross-rs/cross-toolchains.git`
  Installing cross v0.2.5 (https://github.com/cross-rs/cross#4090beca)
...
   Installed package `cross v0.2.5 (https://github.com/cross-rs/cross#4090beca)` (executables `cross`, `cross-util`)
</code></pre>
<p>🐇 Now we have the <code>cross</code> and <code>cross-util</code> commands. Cross-compilation requires Podman on Linux or Docker on macOS. Do we have Docker?</p>
<p>🐢 It looks like we don’t. Maybe we can just set up a remote build using Podman or GitHub Actions. I saw a crate for that yesterday; I remember saving it somewhere but can’t find it now. Searching again seems easier, which says something about my archival and retrieval habits.</p>
<p>🐇 Maybe later you can add some vector search capabilities to your archive—semantic search.</p>
<p>🐢 Yep, <em>sometime</em> later.</p>
<p>🐇 Now let’s search for “adding rust cross compilation to github actions.”</p>
<p>🐢 I found a link to the action: <a href="https://github.com/marketplace/actions/build-rust-projects-with-cross">https://github.com/marketplace/actions/build-rust-projects-with-cross</a></p>
<p>Let’s look at the example:</p>
<pre><code class="language-yaml">jobs:
  release:
    name: Release - ${{ matrix.platform.os-name }}
    strategy:
      matrix:
        platform:
          - os-name: FreeBSD-x86_64
            runs-on: ubuntu-20.04
            target: x86_64-unknown-freebsd
            skip_tests: true

          - os-name: Linux-x86_64
            runs-on: ubuntu-20.04
            target: x86_64-unknown-linux-musl

          - os-name: Linux-aarch64
            runs-on: ubuntu-20.04
            target: aarch64-unknown-linux-musl

          - os-name: Linux-riscv64
            runs-on: ubuntu-20.04
            target: riscv64gc-unknown-linux-gnu

          - os-name: Windows-x86_64
            runs-on: windows-latest
            target: x86_64-pc-windows-msvc

          - os-name: macOS-x86_64
            runs-on: macOS-latest
            target: x86_64-apple-darwin

          # more targets here ...

    runs-on: ${{ matrix.platform.runs-on }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build binary
        uses: houseabsolute/actions-rust-cross@v0
        with:
           command: ${{ matrix.platform.command }}
          target: ${{ matrix.platform.target }}
          args: "--locked --release"
          strip: true
      - name: Publish artifacts and release
        uses: houseabsolute/actions-rust-release@v0
        with:
          executable-name: ubi
          target: ${{ matrix.platform.target }}
</code></pre>
<p>🐇 We can just convert the current configuration to this and see if it works.</p>
<p>🐢 Let’s do that. I created <code>.github/workflows/release.yml</code> and will update it.</p>
<p>🐇 Let’s check the results with <code>gh</code>:</p>
<pre><code class="language-bash">$ gh -R iesahin/xvc run list
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525070531	34s	2024-12-28T08:17:28Z
</code></pre>
<p>🐢 It says the release has completed.</p>
<pre><code class="language-bash">$ gh -R iesahin/xvc run view 12525070531

X v0.6.13 Release iesahin/xvc#263 · 12525070531
Triggered via pull_request about 3 minutes ago

JOBS
X Release - FreeBSD-x86_64 in 12s (ID 34936257653)
  ✓ Set up job
  ✓ Checkout
  X Build binary
  - Publish artifacts and release
  ✓ Post Build binary
  ✓ Post Checkout
  ✓ Complete job
...
</code></pre>
<p>Now let’s look at the failure:</p>
<pre><code class="language-bash">$ gh -R iesahin/xvc run view 12525070531 --log-failed
</code></pre>
<p>🐇 Change the order and see what happens. Maybe we should first succeed in a non-cross-compilation build.</p>
<pre><code class="language-bash">$ gh -R iesahin/xvc run list
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525178664	35s	2024-12-28T08:34:18Z
...
$ gh -R iesahin/xvc run view   12525178664 --log-failed
...
</code></pre>
<p>🐢 It’s the same error. The <a href="https://github.com/houseabsolute/ubi/blob/master/.github/workflows/ci.yml">usage example</a> is actually much more sophisticated.</p>
<p>🐇 The issue is that we’re asking for <code>command</code> from the matrix, but the matrix doesn’t define it. That’s the second time today an example from the documentation has failed. I’ve added <code>command</code> for each platform. We can also add separate features this way to make platform-specific functionality work.</p>
<p>🐢 Agreed. Let’s look at it once more.</p>
<pre><code class="language-bash">$ gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525253982	41s	2024-12-28T08:46:23Z

$ gh -R iesahin/xvc run view 12525253982 --log-failed
...
Release - macOS-x86_64	Build binary	2024-12-28T08:46:44.8464010Z  [1m [31merror [0m [1m: [0m the lock file /Users/runner/work/xvc/xvc/Cargo.lock needs to be updated but --locked was passed to prevent this
</code></pre>
<p>🐇 Ah, that’s a different error. Let’s remove the <code>--locked</code> flag and retry.</p>
<pre><code class="language-bash">$ gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525289176	1m8s	2024-12-28T08:53:23Z
</code></pre>
<p>🐢 We’re finally starting to get some good news. Now we’re getting OpenSSL errors. We need feature flags for these platforms or to specify where OpenSSL is. Let’s add <code>bundled-openssl</code> to the failed ones. We also need <code>bundled-sqlite</code> for Windows binaries.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525354179	3m9s	2024-12-28T09:04:55Z
</code></pre>
<p>🐇 It looks like the <code>Changes.md</code> file is missing, and it can’t upload the binaries as a release because of this. I’ll set the changes file to <code>CHANGELOG.md</code>.</p>
<p>🐢 It’s weird to fail because of that. I think we should report these errors and possibly send a PR to make that file optional.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list | rg Release | head -n 1
in_progress		v0.6.13	Release	v0.6.13	pull_request	12525449368	1m38s	2024-12-28T09:18:40Z
...
✓ Release - macOS-x86_64 in 2m39s (ID 34937017695)
✓ Release - macOS-aarch64 in 2m42s (ID 34937017787)
..
ARTIFACTS
xvc-macOS-x86_64.tar.gz
xvc-macOS-arm64.tar.gz
</code></pre>
<p>🐢 It looks like <code>Linux-riscv64</code> has OpenSSL compilation errors. I think we can skip this platform for now. The goal was to add <code>aarch64</code> for macOS, and that seems to have succeeded.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525504079	3m24s	2024-12-28T09:26:43Z
...
X Release - Linux-x86_64	Build binary	2024-12-28T09:29:16.2262518Z  [0m [1m [38;5;9merror[E0308] [0m [0m [1m: mismatched types [0m
...
</code></pre>
<p>🐢 It looks like <code>Linux-x86_64</code> doesn’t support reflinks. Maybe we can make reflinks an optional feature and add it specifically to macOS and Windows targets.</p>
<p>🐇 I’ve removed <code>reflink</code> from the default features. This is a breaking change, but <em>fortunately</em> we don’t have many users who will be affected by it.</p>
<p>Let’s check the results once more.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525597866	3m39s	2024-12-28T09:42:44Z
</code></pre>
<p>🐢 Now turn off the <code>NetBSD</code> target as well.</p>
<p>🐇 <code>FreeBSD</code> and <code>Linux-x86_64</code> targets are building. Let’s see why the ARM Linux targets are failing.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525643284	4m46s	2024-12-28T09:52:04Z
</code></pre>
<p>🐇 It looks like those targets don’t have <code>libsqlite3</code> installed. Let’s add <code>bundled-sqlite</code> to these targets too.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list | rg Release | head -n 1
completed	failure	v0.6.13	Release	v0.6.13	pull_request	12525734325	4m11s	2024-12-28T10:07:36Z
</code></pre>
<p>🐢 Adding Android as a target didn’t work. Let’s remove it for now; it seems to require more work.</p>
<p>🐇 I think we’ll eventually move to using Xvc to distribute binaries. We could build the Android binary on Termux and link it on the releases page or push it as a release artifact.</p>
<p>🐢 I need to learn more about GitHub releases. If we can add artifacts to the release, maybe we can do some of this work locally.</p>
<p>🐇 We can start by looking at the capabilities of <code>gh</code> commands.</p>
<p>🐢 It looks like it’s possible to upload assets to releases. Let’s check how that works.</p>
<pre><code class="language-bash">gh release upload --help
</code></pre>
<p>🐇 So basically, we can just upload files to tags. We can list releases and work with them like anything else.</p>
<pre><code class="language-bash">gh -R iesahin/xvc release list
</code></pre>
<p>And we can delete releases:</p>
<pre><code class="language-bash">for r in v0.4.2-alpha.8 v0.4.2-alpha.7 v0.4.2-alpha.6 v0.4.2-alpha.5 v0.4.2-alpha.0 v0.4.1-alpha.0; do
  gh -R iesahin/xvc release delete "${r}"
done
</code></pre>
<p>🐢 Now let’s list them again.</p>
<pre><code class="language-bash">gh -R iesahin/xvc release list
</code></pre>
<p>🐇 The latest one has failed again.</p>
<pre><code class="language-bash">X Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
</code></pre>
<p>🐢 It looks like we’re coming to the end of this session. Under what conditions will we create a release?</p>
<p>🐇 I think it’s better to release only non-alpha tags.</p>
<p>🐢 Then the rule in the workflow will be something like:</p>
<pre><code class="language-yaml">on:
  workflow_dispatch:
  push:
    tags:
      - "v*.*.*"
      - "!v.*.*-alpha.*"
</code></pre>
<p>🐇 And now we have this result:</p>
<pre><code class="language-bash">✓ v0.6.13 Release iesahin/xvc#263 · 12533498361
Triggered via pull_request about 21 minutes ago

JOBS
✓ Release - FreeBSD-x86_64 in 4m14s
✓ Release - Linux-x86_64 in 4m3s
✓ Release - Linux-aarch64 in 4m50s
✓ Release - Windows-x86_64 in 8m47s
✓ Release - Windows-aarch64 in 6m42s
✓ Release - macOS-x86_64 in 2m37s
✓ Release - macOS-aarch64 in 2m36s
</code></pre>
<p>🐢 Nice! Let’s check the release list.</p>
<pre><code class="language-bash">gh -R iesahin/xvc release list
</code></pre>
<p>🐇 Why is there no “latest” release?</p>
<p>🐢 We have to tag it first.</p>
<p>🐇 Ah, right. Let’s tag it then.</p>
<p>🐢 I’ve pushed the changes and tagged them with <code>v0.6.13-alpha.5</code>.</p>
<p>🐇 I think it’s possible to make a release today.</p>
<p>🐢 It looks like it, yes.</p>
<p>🐇 We can merge the PR and tag it. Then everything should work.</p>
<p>🐢 We need some cleanup in the YAML files, though.</p>
<p>🐇 We can leave that for the next release.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list
in_progress		v0.6.13	Rust-CI	v0.6.13	pull_request	12533690474	9m18s	2024-12-29T08:02:29Z
completed	success	Release	Release	v0.6.13-alpha.5	push	12533689099	9m11s	2024-12-29T08:02:19Z
</code></pre>
<p>🐢 Now we have another failure in the regular CI. Let’s look at it.</p>
<p>🐇 The issue seems to be in the doc tests:</p>
<pre><code class="language-diff">- Total #: 8 Workspace Size:         276 Cached Size:          19
+ Total #: 8 Workspace Size:         278 Cached Size:          19
</code></pre>
<p>🐢 These tests are brittle, but they provide valuable information. Let’s fix it and push again.</p>
<p>🐇 Done. We can also remove some of the watches that produce so many logs.</p>
<p>🐢 I’m a bit ambivalent about them. I thought we could use these watches when debugging, but experience has shown that we need more granular watches during debugging and almost never use these otherwise. Let’s remove some of them.</p>
<p>🐇 We can increase the output for certain commands, but the tracing output doesn’t help much in regular runs. If Xvc gets popular enough that we can’t cope with bug reports, we can always add more watches.</p>
<p>🐢 Another option is to exclude the watch code from the release build, but that won’t change anything for our debug cycles.</p>
<p>🐇 I think removing them is a fair trial. We can always put them back when debugging.</p>
<p>🐢 Watches could also produce regular output instead of tracing. That way we won’t forget to remove them.</p>
<p>🐇 Ah, yep, that’s a good option too.</p>
<p>🐢 We can have a <code>trace!</code> macro similar to the current one for user consumption, and a <code>watch!</code> macro that sends output to <code>stderr</code>.</p>
<p>🐇 Good idea. Let’s do that in the next release.</p>
<p>🐢 Let’s check the tests before pushing this cleanup.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list
completed	success	v0.6.13	Rust-CI	v0.6.13	pull_request	12533993607	13m49s	2024-12-29T08:47:50Z
</code></pre>
<p>🐇 CI succeeded, and the release didn’t run. Let’s do some more cleanup.</p>
<pre><code class="language-bash">gh -R iesahin/xvc run list
in_progress		v0.6.13	Rust-CI	v0.6.13	pull_request	12534416152	43s	2024-12-29T09:57:02Z
</code></pre>]]></content:encoded>
    </item>
    <item>
      <title>Xvc Devlog 221031</title>
      <published>2022-11-05T09:18:00+00:00</published>
      <updated>2022-11-05T09:18:00+00:00</updated>
      <author>Emre Şahin</author>
      <pubDate>Sat, 05 Nov 2022 09:18:00 +0000</pubDate>
      <link>https://emresahin.net/xvc-devlog-221031/</link>
      <guid isPermaLink="true">https://emresahin.net/xvc-devlog-221031/</guid>
      <description>🐇 It’s the last day of October. How are you doing, mister? 🐢 Yep. It was a nice October. I would like to finish by increasing the coverage. 🐇 How about setting up a runner on your machine to test them locally? 🐢 Not now. I should fix the tests as always. Later I can take a look at it. I don’t wan...</description>
      <category>xvc</category>
      <category>devlog</category>
      <category>ci/cd</category>
      <category>cross-compilation</category>
      <category>apple silicon</category>
      <category>testing</category>
      <category>xvc</category>
      <category>redirection</category>
      <category>shell</category>
      <content:encoded><![CDATA[<p>🐇 It’s the last day of October. How are you doing, mister?</p>
<p>🐢 Yep. It was a nice October. I would like to finish by increasing the coverage.</p>
<p>🐇 How about setting up a runner on your machine to test them locally?</p>
<p>🐢 Not now. I should fix the tests as always. Later I can take a look at it. I don’t want to distract myself with it.</p>
<p>🐇 You’ll need to create Apple Silicon binaries, though.</p>
<p>🐢 I think I can cross-compile for aarch.</p>
<p>🐇 You were doing this in the past, trying to build all binaries on a single Ubuntu VM. It didn’t work, as far as I remember.</p>
<p>🐢 I hadn’t even read <a href="https://rust-lang.github.io/rustup/cross-compilation.html">this section</a> then, and there is a <a href="https://github.com/cross-rs/cross">dedicated project</a> for it. The proper way is to use that. I’ll return to this after fixing the tests. I think we can release Xvc on all platforms supported by Rust.</p>
<p>🐇 Using <code>cross-rs</code> on GitHub Actions may be challenging. It seems <a href="https://stackoverflow.com/questions/66849112/how-do-i-cross-compile-a-rust-application-from-macos-x86-to-macos-silicon">Apple Silicon doesn’t need that much work</a> either. You can set up cross-compilation with <code>rustup</code> targets.</p>
<p>🐢 Yeah. It looks so. Let’s take a look at the <a href="https://emresahin.net/xvc-devlog-221030">previous devlog.</a></p>
<p>🐇 The page seems missing. Would you like to fix your site first?</p>
<p>🐢 Ah, yeah. I should, maybe. Now it’s time to fix those PRs. I’ll take care of the site later. I should change the theme anyway.</p>
<p>🐇 Ok. Let’s take a look at <a href="https://github.com/iesahin/xvc/pulls">outstanding PRs</a>.</p>
<p>🐢 I want to fix the failed tests locally first. Yesterday I wasn’t able to redirect the output. It looks like the correct way of doing it is <code>cargo test --all-features --no-fail-fast &gt; $TMPDIR/xvc-test.log 2&gt;&amp;1</code>. It’s required to put <code>2&gt;&amp;1</code> at the end, not between the redirection and output.</p>
<p>🐇 There is also the <code>&amp;&gt;</code> operator that you may want to use. <code>cargo test --all-features --no-fail-fast &amp;&gt; $TMPDIR/xvc-test.log</code> should be equivalent to this.</p>
<p>🐢 I’ll try it when the tests finish.</p>
<p>🐇 In the meantime, you can work to fix the documentation. In another repository, perhaps.</p>
<p>🐢 Good idea. Let me clone that.</p>
<p>🐇 Looks like the tests have finished and the only error is Minio. It couldn’t find the env variables you defined.</p>
<p>🐢 Restarted the shell and the tests. Returned to docs now.</p>
<hr>
<p>🐢 Added a few function docs. Storage tests seem to pass. Probably they will fail in GA because of <code>rsync</code> tests using <code>one.emresult.com</code> login in my name.</p>
<p>🐇 If that’s expected, you can push and begin to fix it.</p>
<p>🐢 Yeah, let’s push the tests.</p>
<hr>
<p>🐢 It looks like connecting to localhost also poses a challenge. Instead, I can create a user for <code>xvc</code> on the server and limit its usage.</p>
<p>🐇 Hmm. Good idea for now.</p>
<p>🐢 I created a new user <code>xvc-test@one.emresult.com</code> and its SSH keys. I’ll update the action to write the secret to the keyfile.</p>
<hr>
<p>🐇 Looks like you forgot to install <code>mc</code> for Minio connection.</p>
<p>🐢 Yeah, I must convert Minio tests to use <code>s3cmd</code>.</p>
<p>🐇 And your region in <code>s3</code> configuration seems to be wrong.</p>
<p>🐢 I’ll need to check this.</p>
<p>🐇 There is this line in the tests <code>let region = env::var("AWS_DEFAULT_REGION").unwrap_or("us-east-1".to_string());</code> that’s probably causing that error. You should define the region properly.</p>
<p>🐢 I set this to <code>eu-central-1</code> directly and will check the Minio error in the next session.</p>
<p>🐇 👏</p>
<hr>
<p>🐢 It’s working except for the rsync tests now.</p>
<p>🐇 I think you can just use localhost to run the tests. You may need to install openssh-server, but it should work with localhost without configuration.</p>
<p>🐢 There may be a step missing in the configuration. I’ll try to make it run.</p>
<hr>
<p>🐢 I’m trying to use <code>.ssh/config</code> in GA to allow connections to the server. It doesn’t work for some reason.</p>
<p>🐇 You may try to log in to the server outside of the tests and check if it’s running.</p>
<hr>
<p>🐢 Yesterday’s last attempt was successful, and now we have working remote storage tests.</p>
<p>🐇 👏👏👏🥳</p>
<p>🐢 I’m merging the PR.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
