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

Generating REPL precompile statements fails on macOS Monterey #42882

Closed
ararslan opened this issue Nov 1, 2021 · 2 comments
Closed

Generating REPL precompile statements fails on macOS Monterey #42882

ararslan opened this issue Nov 1, 2021 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior system:mac Affects only macOS

Comments

@ararslan
Copy link
Member

ararslan commented Nov 1, 2021

With this change:

$ git diff
diff --git a/contrib/generate_precompile.jl b/contrib/generate_precompile.jl
index fbc4f837cc..0a8b940a07 100644
--- a/contrib/generate_precompile.jl
+++ b/contrib/generate_precompile.jl
@@ -232,7 +232,7 @@ end

 function generate_precompile_statements()
     start_time = time_ns()
-    debug_output = devnull # or stdout
+    debug_output = stdout # or stdout
     sysimg = Base.unsafe_string(Base.JLOptions().image_file)

     # Extract the precompile statements from the precompile file

I get

...
Sysimage built. Summary:
Total ───────  69.342643 seconds
Base: ───────  27.193484 seconds 39.2161%
Stdlibs: ────  42.146641 seconds 60.7803%
    JULIA usr/lib/julia/sys-o.a
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.0-DEV.854 (2021-10-31)
 _/ |\__'_|_|_|\__'_|  |  Commit 9ac5582580* (0 days old master)
|__/                   |

Generating REPL precompile statements... 1/35
#### inputting statement: ####
"2+2"
####
julia> 2+2
4

Generating REPL precompile statements... 2/35
#### inputting statement: ####
"print(\"\")"
####
julia> print("")

Generating REPL precompile statements... 3/35
#### inputting statement: ####
"printstyled(\"a\", \"b\")"
####
julia> printstyled("a", "b")
ab
Generating REPL precompile statements... 4/35
#### inputting statement: ####
"display([1])"
####
julia> display([1])
1-element Vector{Int64}:
 1

Generating REPL precompile statements... 5/35
#### inputting statement: ####
"display([1 2; 3 4])"
####
julia> display([1 2; 3 4])
2×2 Matrix{Int64}:
 1  2
 3  4

Generating REPL precompile statements... 6/35
#### inputting statement: ####
"@time 1+1"
####
julia> @time 1+1
  0.000001 seconds
2

Generating REPL precompile statements... 7/35
#### inputting statement: ####
"; pwd"
####
shell>  pwd
/Users/alex/Projects/julia/base

Generating REPL precompile statements... 8/35
#### inputting statement: ####
"\x03"
####
shell> ^C

julia>

Generating REPL precompile statements... 9/35
#### inputting statement: ####
"? reinterpret"
####
help?>  reinterpret
search: reinterpret

  reinterpret(type, A)

  Change the type-interpretation of a block of memory. For arrays, this
  constructs a view of the array with the same binary data as the given array,
  but with the specified element type. For example, reinterpret(Float32,
  UInt32(7)) interprets the 4 bytes corresponding to UInt32(7) as a Float32.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> reinterpret(Float32, UInt32(7))
  1.0f-44

  julia> reinterpret(Float32, UInt32[1 2 3 4 5])
  1×5 reinterpret(Float32, ::Matrix{UInt32}):
   1.0f-45  3.0f-45  4.0f-45  6.0f-45  7.0f-45

  ────────────────────────────────────────────────────────────────────────────

  reinterpret(reshape, T, A::AbstractArray{S}) -> B

  Change the type-interpretation of A while consuming or adding a "channel
  dimension."

  If sizeof(T) = n*sizeof(S) for n>1, A's first dimension must be of size n
  and B lacks A's first dimension. Conversely, if sizeof(S) = n*sizeof(T) for
  n>1, B gets a new first dimension of size n. The dimensionality is unchanged
  if sizeof(T) == sizeof(S).

Generating REPL precompile statements... 10/35
#### inputting statement: ####
"using Ra\t\x03"
####
^C
  │ Julia 1.6
  │
  │  This method requires at least Julia 1.6.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> A = [1 2; 3 4]
  2×2 Matrix{Int64}:
   1  2
   3  4

  julia> reinterpret(reshape, Complex{Int}, A)    # the result is a vector
  2-element reinterpret(reshape, Complex{Int64}, ::Matrix{Int64}) with eltype Complex{Int64}:
   1 + 3im
   2 + 4im

  julia> a = [(1,2,3), (4,5,6)]
  2-element Vector{Tuple{Int64, Int64, Int64}}:
   (1, 2, 3)
   (4, 5, 6)

  julia> reinterpret(reshape, Int, a)             # the result is a matrix
  3×2 reinterpret(reshape, Int64, ::Vector{Tuple{Int64, Int64, Int64}}) with eltype Int64:
   1  4
   2  5
   3  6

julia>

Generating REPL precompile statements... 11/35
#### inputting statement: ####
"\\alpha\t\x03"
####
julia> α^C

julia>

Generating REPL precompile statements... 12/35
#### inputting statement: ####
"\e[200~paste here ;)\e[201~\"\x03"
####
julia> paste here ;)"^C

julia>

Generating REPL precompile statements... 13/35
#### inputting statement: ####
"\e[A\e[B\x03"
####
julia> ^C

julia>

Generating REPL precompile statements... 14/35
#### inputting statement: ####
"123\b\b\b\x03"
####
julia> ^C

julia>

Generating REPL precompile statements... 15/35
#### inputting statement: ####
"\b\b\x03"
####
julia> ^C

julia>

Generating REPL precompile statements... 16/35
#### inputting statement: ####
"f(x) = x03"
####
julia> f(x) = x03
f (generic function with 1 method)

Generating REPL precompile statements... 17/35
#### inputting statement: ####
"f(1,2)"
####
julia> f(1,2)
ERROR: MethodError: no method matching f(::Int64, ::Int64)
Closest candidates are:
  f(::Any) at REPL[9]:1
Stacktrace:
 [1] top-level scope
   @ REPL[10]:1

Generating REPL precompile statements... 18/35
#### inputting statement: ####
"[][1]"
####
julia> [][1]
ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [1]
Stacktrace:
 [1] getindex(A::Vector{Any}, i1::Int64)
   @ Base ./array.jl:921
 [2] top-level scope
   @ REPL[11]:1

Generating REPL precompile statements... 19/35
#### inputting statement: ####
"cd(\"complet_path\t\t\x03"
####
julia> cd("complet_path^C

julia>

Generating REPL precompile statements... 20/35
#### inputting statement: ####
"import Pkg"
####
julia> import Pkg

Generating REPL precompile statements... 21/35
#### inputting statement: ####
"_pwd = pwd()"
####
julia> _pwd = pwd()
"/Users/alex/Projects/julia/base"

Generating REPL precompile statements... 22/35
#### inputting statement: ####
"tmp = Pkg._run_precompilation_script_setup()"
####
julia> tmp = Pkg._run_precompilation_script_setup()
  Activating project at `/private/var/folders/dv/q8h35hc9195_3dvwd_rfwpwr0000gn/T/jl_npGBo9`
  Generating  project TestPkg:
    TestPkg/Project.toml
    TestPkg/src/TestPkg.jl

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,4 CPUs x64)

Scanning the drive:
1 file, 6144 bytes (6 KiB)

Creating archive: registries/Registry.tar.gz

Items to compress: 1


Files read from disk: 1
Archive size: 565 bytes (1 KiB)
Everything is Ok
"/var/folders/dv/q8h35hc9195_3dvwd_rfwpwr0000gn/T/jl_npGBo9"

Generating REPL precompile statements... 23/35
#### inputting statement: ####
"\x03"
####
julia> ^C

julia>

Generating REPL precompile statements... 24/35
#### inputting statement: ####
"Pkg.add(\"TestPkg\")"
####
julia> Pkg.add("TestPkg")
    Updating registry at `/var/folders/dv/q8h35hc9195_3dvwd_rfwpwr0000gn/T/jl_npGBo9/registries/Registry.toml`
   Resolving package versions...
     Cloning [9f744518-33f8-4acc-bcf4-be5d4275168e] TestPkg from /var/folders/dv/q8h35hc9195_3dvwd_rfwpwr0000gn/T/jl_npGBo9/TestPkg.jl

signal (10): Bus error: 10
in expression starting at REPL[15]:1
unknown function (ip: 0x10b466008)
Allocations: 116143973 (Pool: 116086105; Big: 57868); GC: 122
Generating REPL precompile statements... 25/35
#### inputting statement: ####
"Pkg.develop(Pkg.PackageSpec(path=\"TestPkg.jl\"))"
####
ERROR: LoadError: IOError: stream is closed or unusable
Stacktrace:
  [1] check_open
    @ ./stream.jl:388 [inlined]
  [2] uv_write_async(s::Base.TTY, p::Ptr{UInt8}, n::UInt64)
    @ Base ./stream.jl:1069
  [3] uv_write(s::Base.TTY, p::Ptr{UInt8}, n::UInt64)
    @ Base ./stream.jl:1032
  [4] unsafe_write(s::Base.TTY, p::Ptr{UInt8}, n::UInt64)
    @ Base ./stream.jl:1115
  [5] write
    @ ./strings/io.jl:244 [inlined]
  [6] write
    @ ./io.jl:666 [inlined]
  [7] (::Main.anonymous.var"#2#6"{Set{String}, String, Base.TTY})(precompile_file::String, precompile_file_h::IOStream)
    @ Main.anonymous ~/Projects/julia/contrib/generate_precompile.jl:330
  [8] mktemp(fn::Main.anonymous.var"#2#6"{Set{String}, String, Base.TTY}, parent::String)
    @ Base.Filesystem ./file.jl:735
  [9] mktemp(fn::Function)
    @ Base.Filesystem ./file.jl:733
 [10] generate_precompile_statements()
    @ Main.anonymous ~/Projects/julia/contrib/generate_precompile.jl:274
 [11] top-level scope
    @ ~/Projects/julia/contrib/generate_precompile.jl:420
 [12] eval(m::Module, e::Any)
    @ Core ./boot.jl:368
 [13] top-level scope
    @ ~/Projects/julia/contrib/generate_precompile.jl:6
in expression starting at /Users/alex/Projects/julia/contrib/generate_precompile.jl:3
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***
make[1]: *** [/Users/alex/Projects/julia/usr/lib/julia/sys-o.a] Error 1
make: *** [julia-sysimg-release] Error 2

macOS Monterey (12.0.1) on x86_64

@ararslan ararslan added bug Indicates an unexpected problem or unintended behavior system:mac Affects only macOS labels Nov 1, 2021
@DilumAluthge
Copy link
Member

Seems similar to JuliaLang/Pkg.jl#2788

@ararslan
Copy link
Member Author

ararslan commented Nov 4, 2021

Fixed by #42930!

@ararslan ararslan closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior system:mac Affects only macOS
Projects
None yet
Development

No branches or pull requests

2 participants