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

Confusing error if JULIA_CPU_TARGET="" #52209

Closed
ericphanson opened this issue Nov 17, 2023 · 4 comments · Fixed by #52217
Closed

Confusing error if JULIA_CPU_TARGET="" #52209

ericphanson opened this issue Nov 17, 2023 · 4 comments · Fixed by #52217
Labels
backport 1.10 Change should be backported to the 1.10 release

Comments

@ericphanson
Copy link
Contributor

This isn't a valid setting, but the error should be more clear (bc this can happen by accident). Currently it gives the error

ERROR: Invalid CPU name "-J/Users/eph/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/lib/julia/sys.dylib"

which looks like it is somehow taking the next implicit argument as the target.

Full demo on 1.9.4:

JULIA_CPU_TARGET="" julia
]               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.4 (2023-11-14)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.9) pkg> activate --temp
  Activating new project at `/var/folders/gj/l9rbktlj6qndlnz1nk164d280000gn/T/jl_5zBoLF`

(jl_5zBoLF) pkg> add PackageAnalyzer
   Resolving package versions...
   Installed PackageAnalyzer ─ v3.0.1
   Installed JuliaSyntax ───── v0.4.7
    Updating `/private/var/folders/gj/l9rbktlj6qndlnz1nk164d280000gn/T/jl_5zBoLF/Project.toml`
  [e713c705] + PackageAnalyzer v3.0.1
    Updating `/private/var/folders/gj/l9rbktlj6qndlnz1nk164d280000gn/T/jl_5zBoLF/Manifest.toml`
  [1520ce14] + AbstractTrees v0.4.4
  [69666777] + Arrow v2.6.2
  [31f734f8] + ArrowTypes v2.2.2
  [d1d4a3ce] + BitFlags v0.1.8
  [c3b6d118] + BitIntegers v0.3.1
⌅ [fa961155] + CEnum v0.4.2
  [5ba52731] + CodecLz4 v0.4.1
  [944b1d66] + CodecZlib v0.7.3
⌅ [6b39b394] + CodecZstd v0.7.2
  [34da2185] + Compat v4.10.0
  [f0e56b4a] + ConcurrentUtilities v2.3.0
  [187b0558] + ConstructionBase v1.5.4
  [9a962f9c] + DataAPI v1.15.0
  [e2d170a0] + DataValueInterfaces v1.0.0
  [4e289a0a] + EnumX v1.0.4
  [460bff9d] + ExceptionUnwrapping v0.1.9
  [e2ba6199] + ExprTools v0.1.10
  [d7ba0133] + Git v1.3.0
  [bc5e4493] + GitHub v5.9.0
  [cd3eb016] + HTTP v1.10.0
  [842dd82b] + InlineStrings v1.4.0
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [692b3bcd] + JLLWrappers v1.5.0
  [682c06a0] + JSON v0.21.4
  [0f8b85d8] + JSON3 v1.13.2
  [70703baa] + JuliaSyntax v0.4.7
  [0e77f7df] + LazilyInitializedFields v1.2.2
  [741b9549] + Legolas v0.5.15
  [726dbf0d] + LicenseCheck v0.2.2
  [e6f89c97] + LoggingExtras v1.0.3
  [739be429] + MbedTLS v1.1.8
  [78c3b35d] + Mocking v0.7.7
  [4d8831e6] + OpenSSL v1.4.1
  [bac558e1] + OrderedCollections v1.6.2
  [e713c705] + PackageAnalyzer v3.0.1
  [69de0a69] + Parsers v2.8.0
  [2dfb63ee] + PooledArrays v1.4.3
  [aea7be01] + PrecompileTools v1.2.0
  [21216c6a] + Preferences v1.4.1
  [2792f1a3] + RegistryInstances v0.1.0
  [6c6a2e73] + Scratch v1.2.1
  [91c51154] + SentinelArrays v1.4.1
  [777ac1f9] + SimpleBufferStream v1.1.0
  [2133526b] + SodiumSeal v0.1.1
  [856f2bd8] + StructTypes v1.10.0
  [dc5dba14] + TZJData v1.0.0+2023c
  [3783bdb8] + TableTraits v1.0.1
  [bd369af6] + Tables v1.11.1
  [f269a46b] + TimeZones v1.13.0
