anacrolix / dms

A UPnP DLNA Digital Media Server that includes basic video transcoding. Tested on a Panasonic Viera television, several Android UPnP apps, and Chromecast.
BSD 3-Clause "New" or "Revised" License
615 stars 93 forks source link

dms binary can't be executed in NixOS. #118

Closed 2brownc closed 1 year ago

2brownc commented 1 year ago

I am trying to get dms running in NixOS (unstable) but to no avail.

I have downloaded the release "dms_1.5.0_linux_amd64.tar.gz" and tried to start the executble dms as such:

$ ./dms -friendlyName DMS_Server -path '/mnt/ORION/DLNA/'
bash: ./dms: cannot execute: required file not found

Yes, I made it "executable" with chmod +x dms.

What is this required file?! Do I need to install extra packages?

$ file dms
dms: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=70qL_eAn53mMwlAiYXFJ/uSbAOCS3y8LgpulCu9Od/01pppLdzHPARYF31H8DL/qHKpYw6yYFPD6bU1DmE2, stripped
$ ldd dms
    linux-vdso.so.1 (0x00007ffe07b9d000)
    libpthread.so.0 => /nix/store/0z5kcds7b6qmm373s3b5w9ykvqbgw87i-glibc-2.37-8/lib/libpthread.so.0 (0x00007fd494705000)
    libc.so.6 => /nix/store/0z5kcds7b6qmm373s3b5w9ykvqbgw87i-glibc-2.37-8/lib/libc.so.6 (0x00007fd49451f000)
    /lib64/ld-linux-x86-64.so.2 => /nix/store/0z5kcds7b6qmm373s3b5w9ykvqbgw87i-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007fd49470c000)
anacrolix commented 1 year ago

I'm not sure, I would assume a mismatch with your environment, and what the release executable was built against (glibc, CPU arch etc.). Given that you are using Nix you're probably a lot more familiar with this than I am, I would have started with ldd as well. It does look like the vdso file in the ldd output is missing tho?

2brownc commented 1 year ago

It's likely the environment but not the architecture.

$ uname -a
Linux nixos 6.1.27 #1-NixOS SMP PREEMPT_DYNAMIC Sun Apr 30 23:26:28 UTC 2023 x86_64 GNU/Linux

I built from the source and it's working now.

$ nix-shell -p libcap go gcc

$ go install github.com/anacrolix/dms@latest

$ ~/go/bin/dms -friendlyName DMS_Server -path '/mnt/ORION/DLNA/'
2023-05-06T17:49:33+0530 NIL [main main.mainErr:157]: allowed ip nets are ["0.0.0.0/0" "::/0"]
2023-05-06T17:49:33+0530 NIL [main main.mainErr:158]: serving folder "/mnt/ORION/DLNA"
2023-05-06T17:49:33+0530 NIL [main.(*fFprobeCache).load:269]: added 0 items from cache
2023-05-06T17:49:33+0530 NIL [main dms server github.com/anacrolix/dms/dlna/dms.(*Server).Init:918]: HTTP srv on [::]:1338
^C2023-05-06T17:52:25+0530 NIL [main.(*fFprobeCache).save:298]: saved cache with 0 items

Thanks.

anacrolix commented 1 year ago

Well that's excellent, thanks. Are you able to make a Nix recipe or something to make this available to other Nix users?

2brownc commented 1 year ago

If someone doesn't already in the meantime I am planning to submit dms to the official repos. But unfortunately I don't have a time frame.

I only started with NixOS a few days ago. So I am still figuring it out.

anacrolix commented 1 year ago

No worries, let me know if you end up contributing something to Nix so I can link to it and credit you for the effort!

2brownc commented 1 year ago

I will let you know for sure!