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

Single File Wasabi #1154

Closed
lontivero opened this issue Feb 12, 2019 · 21 comments
Closed

Single File Wasabi #1154

lontivero opened this issue Feb 12, 2019 · 21 comments

Comments

@lontivero
Copy link
Collaborator

I've found this in the Scott Hanselman's blog post Brainstorming - Creating a small single self-contained executable out of a .NET Core application and I tried it and it works like a charm!

image

It not only compiles but also runs perfectly well. I also compiled it with the option -l aggressive and its size dropped from 56MB to 47MB. I love it, really. I think we should consider using this dotnet tool.

@nopara73
Copy link
Contributor

This is great! Will definitely look into it and probably ship like this from now on.

@NicolasDorier
Copy link
Contributor

You should wait, .NET Core 3.0 will have this out of the box. See design proposal on dotnet/designs#52

@NicolasDorier
Copy link
Contributor

Another solution, is to use https://github.com/dotnet/corert (I am 70% sure it generates 1 file as well)

CoreRT is a ahead of time compiler. It basically compile your executable directly in the target architecture. (No IL)
This mean faster startup and smaller binary. But the problem is that if you use reflection, you need to document it specifically in a separate file.

@lontivero
Copy link
Collaborator Author

You should wait, .NET Core 3.0 will have this out of the box. See design proposal on dotnet/designs#52

I don't agree. Whatever we have today will be better in a future leads to paralysis? Why waiting?This is something we can do right now and works okay, if in the near future .NET Core 3.0 comes with a better tool then we can use that one.

@NicolasDorier
Copy link
Contributor

NicolasDorier commented Feb 12, 2019

True. I am surprised it works. Apparently -l aggressive is using ILLinker, which start pruning the wrong stuff if you use reflection. (As it has no way to know in advance that what it pruned would be used by reflection)

I think avalonia use reflection extensively.

@nopara73
Copy link
Contributor

nopara73 commented Feb 15, 2019

Actually I'm surprised to work, too, because we have the "dummyhack", which makes sure the Extensions folder is present relative to the exe. Otherwise the software fails.

Also, did you try it with deleting the data folder? We should have the Tor binaries relative to the exe, too, except if Tor is already copied to the data folder.

@lontivero
Copy link
Collaborator Author

It does work. I tried deleting the data folder and it worked perfectly well too. I can see it runs the tor instance in the recently created data folder with:

/bin/sh -c LD_LIBRARY_PATH=$LD_LIBRARY_PATH:=/home/lontivero/.walletwasabi/client/tor/Tor && export LD_LIBRARY_PATH && cd /home/lontivero/.walletwasabi/client/tor/Tor && ./tor --SOCKSPort 127.0.0.1:9050 --Log "notice file /home/lontivero/.walletwasabi/client/TorLogs.txt"

Someone asked for:

Can you please provide (sic) a standalone portable executable for linux, that doesn't require installation.

This is exactly that.

@NicolasDorier
Copy link
Contributor

this is awesome. I am very surprised about why it works. For example, NBitcoin use reflection internally for message parsing. I was expecting the aggressive optimization to strip out reflection metadata and crash NBitcoin.

@lontivero
Copy link
Collaborator Author

I didn't test it. I just compile it, ran it and created a new Wallet (i tried with existing wallets too) and everything looked okay at a first glance. Of course if we agree with the concept then we would need to test it seriously.

@NicolasDorier
Copy link
Contributor

Yeah, you should try to run the tests on this.

@nopara73
Copy link
Contributor

We've been working on things those we know that our dependencies will fix in the future. For this situation I added a new tag, called "waiting for dependency." In this case we're waiting for .NET Core 3.0 to progress forward with this issue.

@jmacato
Copy link
Contributor

jmacato commented Aug 16, 2020

@molnard @nopara73 @lontivero this still is working with master branch :D using this command:

dotnet publish --configuration Release --force --self-contained true --runtime "linux-x64" /p:PublishSingleFile=true /p:DebugType=none /p:DebugSymbols=false /p:ErrorReport=none /p:Deterministic=True

@lontivero
Copy link
Collaborator Author

It doesn't work for me. It still copy all the .dll

@jmacato
Copy link
Contributor

jmacato commented Aug 16, 2020

check the "publish" folder, in my example it was: WalletWasabi/WalletWasabi.Gui/bin/Release/netcoreapp3.1/linux-x64/publish/

@NicolasDorier
Copy link
Contributor

@jmacato I discourage the self-contained option for now.

This is a hack, it is actually a self extracting file, it put Wasabi files inside some temp folder. Removing the .exe does not remove the app from the drive as it has been unzipped in temp files.

I think .NET 5.0 wants to improve this

@jmacato
Copy link
Contributor

jmacato commented Aug 18, 2020

@NicolasDorier yeah.. and also i was disappointed with the file size too... i'll give CoreRT a shot after we do 0.10 integration

@NicolasDorier
Copy link
Contributor

please give feedback on dotnet/corert#7200 then

@johnnyasantoss
Copy link

Maybe its worth checking these docs. I played with it in Wasabi a time ago. And it was yielding pretty good results.

@monperrus
Copy link

This issue seems for Windows (change the title?), for Linux, we have #1179

@molnard
Copy link
Contributor

molnard commented Nov 2, 2020

This is different, it is not related to the OS - you can publish the app with dotnet core in a single file format.

@lontivero
Copy link
Collaborator Author

We should close this issue because it will not be a thing anytime soon. Feel free to reopen it if you disagree with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants