Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP emby: 3.5.2.0 -> 3.5.3.0 and migration from mono to dotnet #47659

Merged
merged 4 commits into from Oct 4, 2018

Conversation

nyanloutre
Copy link
Member

@nyanloutre nyanloutre commented Oct 2, 2018

Motivation for this change

Fixes #47658

This release is not available as a mono build, so I tried to make it work with dotnet

Current situation

By launching it manually it seems to be working as it is

Fixed

I didn't manage to make it work yet, if you have any suggestion please make a comment.

Execution of bin/emby for now:

System.DllNotFoundException: Unable to load shared library 'sqlite3' or one of its dependencies.

Previously this was fixed by editing the file SQLitePCLRaw.provider.sqlite3.dll.config, but it is not present anymore and creating it doesn't have any effects.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

mkdir -p "$out/bin"
cp -r * "$out/bin"
install -dm 755 "$out/usr/lib/emby-server"
cp -r * "$out/usr/lib/emby-server"
Copy link
Contributor

@baracoder baracoder Oct 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this will copy env-vars file to the destination directory, which can contain references to other packages not needed at runtime, similar to #47269

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest would be appropriate?

Copy link
Contributor

@baracoder baracoder Oct 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the linked issue, I have changed the unpacking phase to create the expected source directory

    unpackPhase = ''
      mkdir src
      cd src
      tar xvzf $src
    '';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't figure out what shouldn't be copied. By inspecting the result simlink it seems that only needed files are here.

Copy link
Contributor

@baracoder baracoder Oct 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the build and there are no unwanted files in the result directory.
It seams I have misunderstood the origin of the problem in the other issue:
I assumed that the env-vars file is created as part of the setup for every build, but it is not. Also it seams to be not required, that an archive contains a directory for the files first. I will have to look at why it is again.
So I am sorry for adding this confusion.
Edit: 🤦‍♂️ Found my stupid mistake: The new zip file is organized in the expected manner. There is only one subdirectory named system, so everything works out.

@nyanloutre
Copy link
Member Author

@baracoder I tried to use coreclr, but corerun doesn't seems to be a drop in replacement of the dotnet executable.


makeWrapper "${mono54}/bin/mono" $out/bin/MediaBrowser.Server.Mono \
--add-flags "$out/bin/MediaBrowser.Server.Mono.exe -ffmpeg ${ffmpeg}/bin/ffmpeg -ffprobe ${ffmpeg}/bin/ffprobe"
install -dm 755 "$out/usr/lib/emby-server"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyanloutre This path shouldn't have usr/ in the nix store.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is /lib the correct folder ? I putted it here because it mostly consisted of dll files, but maybe /opt would be better ?

@worldofpeace
Copy link
Contributor

Execution of $out/bin/emby now fails with

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly '/nix/store/0cjx8x3y29v6q1bfmxh1w4a8bmd5rfjj-emby-3.5.3.0/lib/emby-server/EmbyServer.dll'. The module was expected to contain an assembly manifest.
Aborted

@nyanloutre
Copy link
Member Author

nyanloutre commented Oct 4, 2018

@worldofpeace this is strange, do you have any idea why ? If I revert the commit 9ec17c6 it works again

EDIT: Interestingly if I put the files in /opt it also work

@worldofpeace
Copy link
Contributor

@nyanloutre Strange, yet if it works at "$out/opt" then it's good 👍

@worldofpeace
Copy link
Contributor

@GrahamcOfBorg build emby

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: emby

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: emby

Partial log (click to expand)

no configure script, doing nothing
building
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/3cvin3yxq3927md8c4vl961mpsk48ahf-emby-3.5.3.0
strip is /nix/store/dxf1m7dhc4qb655bdljc1fsd74v1nag3-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/3cvin3yxq3927md8c4vl961mpsk48ahf-emby-3.5.3.0/bin
patching script interpreter paths in /nix/store/3cvin3yxq3927md8c4vl961mpsk48ahf-emby-3.5.3.0
checking for references to /build in /nix/store/3cvin3yxq3927md8c4vl961mpsk48ahf-emby-3.5.3.0...
/nix/store/3cvin3yxq3927md8c4vl961mpsk48ahf-emby-3.5.3.0

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally and such and I'm not having any issues so I think this is good.
Just squash into and edit this message WIP emby: 3.5.2.0 -> 3.5.3.0 to emby: 3.5.2.0 -> 3.5.3.0

cc @xeji @timokau

@timokau
Copy link
Member

timokau commented Oct 4, 2018

Thank you!

Since errors of this kind

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly '/nix/store/0cjx8x3y29v6q1bfmxh1w4a8bmd5rfjj-emby-3.5.3.0/lib/emby-server/EmbyServer.dll'. The module was expected to contain an assembly manifest.
Aborted

seem to be common, it would be nice to add some sort of automatic sanity testing in the future. Something like

installCheckPhase = ''
    $out/bin/emby -v | grep "${version}"
''

@timokau timokau merged commit 11068c6 into NixOS:master Oct 4, 2018
@nyanloutre
Copy link
Member Author

There should also be a patch to the Emby module because the binary name changed

nyanloutre added a commit to nyanloutre/nixpkgs that referenced this pull request Oct 5, 2018
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Oct 5, 2018
nixos/emby: fix use of outdated binary name changed by NixOS#47659
Vskilet pushed a commit to Vskilet/nixpkgs that referenced this pull request Oct 12, 2018
@nyanloutre nyanloutre deleted the emby-3.5.3.0 branch October 22, 2018 16:05
nyanloutre added a commit to nyanloutre/nixpkgs that referenced this pull request Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package Emby with dotnet core
5 participants