From ff07478dd150ab965905d6b40aeafb1611cabed2 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Mon, 28 Mar 2016 14:47:24 -0700 Subject: [PATCH 1/8] Revert "Remove the gcc dll replacement for now" This reverts commit 0312fb0873701d761e0946e6d3066bd70e962d42. --- deps/build.jl | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/deps/build.jl b/deps/build.jl index 90f99dd..314592d 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,2 +1,55 @@ -using WinRPM +using WinRPM, SHA WinRPM.update() + +# update julia's gcc dlls +@windows_only begin + winrpm_bin = joinpath(WinRPM.installdir, "usr", Sys.MACHINE, + "sys-root", "mingw", "bin") + dlls = ["libgfortran-3", "libquadmath-0", "libstdc++-6", "libssp-0", + WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] + dlls_to_download = ASCIIString[] + for lib in dlls + if !isfile(joinpath(winrpm_bin, lib * ".dll")) + push!(dlls_to_download, replace(lib, "-", "")) + end + # try to clean up -copy remnants + if isfile(joinpath(JULIA_HOME, lib * "-copy.dll")) + try + rm(joinpath(JULIA_HOME, lib * "-copy.dll")) + end + end + end + if !isempty(dlls_to_download) + WinRPM.install(dlls_to_download; yes = true) + end + dlls_to_update = ASCIIString[] + for lib in dlls + local sha_current, sha_new + open(joinpath(JULIA_HOME, lib * ".dll")) do f + sha_current = sha256(f) + end + open(joinpath(winrpm_bin, lib * ".dll")) do f + sha_new = sha256(f) + end + if sha_current != sha_new + push!(dlls_to_update, lib) + end + end + if !isempty(dlls_to_update) + try + for lib in dlls_to_update + # it's possible to move an in-use dll and put a new file where + # it used to be, but not delete or overwrite it in-place? + mv(joinpath(JULIA_HOME, lib * ".dll"), joinpath(JULIA_HOME, lib * "-copy.dll")) + cp(joinpath(winrpm_bin, lib * ".dll"), joinpath(JULIA_HOME, lib * ".dll")) + end + warn("Updated Julia's gcc dlls, you may need to restart Julia for some WinRPM packages to work.") + catch err + buf = PipeBuffer() + showerror(buf, err) + warn("Could not update Julia's gcc dlls, some WinRPM packages may not work.\n" * + "Error was: $(readall(buf))\n" * + "Try running Julia as administrator and calling `Pkg.build(\"WinRPM\")`.") + end + end +end From 0eb838fd7e5b0b0f00aeb1977e735e07a413dd1d Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Tue, 24 Jan 2017 21:10:50 -0800 Subject: [PATCH 2/8] fix windows_only and ASCIIString deprecations --- deps/build.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index 314592d..b5facbb 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,13 +1,13 @@ -using WinRPM, SHA +using WinRPM, SHA, Compat WinRPM.update() # update julia's gcc dlls -@windows_only begin +if is_windows() winrpm_bin = joinpath(WinRPM.installdir, "usr", Sys.MACHINE, "sys-root", "mingw", "bin") dlls = ["libgfortran-3", "libquadmath-0", "libstdc++-6", "libssp-0", WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] - dlls_to_download = ASCIIString[] + dlls_to_download = Compat.String[] for lib in dlls if !isfile(joinpath(winrpm_bin, lib * ".dll")) push!(dlls_to_download, replace(lib, "-", "")) @@ -22,7 +22,7 @@ WinRPM.update() if !isempty(dlls_to_download) WinRPM.install(dlls_to_download; yes = true) end - dlls_to_update = ASCIIString[] + dlls_to_update = Compat.String[] for lib in dlls local sha_current, sha_new open(joinpath(JULIA_HOME, lib * ".dll")) do f From d95af594f3fa22a8a5d1ad8af3f39ba40f4f48c7 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Tue, 24 Jan 2017 21:12:44 -0800 Subject: [PATCH 3/8] Add libwinpthread-1 to dll replacement --- deps/build.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index b5facbb..dc292e8 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -5,8 +5,8 @@ WinRPM.update() if is_windows() winrpm_bin = joinpath(WinRPM.installdir, "usr", Sys.MACHINE, "sys-root", "mingw", "bin") - dlls = ["libgfortran-3", "libquadmath-0", "libstdc++-6", "libssp-0", - WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] + dlls = ["libgfortran-3", "libquadmath-0", "libstdc++-6", "libwinpthread-1", + "libssp-0", WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] dlls_to_download = Compat.String[] for lib in dlls if !isfile(joinpath(winrpm_bin, lib * ".dll")) From 83313aeeb94588dc591d945ab89cfa9bf61a6092 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Mon, 30 Jan 2017 19:31:52 -0800 Subject: [PATCH 4/8] account for the possibility that winpthread-1.dll doesn't exist yet --- deps/build.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index dc292e8..ee28921 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -25,8 +25,12 @@ if is_windows() dlls_to_update = Compat.String[] for lib in dlls local sha_current, sha_new - open(joinpath(JULIA_HOME, lib * ".dll")) do f - sha_current = sha256(f) + if isfile(joinpath(JULIA_HOME, lib * ".dll")) + open(joinpath(JULIA_HOME, lib * ".dll")) do f + sha_current = sha256(f) + end + else + sha_current = UInt8[] end open(joinpath(winrpm_bin, lib * ".dll")) do f sha_new = sha256(f) From ae4f56c8a45fcc71856b48ca1cd6773cfd8c355f Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sat, 5 Aug 2017 05:29:43 -0700 Subject: [PATCH 5/8] libgfortran-4, readstring instead of readall --- deps/build.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index ee28921..04b3a0f 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -5,7 +5,7 @@ WinRPM.update() if is_windows() winrpm_bin = joinpath(WinRPM.installdir, "usr", Sys.MACHINE, "sys-root", "mingw", "bin") - dlls = ["libgfortran-3", "libquadmath-0", "libstdc++-6", "libwinpthread-1", + dlls = ["libgfortran-4", "libquadmath-0", "libstdc++-6", "libwinpthread-1", "libssp-0", WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] dlls_to_download = Compat.String[] for lib in dlls @@ -52,7 +52,7 @@ if is_windows() buf = PipeBuffer() showerror(buf, err) warn("Could not update Julia's gcc dlls, some WinRPM packages may not work.\n" * - "Error was: $(readall(buf))\n" * + "Error was: $(readstring(buf))\n" * "Try running Julia as administrator and calling `Pkg.build(\"WinRPM\")`.") end end From 8a78f47421c9ab912cc192c85a3c89161290a0aa Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sat, 5 Aug 2017 05:31:32 -0700 Subject: [PATCH 6/8] don't need to copy nonexistent files --- deps/build.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deps/build.jl b/deps/build.jl index 04b3a0f..baa9c48 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -44,7 +44,9 @@ if is_windows() for lib in dlls_to_update # it's possible to move an in-use dll and put a new file where # it used to be, but not delete or overwrite it in-place? - mv(joinpath(JULIA_HOME, lib * ".dll"), joinpath(JULIA_HOME, lib * "-copy.dll")) + if isfile(joinpath(JULIA_HOME, lib * ".dll")) + mv(joinpath(JULIA_HOME, lib * ".dll"), joinpath(JULIA_HOME, lib * "-copy.dll")) + end cp(joinpath(winrpm_bin, lib * ".dll"), joinpath(JULIA_HOME, lib * ".dll")) end warn("Updated Julia's gcc dlls, you may need to restart Julia for some WinRPM packages to work.") From 94fc365ce327ab3dee4104963daac7f55a0442ed Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sat, 5 Aug 2017 05:51:47 -0700 Subject: [PATCH 7/8] use Compat.SYS.WORD_SIZE --- deps/build.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/build.jl b/deps/build.jl index baa9c48..e120a0b 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -6,7 +6,7 @@ if is_windows() winrpm_bin = joinpath(WinRPM.installdir, "usr", Sys.MACHINE, "sys-root", "mingw", "bin") dlls = ["libgfortran-4", "libquadmath-0", "libstdc++-6", "libwinpthread-1", - "libssp-0", WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] + "libssp-0", Compat.Sys.WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] dlls_to_download = Compat.String[] for lib in dlls if !isfile(joinpath(winrpm_bin, lib * ".dll")) From 978ef66426897f353bed7a50101e05662a1ef889 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sat, 5 Aug 2017 06:34:59 -0700 Subject: [PATCH 8/8] just Sys.WORD_SIZE, does that work? --- deps/build.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/build.jl b/deps/build.jl index e120a0b..29bff00 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -6,7 +6,7 @@ if is_windows() winrpm_bin = joinpath(WinRPM.installdir, "usr", Sys.MACHINE, "sys-root", "mingw", "bin") dlls = ["libgfortran-4", "libquadmath-0", "libstdc++-6", "libwinpthread-1", - "libssp-0", Compat.Sys.WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] + "libssp-0", Sys.WORD_SIZE==32 ? "libgcc_s_sjlj-1" : "libgcc_s_seh-1"] dlls_to_download = Compat.String[] for lib in dlls if !isfile(joinpath(winrpm_bin, lib * ".dll"))