How to create executable file correctly?

I want to make executable file for a file called MyApp which is located in folder "../Create_exe_file/MyApp/src":


I have created a project in “MyApp” folder using the below script:

using Pkg
Pkg.generate("../Create_exe_file/MyApp")
Pkg.activate("../Create_exe_file/MyApp")
Pkg.instantiate()

the structure of MyApp is as below::

module MyApp

function julia_main()::Cint
  try
    main_code()
  catch
      Base.invokelatest(Base.display_error, Base.catch_stack())
      return 1
  end
  return 0
end
function main_code()
#body
end

Then, I am trying to create the .exe as below. However, I am having errors.

using PackageCompiler
create_app("../Create_exe_file/MyApp", "../Create_exe_file/MyAppCompiled")

┌ Warning: it is not recommended to create an app/library without a preexisting manifest
└ @ PackageCompiler C:\Users\amroa\.julia\packages\PackageCompiler\vXKVp\src\PackageCompiler.jl:66
ERROR: LoadError: expected package to have a `name`-entry
Stacktrace:

@lucatrv @ianshmean
@Simon @kristoffer.carlsson
Could you please guide me as I read the documentation but could not follow it correctly?

1 Like

I have made some modifications today to make it more easier as follow"
Now, I have one folder called Myfolder


I have generated the project.toml and Manifest.toml by below (however, I dont know why the size of project.toml is zero)

using Pkg
#Pkg.generate("$(@__DIR__)")
Pkg.activate("$(@__DIR__)")
Pkg.instantiate() 

in precompile_app.jl, the below is written:

using MyApp
MyApp.julia_main()

in MyApp.jl, the below is written:

module MyApp
Base.@ccallable function julia_main()::Cint
  try
    myfunction()
  catch
      Base.invokelatest(Base.display_error, Base.catch_stack())
      return 1
  end
  return 0
end
function myfunction()
# body
end myfunction
end #module

I wrote the below to generate the app, however, still have error:

using PackageCompiler
create_app("$(@__DIR__)", "MyfolderCompiled"; precompile_execution_file="$(@__DIR__)/MyApp.jl/$(@__DIR__)/precompile_app.jl")
┌ Warning: it is not recommended to create an app/library without a preexisting manifest
└ @ PackageCompiler C:\Users\amroa\.julia\packages\PackageCompiler\vXKVp\src\PackageCompiler.jl:66
ERROR: LoadError: expected package to have a `name`-entry
Stacktrace:

@kristoffer.carlsson
@lucatrv
@ianshmean
@viralbshah
@tkf
@asinghvi17
I am sorry if tagging you is improper, I just wanted to contact the professional guy if possible. Thank you in advance!