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

mix desktop.installer deploy error #4

Open
youfun opened this issue Jul 3, 2024 · 8 comments
Open

mix desktop.installer deploy error #4

youfun opened this issue Jul 3, 2024 · 8 comments

Comments

@youfun
Copy link

youfun commented Jul 3, 2024

ENV:
win11
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Mix 1.16.3 (compiled with Erlang/OTP 24)

error:

 mix desktop.installer           
Generated desktop_demo app                                              
* assembling default_release-0.1.0 on MIX_ENV=prod                      
* using config/runtime.exs to configure the release at runtime          
        
09:40:16.265 [warning] There is no package config defined. Using the generic Elixir App descriptions.
Running: convert -resize 64x64 priv/icon.png icon.ico
** (ArgumentError) argument error
    (stdlib 6.0) io.erl:203: :io.put_chars(:standard_io, <<206, 222, 208, 167, 178, 206, 202, 253, 32, 45, 32, 54, 52, 120, 54, 52, 13, 10>>)   
    (elixir 1.16.3) lib/system.ex:1149: System.do_port_byte/3
    (elixir 1.16.3) lib/system.ex:1135: System.do_cmd/3
    (desktop_deployment 1.0.0) lib/mix/tasks/installer.ex:41: Mix.Tasks.Desktop.Installer.run/2
    (mix 1.16.3) lib/mix/task.ex:478: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.16.3) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    c:/Scoop/apps/elixir/current/bin/mix:2: (file)

step :
mix new project and follow the lead from https://github.com/elixir-desktop/desktop/blob/main/guides/your_first_desktop_app.md

try comand: mix run --no-halt ,it is work.

and try to deploy.
add mix deps and def package() to mix.exs. add priv/icon.png pic file :

      {:desktop_deployment, github: "elixir-desktop/deployment", runtimes: false}


def package() do
    [
      name: "MyApp",
      name_long: "The most wonderfull App Ever",
      description: "MyApp is an Elixir App for Desktop",
      description_long: "MyApp for Desktop is powered by Phoenix LiveView",
      icon: "priv/icon.png",
      # https://developer.gnome.org/menu-spec/#additional-category-registry
      category_gnome: "GNOME;GTK;Office;",
      category_macos: "public.app-category.productivity",
      identifier: "io.myapp.app",
    ]
  end

mix deps.get
mix desktop.installer

@dominicletz
Copy link
Contributor

Hey @youfun, this is quite a curious error. And something seems to be wrong with the Erlang/Elixir installation. How did you install Erlang under windows and how are you running it?

Which shell are you using?

  1. WSL1
  2. WSL2
  3. cmd
  4. powershell
  5. msys
  6. Other?

Where did you download Erlang / Elixir for installation?

@youfun
Copy link
Author

youfun commented Jul 9, 2024

erlang and elixir from vfox version manger tool
https://github.com/version-fox/vfox)

vfox actually download install.exe to install erlang on windows (https://github.com/erlang/otp/releases)
download elixir from https://github.com/elixir-lang/elixir/releases

use poweshell:

check gcc version

 gcc -v
Using built-in specs.
COLLECT_GCC=C:\Scoop\apps\nuwen-mingw-gcc\current\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/Scoop/apps/nuwen-mingw-gcc/13.2.0-19.0/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../src/configure --enable-languages=c,c++ --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-multilib --prefix=/e/temp/gcc/dest --with-sysroot=/e/temp/gcc/dest --disable-libstdcxx-pch --disable-libstdcxx-verbose --disable-nls --disable-shared --disable-win32-registry --enable-threads=posix --enable-libgomp --with-zstd=/c/mingw
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC)

it report
here is no package config defined. Using the generic Elixir App descriptions.

try use Microsoft Visual Studio env

 cmd /K "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64

mix desktop.installer

* assembling default_release-1.2.0 on MIX_ENV=prod
* skipping runtime configuration (config/runtime.exs not found)

