JuliaLang / JuliaLang/PackageCompiler.jl

UndefVarError: MyApp not defined

Open
#685 1 comment 0 reactions 0 assignees View on GitHub
bug upstream
Dominant language
Julia
Stars
1.6k
Forks
205
Avg merge
18h 37m
Merged PRs (30d)
7

Description

When I run the tests locally, and when I generate my own apps, I see a failure in app generation - it creates the executables, but executing them always produces `UndefVarError: MyApp not defined`

macOS Monterey 12.3.1 (21E258)
brew julia 1.7.2
commit adbf1df36a - running `act -j test` succeeds, as does CI in this repo, but that is using `macOS-latest` which at the moment is "macOS 11". I've done my [own CI build using `macos-12`](https://github.com/jayvdb/PackageCompiler.jl/runs/6237325907?check_suite_focus=true), and that appears to have passed this bit.

```
% julia --compile=min -O0 -e 'using InteractiveUtils; versioninfo()'
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.3.0)
CPU: Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
% clang --version
Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

PackageCompiler.jl % julia test/runtests.jl
Installing known registries into `/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_Q6wdti`
Updating registry at `/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_Q6wdti/registries/General.toml`
Resolving package versions...
Installed Example ─ v0.5.3
Updating `/private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_vq0C70/Project.toml`
[7876af07] + Example v0.5.3
Updating `/private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_vq0C70/Manifest.toml`
[7876af07] + Example v0.5.3
Precompiling project...
1 dependency successfully precompiled in 1 seconds
┌ Debug: instantiating project at "/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_vq0C70"
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:449
┌ Debug: running precompilation execution script...
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:256
[ Info: PackageCompiler: Executing /Users/jayvdb/jl/PackageCompiler.jl/test/precompile_execution.jl => /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_packagecompiler_zJ8DbU/jl_MYeoKW
[ Info: PackageCompiler: Done
┌ Debug: running `/usr/local/Cellar/julia/1.7.2/bin/julia --color=yes --startup-file=no --cpu-target=native -O3 -O1 --sysimage=/usr/local/Cellar/julia/1.7.2/lib/julia/sys.dylib --project=/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_vq0C70 --output-o=/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_pks2NT.o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_ua0Cw2`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:354
✔ [01m:58s] PackageCompiler: compiling incremental system image
┌ Debug: running `g++ -m64 -march=x86-64 -shared -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/sys.dylib -Wl,-all_load /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_pks2NT.o -ljulia -ljulia-internal -fPIC -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/julia`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
ld: warning: could not create compact unwind for _julia_Dict_15916: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _julia_Dict_15908: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _julia_YY.236_56478: stack subq instruction is too different from dwarf stack size
[ Warning: PackageCompiler: This does not look like an official Julia build, functionality may suffer.
Installed HelloWorldC_jll ─ v1.1.3+0
Installed Preferences ───── v1.3.0
Installed Crayons ───────── v4.1.1
Installed JLLWrappers ───── v1.4.1
Downloading artifact: HelloWorldC
Downloaded artifact: HelloWorldC
Downloading artifact: fooifier
Downloaded artifact: fooifier
PackageCompiler: bundled artifacts:
├── HelloWorldC_jll - 26.843 KiB
└── MyApp
└── fooifier - 14.124 KiB
Total artifact file size: 40.967 KiB
┌ Debug: instantiating project at "/private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyApp"
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:449
Precompiling project...
8 dependencies successfully precompiled in 3 seconds (1 already precompiled)
┌ Debug: running precompilation execution script...
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:256
[ Info: PackageCompiler: Executing /Users/jayvdb/jl/PackageCompiler.jl/examples/MyApp/precompile_app.jl => /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_packagecompiler_cOJFee/jl_woY4oN
ARGS = ["arg"]
Base.PROGRAM_FILE = "/Users/jayvdb/jl/PackageCompiler.jl/test/../examples/MyApp/precompile_app.jl"
DEPOT_PATH = ["/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_Q6wdti"]
LOAD_PATH = ["/private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyApp", "@stdlib"]
pwd() = "/Users/jayvdb/jl/PackageCompiler.jl"
Base.active_project() = "/private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyApp/Project.toml"
Sys.BINDIR = "/usr/local/Cellar/julia/1.7.2/bin"
(Base.JLOptions()).opt_level = 2
(Base.JLOptions()).nthreads = 0
(Base.JLOptions()).check_bounds = 0
Dict{Base.PkgId, Module} with 49 entries:
Downloads [f43a241f-c20a-4ad4-852c-f6b1247861c6] => Downloads
Example [7876af07-990d-54b4-ab0e-23690620f79a] => Example
Unicode [4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5] => Unicode
Main [top-level] => Main
REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] => REPL
NetworkOptions [ca575930-c2e3-43a9-ace4-1e988b2c1908] => NetworkOptions
DelimitedFiles [8bb1440f-4735-579b-a4ab-409b98df4dab] => DelimitedFiles
HelloWorldC_jll [dca1746e-5efc-54fc-8249-22745bc95a49] => HelloWorldC_jll
Serialization [9e88b42a-f829-5b0c-bbe9-9e923198166b] => Serialization
Profile [9abbd945-dff8-562f-b5e8-e1ebf5ef1b79] => Profile
UUIDs [cf7118a7-6976-5b1a-9a39-7adc72f591a4] => UUIDs
SuiteSparse [4607b0f0-06f3-5cda-b6b1-a6196a1729e9] => SuiteSparse
Logging [56ddb016-857b-54e1-b83d-db4d58db5568] => Logging
LinearAlgebra [37e2e46d-f89d-539d-b4ee-838fcccc9c8e] => LinearAlgebra
Random [9a3f8284-a2c9-5f02-9a11-845980a1fd5c] => Random
Printf [de0858da-6303-5e67-8744-51eddeeeb8d7] => Printf
ArgTools [0dad84c5-d112-42e6-8d28-ef12dabb789f] => ArgTools
Statistics [10745b16-79ce-11e8-11f9-7d13ad32a3b2] => Statistics
SparseArrays [2f01184e-e22b-5df5-ae63-d93ebab69eaf] => SparseArrays
Base64 [2a0f44e3-6c83-55bd-87e4-b1978d98bd5f] => Base64
Markdown [d6f4376e-aef5-505a-96c1-9c027394607a] => Markdown
MozillaCACerts_jll [14a3606d-f60d-562e-9121-12d972cd8159] => MozillaCACerts_jll
Distributed [8ba89e20-285c-5b6f-9357-94700520ee1b] => Distributed
LibCURL_jll [deac9b47-8bc7-5906-a0fe-35ac56dc84c0] => LibCURL_jll
TOML [fa267f1f-6049-4f14-aa54-33bafae1ed76] => TOML
Core [top-level] => Core
CRC32c [8bf52ea8-c179-5cab-976a-9e18b702a9bc] => CRC32c
LazyArtifacts [4af54fe1-eca0-43a8-85a7-787d91b784e3] => LazyArtifacts
Tar [a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e] => Tar
LibGit2 [76f85450-5226-5b5a-8eaa-529ad045b433] => LibGit2
Mmap [a63ad114-7e13-5084-954f-fe012c677804] => Mmap
Test [8dfed614-e22c-5e08-85e1-65c5234f0b40] => Test
Sockets [6462fe0b-24de-5631-8697-dd941f90decc] => Sockets
Future [9fa8497b-333b-5362-9e8d-4d0656e87820] => Future
nghttp2_jll [8e850ede-7688-5339-a07c-302acd2aaf8d] => nghttp2_jll
SharedArrays [1a1011a3-84de-559e-8e89-a11a2f7dc383] => SharedArrays
Libdl [8f399da3-3557-5675-b5ff-fb832c97cbdb] => Libdl
SHA [ea8e919c-243c-51af-8825-aaa63cd721ce] => SHA
Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f] => Pkg
FileWatching [7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee] => FileWatching
Artifacts [56f22d72-fd6d-98f1-02f0-08ddc0907c33] => Artifacts
Dates [ade2ca70-3891-5945-98fb-dc099432e06a] => Dates
InteractiveUtils [b77e0a4c-d291-57a0-90e8-8db25a27a240] => InteractiveUtils
p7zip_jll [3f19e933-33d8-53b3-aaab-bd5110c3b7a0] => p7zip_jll
MyApp [f943f3d7-887a-4ed5-b0c0-a1d6899aa8f5] => MyApp
LibCURL [b27032c2-a3e7-50c8-80cd-2d36dbcbfd21] => LibCURL
JLLWrappers [692b3bcd-3c85-4b1f-b108-f13ce0eb3210] => JLLWrappers
Base [top-level] => Base
Preferences [21216c6a-2e73-6563-6e65-726566657250] => Preferences
Running a jll package:
HelloWorld artifact at /private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_Q6wdti/artifacts/23a2680473c2168d3c110b2abf119c6a4284b325/bin/hello_world
Hello, World!

is_crayons_loaded() = false
Running the artifact
The result of 2*5^2 - 10 == 40.000000

unsafe_string((Base.JLOptions()).image_file) = "/usr/local/Cellar/julia/1.7.2/lib/julia/sys.dylib"
Example.domath(5) = 10
sin(0.0) = 0.0
outputo: ok
myrand: ok
n = 20000000
8
From worker 4: 8
From worker 3: 8
From worker 2: 8
From worker 5: 8
[ Info: PackageCompiler: Done
┌ Debug: running `/usr/local/Cellar/julia/1.7.2/bin/julia --color=yes --startup-file=no '--cpu-target=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' -O3 --sysimage=/usr/local/Cellar/julia/1.7.2/lib/julia/sys.dylib --project=/private/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyApp --output-o=/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_o6afYQ.o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_SKShuj`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:354
✔ [02m:56s] PackageCompiler: compiling incremental system image
┌ Debug: running `g++ -m64 -march=x86-64 -shared -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/lib/julia/sys.dylib -Wl,-all_load /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_o6afYQ.o -ljulia -ljulia-internal -fPIC -Wl,-rpath,@executable_path -Wl,-rpath,@executable_path/julia`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
ld: warning: could not create compact unwind for _julia_Dict_16082: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _julia_Dict_16074: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _julia_YY.236_58264: stack subq instruction is too different from dwarf stack size
┌ Debug: running `gcc '-DJULIA_MAIN="MyApp.julia_main"' -DNEW_DEFINE_FAST_TLS_SYNTAX -m64 -march=x86-64 -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/bin/MyApp /Users/jayvdb/.julia/packages/PackageCompiler/wpsGv/src/embedding_wrapper.c -O2 -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../lib/julia -std=gnu99 -I/usr/local/Cellar/julia/1.7.2/include/julia -fPIC -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -ljulia -ljulia-internal`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
┌ Debug: running `gcc '-DJULIA_MAIN="MyApp.second_main"' -DNEW_DEFINE_FAST_TLS_SYNTAX -m64 -march=x86-64 -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/bin/SecondApp /Users/jayvdb/.julia/packages/PackageCompiler/wpsGv/src/embedding_wrapper.c -O2 -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../lib/julia -std=gnu99 -I/usr/local/Cellar/julia/1.7.2/include/julia -fPIC -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -ljulia -ljulia-internal`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
┌ Debug: running `gcc '-DJULIA_MAIN="MyApp.wrong_return_type"' -DNEW_DEFINE_FAST_TLS_SYNTAX -m64 -march=x86-64 -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/bin/ReturnType /Users/jayvdb/.julia/packages/PackageCompiler/wpsGv/src/embedding_wrapper.c -O2 -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../lib/julia -std=gnu99 -I/usr/local/Cellar/julia/1.7.2/include/julia -fPIC -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -ljulia -ljulia-internal`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
┌ Debug: running `gcc '-DJULIA_MAIN="MyApp.erroring"' -DNEW_DEFINE_FAST_TLS_SYNTAX -m64 -march=x86-64 -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/bin/Error /Users/jayvdb/.julia/packages/PackageCompiler/wpsGv/src/embedding_wrapper.c -O2 -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../lib/julia -std=gnu99 -I/usr/local/Cellar/julia/1.7.2/include/julia -fPIC -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -ljulia -ljulia-internal`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
┌ Debug: running `gcc '-DJULIA_MAIN="MyApp.undefined"' -DNEW_DEFINE_FAST_TLS_SYNTAX -m64 -march=x86-64 -o /var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/bin/Undefined /Users/jayvdb/.julia/packages/PackageCompiler/wpsGv/src/embedding_wrapper.c -O2 -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../lib/julia -std=gnu99 -I/usr/local/Cellar/julia/1.7.2/include/julia -fPIC -L/usr/local/Cellar/julia/1.7.2/lib -L/usr/local/Cellar/julia/1.7.2/lib/julia -ljulia -ljulia-internal`
└ @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:162
UndefVarError: MyApp not defined
PackageCompiler.jl: Error During Test at /Users/jayvdb/jl/PackageCompiler.jl/test/runtests.jl:20
Got exception outside of a @test
failed process: Process(`/var/folders/j6/q46zbprs12n5ds9z7zytq5mm0000gn/T/jl_w8ApBH/MyAppCompiled/bin/MyApp I get --args --julia-args --threads=3 --check-bounds=yes -O1`, ProcessExited(1)) [1]

Stacktrace:
[1] pipeline_error
@ ./process.jl:531 [inlined]
[2] read(cmd::Cmd)
@ Base ./process.jl:418
[3] read(cmd::Cmd, #unused#::Type{String})
@ Base ./process.jl:427
[4] macro expansion
@ ~/jl/PackageCompiler.jl/test/runtests.jl:78 [inlined]
[5] macro expansion
@ /usr/local/Cellar/julia/1.7.2/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
[6] top-level scope
@ ~/jl/PackageCompiler.jl/test/runtests.jl:21
[7] include(mod::Module, _path::String)
@ Base ./Base.jl:418
[8] exec_options(opts::Base.JLOptions)
@ Base ./client.jl:292
[9] _start()
@ Base ./client.jl:495
Test Summary: | Pass Error Total
PackageCompiler.jl | 3 1 4
ERROR: LoadError: Some tests did not pass: 3 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /Users/jayvdb/jl/PackageCompiler.jl/test/runtests.jl:20
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running test/runtests.jl on macOS 12 with Julia 1.7.2 and reproducing the generated-app failure described in examples/MyApp. Inspect the app-generation and executable-running steps around the MyApp example, then verify that generated executables run without UndefVarError: MyApp not defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.