How to input files as command line arguments to compiled Julia

Hm, okay that is strange. I don’t understand why it would try to download the artifacts for PackageCompiler… I will see if I can find some issue.

1 Like

Can you add ENV["JULIA_DEBUG"] = "PackageCompiler" before rubnning create_app and show the output?

Also, there is no need to censo the <replacing this random string with text in case its sensitive> part.

1 Like

Okay, thanks.

Here’s what I tried:

julia> ENV["JULIA_DEBUG"] = "PackageCompiler"
"PackageCompiler"

julia> create_app("../MyNewTestPkg", "MyNewTestPkgApp";force=true)
┌ Debug: bundling artifacts...
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:755
┌ Debug: bundling artifacts for PackageCompiler
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:774
┌ Debug:   "i868-w64-mingw32"
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:779
 Downloading artifact: i868-w64-mingw32
┌ Error: Tree Hash Mismatch!
│   Expected git-tree-sha1:   b047c07d91786b3fc37b4983fa38a6fd5de9743a
│   Calculated git-tree-sha1: bc760d8ef1b4840e55a36bd361587b4975af811f
└ @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pk  Downloaded artifact: i868-w64-mingw32
 Downloading artifact: i868-w64-mingw32
┌ Error: Tree Hash Mismatch!
│   Expected git-tree-sha1:   b047c07d91786b3fc37b4983fa38a6fd5de9743a
│   Calculated git-tree-sha1: bc760d8ef1b4840e55a36bd361587b4975af811f
└ @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pk  Downloaded artifact: i868-w64-mingw32
ERROR: Unable to automatically install 'i868-w64-mingw32' from '/Users/connor/.julia/packages/PackageCompiler/BjVzm/Artifacts.toml'
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] ensure_artifact_installed(name::String, meta::Dict{String, Any}, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool, io::Base.TTY)
   @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pkg/src/Artifacts.jl:445
 [3] ensure_artifact_installed(name::String, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, pkg_uuid::Nothing, verbose::Bool, quiet_download::Bool, io::Base.TTY)
   @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pkg/src/Artifacts.jl:408
 [4] ensure_artifact_installed(name::String, artifacts_toml::String)
   @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pkg/src/Artifacts.jl:403
 [5] bundle_artifacts(ctx::Pkg.Types.Context, app_dir::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:780
 [6] create_app(package_dir::String, app_dir::String; app_name::Nothing, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, audit::Bool, force::Bool, c_driver_program::String, cpu_target::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:666
 [7] top-level scope
   @ REPL[37]:1

If you add pkg> add PackageCompiler#master you should get a new version with the git-tree-sha1 fixed.

I don’t understand why this is happening if PackageCompiler is not in your project. Is it still left in the Manifest.toml or something…?

1 Like

Okay so I ran the following:

(MyNewTestPkg) pkg> activate
  Activating environment at `~/.julia/environments/v1.6/Project.toml`

(@v1.6) pkg> add PackageCompiler#master
     Cloning git-repo `https://github.com/JuliaLang/PackageCompiler.jl.git`
    Updating git-repo `https://github.com/JuliaLang/PackageCompiler.jl.git`
   Resolving package versions...
    Updating `~/.julia/environments/v1.6/Project.toml`
  [9b87118b] ~ PackageCompiler v1.2.7 ⇒ v1.2.8 `https://github.com/JuliaLang/PackageCompiler.jl.git#master`
    Updating `~/.julia/environments/v1.6/Manifest.toml`
  [9b87118b] ~ PackageCompiler v1.2.7 ⇒ v1.2.8 `https://github.com/JuliaLang/PackageCompiler.jl.git#master`
Precompiling project...
  ✓ PackageCompiler
  ✓ MyNewTestPkg
  2 dependencies successfully precompiled in 2 seconds (29 already precompiled)
  2 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions

(@v1.6) pkg> activate /Users/connor/.julia/dev/MyNewTestPkg
  Activating new environment at `/Users/connor/.julia/dev/MyNewTestPkg/Project.toml`

(MyNewTestPkg) pkg> rm PackageCompiler
ERROR: The following package names could not be resolved:
 * PackageCompiler (not found in project or manifest)


julia> create_app("../MyNewTestPkg", "MyNewTestPkgApp";force=true)
┌ Debug: bundling artifacts...
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:755
┌ Debug: bundling artifacts for PackageCompiler
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:774
┌ Debug:   "i868-w64-mingw32"
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:779
 Downloading artifact: i868-w64-mingw32
┌ Error: Tree Hash Mismatch!
│   Expected git-tree-sha1:   b047c07d91786b3fc37b4983fa38a6fd5de9743a
│   Calculated git-tree-sha1: bc760d8ef1b4840e55a36bd361587b4975af811f
└ @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pk  Downloaded artifact: i868-w64-mingw32
 Downloading artifact: i868-w64-mingw32
┌ Error: Tree Hash Mismatch!
│   Expected git-tree-sha1:   b047c07d91786b3fc37b4983fa38a6fd5de9743a
│   Calculated git-tree-sha1: bc760d8ef1b4840e55a36bd361587b4975af811f
└ @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pk  Downloaded artifact: i868-w64-mingw32
ERROR: Unable to automatically install 'i868-w64-mingw32' from '/Users/connor/.julia/packages/PackageCompiler/BjVzm/Artifacts.toml'
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] ensure_artifact_installed(name::String, meta::Dict{String, Any}, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, verbose::Bool, quiet_download::Bool, io::Base.TTY)
   @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pkg/src/Artifacts.jl:445
 [3] ensure_artifact_installed(name::String, artifacts_toml::String; platform::Base.BinaryPlatforms.Platform, pkg_uuid::Nothing, verbose::Bool, quiet_download::Bool, io::Base.TTY)
   @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pkg/src/Artifacts.jl:408
 [4] ensure_artifact_installed(name::String, artifacts_toml::String)
   @ Pkg.Artifacts /private/tmp/julia-20210715-9083-1kg5j1n/julia-1.6.2/usr/share/julia/stdlib/v1.6/Pkg/src/Artifacts.jl:403
 [5] bundle_artifacts(ctx::Pkg.Types.Context, app_dir::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:780
 [6] create_app(package_dir::String, app_dir::String; app_name::Nothing, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, audit::Bool, force::Bool, c_driver_program::String, cpu_target::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/BjVzm/src/PackageCompiler.jl:666
 [7] top-level scope
   @ REPL[42]:1

Looking at the Manifest.toml file in MyNewTestPkg/, it looks like PackageCompiler is here…

# This file is machine-generated - editing it directly is not advised

[[ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"

[[Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[CSV]]
deps = ["Dates", "Mmap", "Parsers", "PooledArrays", "SentinelArrays", "Tables", "Unicode"]
git-tree-sha1 = "b83aa3f513be680454437a0eee21001607e5d983"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.8.5"

[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "dc7dedc2c2aa9faf59a55c622760a25cbefbe941"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.31.0"

[[Crayons]]
git-tree-sha1 = "3f71217b538d7aaee0b69ab47d9b7724ca8afa0d"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.0.4"

[[DataAPI]]
git-tree-sha1 = "ee400abb2298bd13bfc3df1c412ed228061a2385"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.7.0"

[[DataFrames]]
deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "1dadfca11c0e08e03ab15b63aaeda55266754bad"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "1.2.0"

[[DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "4437b64df1e0adccc3e5d1adbc3ac741095e4677"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.9"

[[DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"

[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[Downloads]]
deps = ["ArgTools", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

[[Formatting]]
deps = ["Printf"]
git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8"
uuid = "59287772-0a20-5a39-b81b-1366585eb4c0"
version = "0.4.2"

[[Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[InvertedIndices]]
deps = ["Test"]
git-tree-sha1 = "15732c475062348b0165684ffe28e85ea8396afc"
uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
version = "1.0.0"

[[IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"

[[LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"

[[LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"

[[LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"

[[LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"

[[Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"

[[Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "4ea90bd5d3985ae1f9a908bd4500ae88921c5ce7"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "1.0.0"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"

[[NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"

[[OrderedCollections]]
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.4.1"

[[PackageCompiler]]
deps = ["Libdl", "Pkg", "UUIDs"]
git-tree-sha1 = "da65ab494f3f5b1b6e458ef5530a9ec9dc8880b3"
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
version = "1.2.7"

[[Parsers]]
deps = ["Dates"]
git-tree-sha1 = "c8abc88faa3f7a3950832ac5d6e690881590d6dc"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.1.0"

[[Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[PooledArrays]]
deps = ["DataAPI", "Future"]
git-tree-sha1 = "cde4ce9d6f33219465b55162811d8de8139c0414"
uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
version = "1.2.1"

[[PrettyTables]]
deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"]
git-tree-sha1 = "0d1245a357cc61c8cd61934c07447aa569ff22e6"
uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
version = "1.1.0"

[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Reexport]]
git-tree-sha1 = "5f6c21241f0f655da3952fd60aa18477cf96c220"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.1.0"

[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[SentinelArrays]]
deps = ["Dates", "Random"]
git-tree-sha1 = "ffae887d0f0222a19c406a11c3831776d1383e3d"
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
version = "1.3.3"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[SortingAlgorithms]]
deps = ["DataStructures"]
git-tree-sha1 = "b3363d7460f7d098ca0912c69b082f75625d7508"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.0.1"

[[SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[[TableTraits]]
deps = ["IteratorInterfaceExtensions"]
git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39"
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.1"

[[Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"]
git-tree-sha1 = "8ed4a3ea724dac32670b062be3ef1c1de6773ae8"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.4.4"

[[Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"

[[Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"

[[nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"

[[p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"

If you don’t have PackageCompiler in your project and nothing depends on it, it shouldn’t be in your Manfiest either. Try run pkg> resolve in your MyNewTestPkg project.

3 Likes

It finally worked! I successfully compiled the package and ran it so it could accept file input! Thank you @oheil @mkitti @kristoffer.carlsson !

3 Likes