16:06:30.343 [warning] There is no package config defined. Using the generic Elixir App descriptions.
Running: convert -resize 64x64 priv/icon.png icon.ico
** (ArgumentError) argument error
    (stdlib 5.2) io.erl:103: :io.put_chars(:standard_io, <<206, 222, 208, 167, 178, 206, 202, 253, 32, 45, 32, 54, 52, 120, 54, 52, 13, 10>>)
    (elixir 1.16.2) lib/system.ex:1130: System.do_port_byte/3
    (elixir 1.16.2) lib/system.ex:1116: System.do_cmd/3
    (desktop_deployment 1.0.0) lib/mix/tasks/installer.ex:41: Mix.Tasks.Desktop.Installer.run/2
    (mix 1.16.2) lib/mix/task.ex:478: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.16.2) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    c:/Users/test/.version-fox/cache/elixir/current/bin/mix:2: (file)



dominicletz added a commit that referenced this issue Jul 9, 2024
This is an issue on non-utf8 terminals. Found on windows
#4
@dominicletz
Copy link
Contributor

Thanks, it seems cmd is returning some non-utf8 characters and the printing of those fails. I've updated the code to force print the characters in binary mode. That should get you over this hump.

Thanks!

@youfun
Copy link
Author

youfun commented Jul 9, 2024

thanks for you help

check the env

 MINGW64 ~
$  pacman -S --noconfirm --needed base-devel autoconf automake make libtool mingw-w64-x86_64-toolchain mingw-w64-x86_64-openssl mingw-w64-x86_64-libtool
warning: base-devel-2022.12-2 is up to date -- skipping
warning: autoconf-wrapper-20221207-2 is up to date -- skipping
warning: automake-wrapper-20221207-2 is up to date -- skipping
warning: make-4.4.1-2 is up to date -- skipping
warning: libtool-2.4.7-4 is up to date -- skipping
warning: mingw-w64-x86_64-binutils-2.42-2 is up to date -- skipping
warning: mingw-w64-x86_64-crt-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-gcc-14.1.0-3 is up to date -- skipping
warning: mingw-w64-x86_64-gdb-15.1-1 is up to date -- skipping
warning: mingw-w64-x86_64-gdb-multiarch-15.1-1 is up to date -- skipping
warning: mingw-w64-x86_64-headers-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-libmangle-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-libwinpthread-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-make-4.4.1-2 is up to date -- skipping
warning: mingw-w64-x86_64-pkgconf-1~2.2.0-1 is up to date -- skipping
warning: mingw-w64-x86_64-tools-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-winpthreads-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-winstorecompat-git-12.0.0.r81.g90abf784a-1 is up to date -- skipping
warning: mingw-w64-x86_64-openssl-3.3.1-1 is up to date -- skipping
warning: mingw-w64-x86_64-libtool-2.4.7-2 is up to date -- skipping
 there is nothing to do


error still but the msg seen useful?

poweshell ,if use cmd vs ,the same worg,

ssembling default_release-0.1.0 on MIX_ENV=prod
* using config/runtime.exs to configure the release at runtime
Running: convert -resize 64x64 priv/icon.png icon.ico
ÎÞЧ²ÎÊý - 64x64
** (MatchError) no match of right hand side value: {"", 4}
    (desktop_deployment 1.0.0) lib/tooling.ex:124: Desktop.Deployment.Tooling.cmd!/2    
    (desktop_deployment 1.0.0) lib/package.ex:48: Desktop.Deployment.Package.copy_extra_files/2
    (desktop_deployment 1.0.0) lib/deployment.ex:36: Desktop.Deployment.generate_installer/1
    (mix 1.16.2) lib/mix/tasks/release.ex:1076: Mix.Tasks.Release.run_steps/1
    (mix 1.16.2) lib/mix/task.ex:478: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.16.2) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    c:/Users/test/VERSIO~1/temp/171551~1/elixir/bin/mix:2: (file)

