Skip to content

Compiled exe doesn't work properly after UPX compression #49397

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

Closed
frak0d opened this issue Jul 5, 2022 · 2 comments
Closed

Compiled exe doesn't work properly after UPX compression #49397

frak0d opened this issue Jul 5, 2022 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-aot-code-size Related to improvements in AOT code size

Comments

@frak0d
Copy link

frak0d commented Jul 5, 2022

The default console Hello World project when compiled to exe, works fine.

But its too big in size (5.3mb), so i used UPX to compress it. Now it just shows default output of dart command :-

root@land ~/mfirst $ bin/mfirst.exe
Usage: dart [<vm-flags>] <dart-script-file> [<script-arguments>]
Executes the Dart script <dart-script-file> with the given list of <script-arguments>.

Common VM flags:                                                --help or -h
  Display this message (add -v or --verbose for information about
  all VM options).
--packages=<path>
  Where to find a package spec file.
--define=<key>=<value> or -D<key>=<value>
  Define an environment declaration. To specify multiple declarations,
  use multiple instances of this option.                        --snapshot-kind=<snapshot_kind>
--snapshot=<file_name>
  These snapshot options are used to generate a snapshot of the loaded
  Dart script:
    <snapshot-kind> controls the kind of snapshot, it could be
                    kernel(default) or app-jit
    <file_name> specifies the file into which the snapshot is written
--version
  Print the SDK version.
  • Tested on Dart version: 2.17.5 (stable) on "linux_arm64" & UPX v3.96 (lzma 4.43)

Might I be missing something ? How to decrease the exe size ? How to exclude debug info ?

@julemand101
Copy link
Contributor

When compiling to executable, Dart will basically take the dartaotruntime from the SDK and put the output from dart compile aot-snapshot on top of this. If your solution contains multiple programs, you might consider compiling to aot-snapshot and deploy dartaotruntime together with your application. You can then run your program with dartaotruntime yourProgram.aot.

But you should see dartaotruntime as a one-time cost for your program size. When your application grow in size, the amount of disk space used by dartaotruntime will stay the same. So you should not see the indication of "Hello World application seems very big for its code size" as if your application will continue growing in size with the same rate.

@lrhn lrhn added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-aot-code-size Related to improvements in AOT code size labels Jul 6, 2022
@mraleph
Copy link
Member

mraleph commented Jul 6, 2022

I'd say that 5.3Mb is negligent size for desktop and server side applications given current storage sizes and networking speeds. As @julemand101 explains large part of it is a fixed price of the runtime system and core libraries which are included even into a smaller apps. We might improve baseline cost at some point in the future but this is not a priority currently.

On Linux we still use concatenated representation so UPX can't really compress such thing. (See #39106 for details).

@mraleph mraleph closed this as completed Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-aot-code-size Related to improvements in AOT code size
Projects
None yet
Development

No branches or pull requests

4 participants