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

Fix build_sysimg on windows #18393

Merged
merged 2 commits into from
Sep 9, 2016
Merged

Fix build_sysimg on windows #18393

merged 2 commits into from
Sep 9, 2016

Conversation

musm
Copy link
Contributor

@musm musm commented Sep 7, 2016

Note rm(....) will not work it errors with

ERROR: unlink: operation not permitted (EPERM)
 in uv_error at .\libuv.jl:68 [inlined]
 in unlink(::String) at .\file.jl:382
 in #rm#7(::Bool, ::Bool, ::Function, ::String) at .\file.jl:107
 in link_sysimg(::String, ::String, ::Bool) at C:\Julia\julia-0.5-latest\share\julia\build_sysimg.jl:168
 in (::##2#3{Bool,String})() at C:\Julia\julia-0.5-latest\share\julia\build_sysimg.jl:90
 in cd(::##2#3{Bool,String}, ::String) at .\file.jl:48
 in #build_sysimg#1(::Bool, ::Bool, ::Function, ::Void, ::String, ::Void) at C:\Julia\julia-0.5-latest\share\julia\build_sysimg.jl:48
 in (::#kw##build_sysimg)(::Array{Any,1}, ::#build_sysimg, ::Void, ::String, ::Void) at .\<missing>:0 (repeats 2 times)

Can't delete old dll so here we simply rename and leave as is.

run(`$cc $FLAGS -o $sysimg_path.$(Libdl.dlext) $sysimg_path.o`)

if is_windows()
mv("$sysimg_path.$(Libdl.dlext)","$sysimg_path.$(Libdl.dlext).old";remove_destination=true)
Copy link
Contributor

@tkelman tkelman Sep 7, 2016

Choose a reason for hiding this comment

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

this should check if the source exists first

(also spaces after commas and semicolons are usually preferred for readability)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks fixed

@musm
Copy link
Contributor Author

musm commented Sep 7, 2016

This can probably be backported too

@ararslan
Copy link
Member

ararslan commented Sep 7, 2016

This can probably be backported too

Just as a heads up, typically the release overlords (e.g. @tkelman) decide which PRs are candidates for backporting to previous releases, and which releases they'll be backported to.

@tkelman
Copy link
Contributor

tkelman commented Sep 7, 2016

I don't mind people making suggestions though. Won't always agree, but if you've tested this in several use cases, then makes sense to me.

if is_windows() && isfile(sysimg_file)
mv(sysimg_file, "$sysimg_file.old"; remove_destination=true)
run(`$cc $FLAGS -o $sysimg_file $sysimg_path.o`)
run(`rm "$sysimg_path.$(Libdl.dlext).old"`)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little surprised this doesn't error, even after the file has been moved it's still loaded by the running executable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. I have seen many times in windows that a stubborn file that refuses to be deleted just needs a rename, before you can delete it, strange but it work.

@musm musm force-pushed the sysimgwin branch 3 times, most recently from 223cd34 to 1e2defa Compare September 8, 2016 01:57
@musm
Copy link
Contributor Author

musm commented Sep 8, 2016

Upon further testing using rm or del won't work. Simply renaming is the best/simplest option. Should be g2g now. Checked on cmd and powershell.

@musm
Copy link
Contributor Author

musm commented Sep 8, 2016

closes #18377

@vtjnash vtjnash merged commit e6848f3 into JuliaLang:master Sep 9, 2016
tkelman pushed a commit that referenced this pull request Sep 16, 2016
(cherry picked from commit 59c1cda)
ref #18393
tkelman pushed a commit that referenced this pull request Sep 16, 2016
(cherry picked from commit df99e20)
ref #18393
@musm musm deleted the sysimgwin branch January 3, 2017 19:26
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.

None yet

4 participants