Skip to content

Moved BINDIR definition into '__init__'.#439

Merged
omus merged 2 commits intoJuliaLang:masterfrom
invenia:rf/bindir-fix
Jan 9, 2018
Merged

Moved BINDIR definition into '__init__'.#439
omus merged 2 commits intoJuliaLang:masterfrom
invenia:rf/bindir-fix

Conversation

@rofinn
Copy link
Copy Markdown
Contributor

@rofinn rofinn commented Dec 28, 2017

No description provided.

Copy link
Copy Markdown
Contributor

@yuyichao yuyichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__init__ must not do this.

@rofinn
Copy link
Copy Markdown
Contributor Author

rofinn commented Dec 28, 2017

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 6

This 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
Copy link
Copy Markdown
Member

@omus omus Dec 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__init__ must not do this.

Would changing this to no longer be const be acceptable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the __init__ required in 0.7?

Copy link
Copy Markdown
Contributor Author

@rofinn rofinn Dec 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know because my attempts to build a 0.7 system image on macos or linux produce segfaults.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

@stevengj stevengj Jan 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isconst(Sys, :BINDIR) is false, so Compat.BINDIR should probably not be const anyway.

@iamed2
Copy link
Copy Markdown
Contributor

iamed2 commented Jan 9, 2018

@yuyichao is the current version acceptable?

@omus omus merged commit d0f2551 into JuliaLang:master Jan 9, 2018
@omus omus deleted the rf/bindir-fix branch January 9, 2018 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants