# Swift on Synology DSM

**URL:** <https://forums.swift.org/t/swift-on-synology-dsm/36203>\
**Category:** Using Swift\
**Tags:** linux, arm, synology\
**Created:** [May 6, 2020, 8:51am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203 "2020-05-06T08:51:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 6, 2020, 8:51am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/1 "2020-05-06T08:51:36Z")

</div>

I wonder if anyone ever tried to port Swift on Synology's own Linux based system DSM 6.2. I own a DS218 which is a pretty good NAS capable of running custom things and I'd really like to run Swift web apps on it.

---

<div class="post-metadata">

**Author:** ![bzamayo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/bzamayo/32/764_2.png) [@bzamayo](https://forums.swift.org/u/bzamayo)\
**Post date:** [May 6, 2020, 8:58am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/2 "2020-05-06T08:58:47Z")

</div>

I haven’t actually done this but I’d prolly just go through Docker on it.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 6, 2020, 9:02am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/3 "2020-05-06T09:02:37Z")

</div>

I think docker is not supported on arm64 architecture.

---

<div class="post-metadata">

**Author:** ![bzamayo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/bzamayo/32/764_2.png) [@bzamayo](https://forums.swift.org/u/bzamayo)\
**Post date:** [May 6, 2020, 9:17am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/4 "2020-05-06T09:17:21Z")

</div>

Ah I see. I have a DS218+, and run Homebridge through it over Docker. I didn't realise the non-plus one wasn't an Intel chipset.

---

<div class="post-metadata">

**Author:** ![Lupurus](https://avatars.discourse-cdn.com/v4/letter/l/e274bd/32.png) [@Lupurus](https://forums.swift.org/u/Lupurus)\
**Post date:** [May 6, 2020, 9:20am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/5 "2020-05-06T09:20:34Z")

</div>

Docker only runs on DS218+ ([Docker - Add-on Packages | Synology Inc.](https://www.synology.com/en-us/dsm/packages/Docker)). I was stupid enough to buy a DS218j (it even has just a 32bit processor), but I will buy a DS218+ as well. Is Swift running there in Docker?

---

<div class="post-metadata">

**Author:** ![dlbuckley](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/dlbuckley/32/14986_2.png) [@dlbuckley](https://forums.swift.org/u/dlbuckley)\
**Post date:** [May 6, 2020, 9:42am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/6 "2020-05-06T09:42:37Z")

</div>

Swift works pretty well in docker on my DS718+ by the looks of things 👍🏻 (Ignoring the no so great synology UI terminal experience anyway)

 ![Screenshot 2020-05-06 at 10.39.18](https://global.discourse-cdn.com/swift/original/2X/1/1f5bb67518053db1eb5732111562cde21b712864.jpeg)

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 6, 2020, 9:53am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/7 "2020-05-06T09:53:42Z")

</div>

No other option remained for the rest but porting Swift to DSM. It is possible but a long way to go as the Linux underhood is a stripped down Debian.

---

<div class="post-metadata">

**Author:** ![wlisac](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wlisac/32/1209_2.png) [@wlisac](https://forums.swift.org/u/wlisac)\
**Post date:** [May 6, 2020, 8:04pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/8 "2020-05-06T20:04:09Z")

</div>

It looks like the DS218 is ARM-based – it might work with the Swift on ARM docker images I maintain. I've never tested with a Synology, but I'd love to know how it goes if you try it out 🙂

> **[GitHub - wlisac/swift-on-balena: Docker images for Swift on Raspberry Pi and...](https://github.com/wlisac/swift-on-balena)**
>
> Docker images for Swift on Raspberry Pi and other ARM devices from balena's base images. - GitHub - wlisac/swift-on-balena: Docker images for Swift on Raspberry Pi and other ARM devices from ba...

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 7, 2020, 7:35am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/9 "2020-05-07T07:35:03Z")

</div>

I downloaded ARMv7 version for Debian Stretch from [uraimo-s github page](https://github.com/uraimo/buildSwiftOnARM#prebuilt-binaries) but I got error upon executing swift binary

```
bash-4.3# ./usr/bin/swift --help
bash: ./usr/bin/swift: No such file or directory

```

Next time I will check it out with other binaries.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 7, 2020, 7:45am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/10 "2020-05-07T07:45:42Z")

</div>

Almost all other variants failed with the same error :/ I see no easy way for getting Swift onto DSM.

---

<div class="post-metadata">

**Author:** ![ahti](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ahti/32/604_2.png) [@ahti](https://forums.swift.org/u/ahti)\
**Post date:** [May 7, 2020, 9:12am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/11 "2020-05-07T09:12:01Z")

</div>

Well, I suspect you did not get this error upon executing the swift binary. Instead you never executed the swift binary, and that is what the error is conveying.

Check again where you extracted the toolchain to, and make sure to use an appropriate relative/absolute path to the binary or add the bin directory from the toolchain to your $PATH variable.

A swift binary that is executed but can not run on the current system will fail in a different way.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 7, 2020, 2:47pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/12 "2020-05-07T14:47:31Z")

</div>

I'm not exactly following you. I unpacked the tarbal and attempted to run swift like `cd <unpacked tar>; ./usr/bin/swift`. I also amended `PATH ` to include usr/bin, got the same result.  
Unfortunately DSM lacks tools like file to tell what's inside the binary.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 7, 2020, 3:03pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/13 "2020-05-07T15:03:13Z")

</div>

Ok, it looks like we are having architecture mismatch. For instance, Debian Stretch tarball contains 32 bit binaries

```
file usr/bin/swift

usr/bin/swift: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=d3e3bd54bf65b11cef75011e5f67ac85f54e3cc8, not stripped

```

but the OS I want to run Swift on is actually a 64 bit architecture. It explains a lot.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 7, 2020, 3:13pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/14 "2020-05-07T15:13:20Z")

</div>

Getting closer! I downloaded [swift-5.1.3-aarch64-RELEASE-Ubuntu-18.04\_2019-12-20.tar.gz](https://github.com/futurejones/swift-arm64/releases/download/v5.1.3-RELEASE/swift-5.1.3-aarch64-RELEASE-Ubuntu-18.04_2019-12-20.tar.gz), then attempted to run swift

```
**segabor@Szokasos** : **~/swift** $ ./usr/bin/swift

./usr/bin/swift: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory

```

So this library keeps me away from running swift (at least I hope so).

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [May 7, 2020, 4:08pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/15 "2020-05-07T16:08:01Z")

</div>

I believe that dependency was removed in recent versions of Swift 5.2 for Linux, so you should try those versions.

---

<div class="post-metadata">

**Author:** ![wlisac](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wlisac/32/1209_2.png) [@wlisac](https://forums.swift.org/u/wlisac)\
**Post date:** [May 7, 2020, 4:36pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/16 "2020-05-07T16:36:26Z")

</div>

If you have docker installed – give this a try.

```swift
docker run -it --rm wlisac/aarch64-swift:5.1-build swift --version

```

You should see something like this:

```swift
Swift version 5.1 (swift-5.1-RELEASE)
Target: aarch64-unknown-linux-gnu

```

---

<div class="post-metadata">

**Author:** ![ahti](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ahti/32/604_2.png) [@ahti](https://forums.swift.org/u/ahti)\
**Post date:** [May 8, 2020, 6:20am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/17 "2020-05-08T06:20:07Z")

</div>

Ah, my bad, I didn't know you'd also get that error message for architecture mismatches. It seems like this is caused by a limitation in the Linux syscall used to run files (see [here](https://unix.stackexchange.com/questions/13391/getting-not-found-message-when-running-a-32-bit-binary-on-a-64-bit-system/13409#13409) for some more information).

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 8, 2020, 8:38am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/18 "2020-05-08T08:38:04Z")

</div>

I'm afraid Docker is supported on ARM based DSMs.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [May 8, 2020, 8:39am UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/19 "2020-05-08T08:39:48Z")

</div>

We are only one [issue](https://github.com/uraimo/buildSwiftOnARM/issues/66) away from getting 5.2 builds. Can't wait to grab it.

---

<div class="post-metadata">

**Author:** ![Gabor\_Sebestyen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gabor_sebestyen/32/326_2.png) [@Gabor\_Sebestyen](https://forums.swift.org/u/Gabor_Sebestyen)\
**Post date:** [September 22, 2021, 6:01pm UTC](https://forums.swift.org/t/swift-on-synology-dsm/36203/20 "2021-09-22T18:01:56Z")

</div>

I know this is an old topic but probably there are Swift fans wanting to run their code on an ARM based Synology NAS.

I was able to install Docker on DSM 7 (arm64) by following this [https://cynarski.eu/docker-on-synlogy-32bit/](https://guide) and run Swift REPL in 5.4 container. So far so good.  
Building projects is another challenge, the container is unable to resolve [github.com](http://github.com) domain name in order to retrieve dependencies. This is an issue on Docker side (no default networking is set).

[Next page](https://forums.swift.org/t/swift-on-synology-dsm/36203.md?page=2)