try to use msys2 64 shell

the elixir code from https://github.com/elixir-desktop/desktop-example-app

run mix desktop.installer , shell stop in this status:
image

image

env gcc from msys2 .othe install by vfox
image

@dominicletz
Copy link
Contributor

It's failing on the convert -resize 64x64 priv/icon.png icon.ico command, you can try to run that like this and see what the problem is. convert is from the imagemagick toolchain and should be an installed dependency

@youfun
Copy link
Author

youfun commented Jul 9, 2024

i follow your lead :
install imagemagick in window by scoop
use this command:

> convert -resize 64x64 priv/icon.png icon.ico
Invalid Parameter - 64x64

and there is a WARNING
WARNING: The convert command is deprecated in IMv7, use "magick" instead of "convert" or "magick convert"

use other command it work

magick icon.png -resize 64x64 icon.ico

test new command in mix


23:40:31.266 [warning] There is no package config defined. Using the generic Elixir App descriptions.
Running: magick priv/icon.png -resize 64x64 icon.ico
Running: c:/code/desktop-example-app/deps/desktop_deployment/rel/win32/rcedit.exe /I c:/code/desktop-example-app/_build/prod/rel/default_release/erts-14.2.2/bin/TodoApp.exe c:/code/desktop-example-app/_build/prod/rel/default_release/lib/todo_app-1.2.0/priv/icon.ico
Updating file c:/code/desktop-example-app/_build/prod/rel/default_release/erts-14.2.2/bin/TodoApp.exe
Updating file c:/code/desktop-example-app/_build/prod/rel/default_release/erts-14.2.2/bin/TodoApp.exe
Running: c:/code/desktop-example-app/deps/desktop_deployment/rel/win32/rcedit.exe /I c:/code/desktop-example-app/_build/prod/rel/default_release/erts-14.2.2/bin/beam.smp.dll c:/code/desktop-example-app/_build/prod/rel/default_release/lib/todo_app-1.2.0/priv/icon.ico
** (ArgumentError) errors were found at the given arguments:

  * 3rd argument: out of range

    :erlang.binary_part(<<77, 90, 144, 0, 3, 0, 0, 0, 4, 0, 0, 0, 255, 255, 0, 0, 184, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>, 4879360, 10192)
    (libpe 1.2.3) lib/libpe/optional_header.ex:288: LibPE.OptionalHeader.parse_data_directories/3
    (libpe 1.2.3) lib/libpe.ex:110: LibPE.parse_coff/3
    (libpe 1.2.3) lib/libpe.ex:48: LibPE.parse_string/1
    (libpe 1.2.3) lib/mix/tasks/update.ex:49: anonymous fn/4 in Mix.Tasks.Pe.Update.run/1
    (elixir 1.16.2) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
    (desktop_deployment 1.0.0) lib/package.ex:92: anonymous fn/7 in Desktop.Deployment.Package.copy_extra_files/2
    (elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3

@youfun
Copy link
Author

youfun commented Jul 22, 2024

After deleting the _build\prod directory and running mix desktop.installer, the final build process was completed. I installed the resulting .exe file on my local Windows machine (the same PC used for development). However, after installation, clicking the desktop icon doesn't launch the application. I also tried entering the file path and running the run.bat command, but nothing happened.

I'm using SQLite3 for my database, with the path set as follows:

Application.put_env(:cc, cc.Repo,
  database: Path.join(config_dir(), "./database.db")

To troubleshoot this issue, I'd like to add logging when the .exe starts. Could you guide me on how to implement this? Additionally, are there any other steps you'd recommend to diagnose and resolve this problem?

@dominicletz
Copy link
Contributor

Hey @youfun for trouble shooting the best is to go use the windows terminal go to the directory where the app is installed and use the bin/.bat which should be the "normal" release bat file and allows for extra commands such as "bin/.bat iex" to run the interactive shell. This should everything that is going right or wrong during startup.

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

No branches or pull requests

2 participants