⌅ [3bb67fe8] + TranscodingStreams v0.9.13
  [5c2747f8] + URIs v1.5.1
  [2e619515] + Expat_jll v2.5.0+0
  [f8c6e375] + Git_jll v2.42.0+0
  [94ce4f54] + Libiconv_jll v1.17.0+0
  [5ced341a] + Lz4_jll v1.9.4+0
  [458c3c95] + OpenSSL_jll v3.0.12+0
  [3ac119c9] + Tokei_jll v12.1.200+0
  [3161d3a3] + Zstd_jll v1.5.5+0
  [a9144af2] + libsodium_jll v1.0.20+0
  [4ecb348a] + licensecheck_jll v0.3.101+0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [9fa8497b] + Future
  [b77e0a4c] + InteractiveUtils
  [4af54fe1] + LazyArtifacts
  [b27032c2] + LibCURL v0.6.4
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.9.2
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [fa267f1f] + TOML v1.0.3
  [a4e569a6] + Tar v1.10.0
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.0.5+0
  [deac9b47] + LibCURL_jll v8.4.0+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.2+0
  [14a3606d] + MozillaCACerts_jll v2022.10.11
  [4536629a] + OpenBLAS_jll v0.3.21+4
  [efcefdf7] + PCRE2_jll v10.42.0+0
  [83775a58] + Zlib_jll v1.2.13+0
  [8e850b90] + libblastrampoline_jll v5.8.0+0
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.4.0+0
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Precompiling project...
  ✗ LazilyInitializedFields
  ✗ AbstractTrees
  ✗ JuliaSyntax
  ✗ Tokei_jll
  ✗ Expat_jll
  ✗ licensecheck_jll
  ✗ RegistryInstances
  ✗ Git_jll
  ✗ LicenseCheck
  ✗ Git
  ✗ PackageAnalyzer
  0 dependencies successfully precompiled in 1 seconds. 55 already precompiled.
  11 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages

(jl_5zBoLF) pkg> precompile
Precompiling project...
  ✗ LazilyInitializedFields
  ✗ AbstractTrees
  ✗ JuliaSyntax
  ✗ Tokei_jll
  ✗ Expat_jll
  ✗ licensecheck_jll
  ✗ RegistryInstances
  ✗ Git_jll
  ✗ LicenseCheck
  ✗ Git
  ✗ PackageAnalyzer
  0 dependencies successfully precompiled in 0 seconds. 55 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

PackageAnalyzer [e713c705-17e4-4cec-abe0-95bf5bf3e10c]

Failed to precompile PackageAnalyzer [e713c705-17e4-4cec-abe0-95bf5bf3e10c] to "/Users/eph/.julia/compiled/v1.9/PackageAnalyzer/jl_YTsf62".
ERROR: Invalid CPU name "-J/Users/eph/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/lib/julia/sys.dylib"
@giordano
Copy link
Contributor

Stacktrace is

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:2294
 [3] compilecache
   @ ./loading.jl:2167 [inlined]
 [4] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1805
 [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1660
 [6] macro expansion
   @ ./loading.jl:1648 [inlined]
 [7] macro expansion
   @ ./lock.jl:267 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1611

so probably empty JULIA_CPU_TARGET isn't handled correctly in

cpu_target = get(ENV, "JULIA_CPU_TARGET", nothing)
and/or
cpu_target = get(ENV, "JULIA_CPU_TARGET", nothing)

@vtjnash
Copy link
Member

vtjnash commented Nov 17, 2023

There is a missing space here:

diff --git a/base/util.jl b/base/util.jl
index a3771f4ae9..c4775f77c0 100644
--- a/base/util.jl
+++ b/base/util.jl
@@ -243,7 +243,7 @@ function julia_cmd(julia=joinpath(Sys.BINDIR, julia_exename()); cpu_target::Unio
     if opts.use_pkgimages == 0
         push!(addflags, "--pkgimages=no")
     end
-    return `$julia -C$cpu_target -J$image_file $addflags`
+    return `$julia -C $cpu_target -J $image_file $addflags`
 end
 
 function julia_exename()

@vtjnash vtjnash added the backport 1.10 Change should be backported to the 1.10 release label Nov 17, 2023
@giordano
Copy link
Contributor

I don't think that helps much, I still get the same error with that change. But changing

if cpu_target === nothing
to

    if cpu_target === nothing || isempty(cpu_target)

does the trick for me. Alternatively, normalising empty string to nothing in the places mentioned above.

@vtjnash
Copy link
Member

vtjnash commented Nov 17, 2023

Yes, seems like is also needed, since we should probably treat empty variables as equivalent to missing, even though empty arguments are errors

./julia -C ''
ERROR: Invalid target option: empty CPU name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.10 Change should be backported to the 1.10 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants