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

GDAL build/installation error on Windows 10 64-bit #55

Closed
jstew99 opened this issue Sep 7, 2018 · 5 comments
Closed

GDAL build/installation error on Windows 10 64-bit #55

jstew99 opened this issue Sep 7, 2018 · 5 comments

Comments

@jstew99
Copy link

jstew99 commented Sep 7, 2018

Added GDAL, but trying to use/build it produced error messages:
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .julia\packages\GDAL\vec6Y\deps\usr\bin\libz.dll
ERROR: Can not create symbolic link : A required privilege is not held by the client. : .julia\packages\GDAL\vec6Y\deps\usr\bin\libz-1.dll

Saw threads on github that recommended using CodecZlib.jl instead of Libz.jl, so downloaded that. Saw that sourcebuild function at end of CodecZlib package's build file (.julia\packages\CodecZlib\wwgbh\deps\build.jl) contained "simple source build fallback for platforms not supported by BinaryBuilder." Circumvented GDAL installation errors by substituting that code for "Install unsatisfied or updated dependencies" code at end of GDAL build files. Recommend updating GDAL build files to use "simple source build fallback" code.

#############################################################################

Code that DOES NOT work

Included at end of GDAL build files:

.julia\packages\GDAL\vec6Y\deps\build_GEOS.v3.6.2.jl

.julia\packages\GDAL\vec6Y\deps\build_PROJ.v4.9.3.jl

.julia\packages\GDAL\vec6Y\deps\build_Zlib.v1.2.11.jl

#############################################################################

Install unsatisfied or updated dependencies:

unsatisfied = any(!satisfied(p; verbose=verbose) for p in products)
if haskey(download_info, platform_key())
url, tarball_hash = download_info[platform_key()]
if unsatisfied || !isinstalled(url, tarball_hash; prefix=prefix)
# Download and install binaries
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
end
elseif unsatisfied
# If we don't have a BinaryProvider-compatible .tar.gz to download, complain.
# Alternatively, you could attempt to install from a separate provider,
# build from source or something even more ambitious here.
error("Your platform $(triplet(platform_key())) is not supported by this package!")
end

Write out a deps.jl file that will contain mappings for our products

write_deps_file(joinpath(@DIR, "deps.jl"), products)

#############################################################################

Code that works

Extracted from end of .julia\packages\CodecZlib\wwgbh\deps\build.jl

#############################################################################

A simple source build fallback for platforms not supported by BinaryBuilder

Assumes that tar, GNU make, and a C compiler are available

function sourcebuild()
srcdir = joinpath(@DIR, "src")
libdir = joinpath(@DIR, "lib")
z = "zlib-1.2.11"
for d = [srcdir, libdir]
isdir(d) && rm(d, force=true, recursive=true)
mkpath(d)
end
download("https://zlib.net/$(z).tar.gz", joinpath(srcdir, "$(z).tar.gz"))
cd(srcdir) do
run(tar xzf $(z).tar.gz)
end
cd(joinpath(srcdir, z)) do
run(./configure --prefix=.)
make = Sys.isbsd() ? gmake : make
run($make -j$(Sys.CPU_CORES))
end
found = false
for f in readdir(joinpath(srcdir, z))
if startswith(f, "libz." * Libdl.dlext)
found = true
cp(joinpath(srcdir, z, f), joinpath(libdir, f), force=true)
end
end
found || error("zlib was unable to build properly")
libz = joinpath(libdir, "libz." * Libdl.dlext)
open(joinpath(@DIR, "deps.jl"), "w") do io
println(io, """
function check_deps()
ptr = Libdl.dlopen_e("$libz")
loaded = ptr != C_NULL
Libdl.dlclose(ptr)
if !loaded
error("Unable to load zlib from $libz. Please rerun " *
"Pkg.build(\\"CodecZlib\\") and restart Julia.")
end
end
const libz = "$libz"
""")
end
end

dobuild = try
key = platform_key() # This can error on older BinaryProvider versions (<=0.2.5)
isdefined(BinaryProvider, :UnknownPlatform) && key == UnknownPlatform()
catch
true
end

if dobuild
sourcebuild()
elseif any(!satisfied(p; verbose=verbose) for p in products)
# Check to see if we're all satisfied
if haskey(download_info, platform_key())
# Download and install binaries
url, tarball_hash = download_info[platform_key()]
install(url, tarball_hash; prefix=prefix, force=true, verbose=verbose)
end
end

Write out a deps.jl file that will contain mappings for our products

This is already done if we've built from source

dobuild || write_deps_file(joinpath(@DIR, "deps.jl"), products)

@visr
Copy link
Member

visr commented Sep 8, 2018

It seems the issue here is that the zlib build we are using in GDALBuilder wants to create symlinks, which on Windows requires admin rights.

General issue is discussed here:
JuliaPackaging/BinaryProvider.jl#86

Specifically for ZlibBuilder there is this issue:
JuliaIO/CodecZlib.jl#24

Which is fixed in the latest release:
https://github.com/bicycle1885/ZlibBuilder/releases/tag/v1.0.2

So we should switch GDALBuilder to use that version instead. Hopefully that is enough, could be that symlinks are created elsewhere as well.

Welcome to GitHub by the way! As you might have seen from your post, it applies formatting to your code, see https://help.github.com/articles/basic-writing-and-formatting-syntax/ for how to handle that.

@visr
Copy link
Member

visr commented Sep 9, 2018

Does

pkg > add Proj4

work for you? Otherwise the PROJBuilder also needs updating.

visr added a commit that referenced this issue Sep 9, 2018
should help with #55

Since the zlib version is still the same, it shouldn't matter that GDALBuilder itself is still using ZlibBuilder v1.0.1 during the build.
@visr
Copy link
Member

visr commented Sep 9, 2018

@jstew99 could you also try

pkg > add GDAL#no-symlinks

and let me know if that works for you?

visr added a commit that referenced this issue Sep 12, 2018
should help with #55

Since the zlib version is still the same, it shouldn't matter that GDALBuilder itself is still using ZlibBuilder v1.0.1 during the build.
@visr
Copy link
Member

visr commented Sep 12, 2018

Closing since I merged #56 to master. If it doesn't work without admin rights do let me know.

@visr visr closed this as completed Sep 12, 2018
@felixcremer
Copy link
Member

For me this still fails, because there is no new version tagged after this change and on master I run into JuliaGeo/Proj.jl#21

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

No branches or pull requests

3 participants