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

Use Compat.Sys.BINDIR so that BinDeps can work with system images #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/BinDeps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ module BinDeps

using Compat

if VERSION >= v"0.7.0-DEV.3073"
const _HOME = Sys.BINDIR
else
const _HOME = JULIA_HOME
end

if VERSION >= v"0.7.0-DEV.3382"
using Libdl
end


export @build_steps, find_library, download_cmd, unpack_cmd,
Choice, Choices, CCompile, FileDownloader, FileRule,
ChangeDirectory, FileUnpacker, prepare_src,
Expand Down Expand Up @@ -122,9 +118,9 @@ if Sys.KERNEL == :FreeBSD
end

if Compat.Sys.iswindows()
const exe7z = joinpath(_HOME, "7z.exe")
Copy link
Contributor

Choose a reason for hiding this comment

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

it's possible other packages may have been referring to this constant

Copy link
Author

Choose a reason for hiding this comment

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

I really hope not since this would only existing on windows. I could undo this without causing problems for us, but I'm pretty sure creating system images on windows won't work correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

creating system images on windows won't work correctly

Why's that? What is this fixing anyway?

Copy link
Author

@rofinn rofinn Mar 27, 2018

Choose a reason for hiding this comment

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

The issue is that JULIA_HOME (or I guess now Sys.BINDIR) doesn't exist at system image build time, which will cause functions that depend on the compiled constant to fail at runtime. Since I don't use windows I'm not particularly bothered by leaving this in the windows if block, but this could cause problems for windows user who want to make system images.


function unpack_cmd(file,directory,extension,secondary_extension)
exe7z = joinpath(Compat.Sys.BINDIR, "7z.exe")

if ((extension == ".Z" || extension == ".gz" || extension == ".xz" || extension == ".bz2") &&
secondary_extension == ".tar") || extension == ".tgz" || extension == ".tbz"
return pipeline(`$exe7z x $file -y -so`, `$exe7z x -si -y -ttar -o$directory`)
Expand Down