Moved BINDIR definition into '__init__'.#439
Conversation
yuyichao
left a comment
There was a problem hiding this comment.
__init__ must not do this.
|
Is there an alternative that would allow Compat to be used in system images? Trying to create a system image with the current master produces the following error. cd $JULIA_PATH/base && \
> source $JULIA_PATH/Make.user && \
> $JULIA_PATH/julia -C $MARCH --output-o $JULIA_PATH/userimg.o --sysimage $JULIA_PATH/usr/lib/julia/sys.so --startup-file=no $JULIA_PATH/userimg.jl && \
> cc -shared -o $JULIA_PATH/userimg.so $JULIA_PATH/userimg.o -ljulia -L$JULIA_PATH/usr/lib
ERROR: LoadError: LoadError: LoadError: LoadError: UndefVarError: JULIA_HOME not defined
Stacktrace:
[1] include_from_node1(::String) at ./loading.jl:576
[2] eval(::Module, ::Any) at ./boot.jl:235
[3] _require(::Symbol) at ./loading.jl:490
[4] require(::Symbol) at ./loading.jl:405
[5] include_from_node1(::String) at ./loading.jl:576
[6] include(::String) at ./sysimg.jl:14
[7] include_from_node1(::String) at ./loading.jl:576
while loading /home/admin/.julia/v0.6/Compat/src/Compat.jl, in expression starting on line 589
while loading /home/admin/.julia/v0.6/Mocking/src/options.jl, in expression starting on line 1
while loading /home/admin/.julia/v0.6/Mocking/src/Mocking.jl, in expression starting on line 7
while loading /usr/local/julia/userimg.jl, in expression starting on line 6This change avoids that problem. |
src/Compat.jl
Outdated
| # NOTE: This needs to be in an __init__ because JULIA_HOME is not | ||
| # defined when building system images. | ||
| function __init__() | ||
| global const BINDIR = VERSION < v"0.7.0-DEV.3073" ? JULIA_HOME : Base.Sys.BINDIR |
There was a problem hiding this comment.
__init__must not do this.
Would changing this to no longer be const be acceptable?
There was a problem hiding this comment.
Is the __init__ required in 0.7?
There was a problem hiding this comment.
I don't know because my attempts to build a 0.7 system image on macos or linux produce segfaults.
There was a problem hiding this comment.
After reviewing JuliaLang/julia#25102 I think that the __init__ is also required on 0.7 as well as I believe that the variable is set at runtime as part of jl_resolve_sysimg_location.
There was a problem hiding this comment.
isconst(Sys, :BINDIR) is false, so Compat.BINDIR should probably not be const anyway.
|
@yuyichao is the current version acceptable? |
No description provided.