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

libgdal not defined on linux machine Julia 1.1.0 #61

Closed
kharazity opened this issue Feb 1, 2019 · 30 comments
Closed

libgdal not defined on linux machine Julia 1.1.0 #61

kharazity opened this issue Feb 1, 2019 · 30 comments

Comments

@kharazity
Copy link

Hi all. I'm using Julia 1.1.0 on a Linux machine. I am installing a package which has GDAL as a dependency. I've been trying to get GDAL to work, but when I run ] test GDAL I get; ERROR: LoadError: InitError: UndefVarError: libgdal not defined . I also get the warning that platform_key() has been deprecated when I try to ]build GDAL in the REPL. Is there reason for this error. I installed Julia 1.1.0 from tarball with and without deps and still seem to get this error. Any help would be appreciated.

@visr
Copy link
Member

visr commented Feb 2, 2019

Which package were you installing that has GDAL.jl as a dependency? I'd like to try to reproduce. Normally speaking if you add another package, it will also add and automatically build GDAL.jl. The libgdal not defined error comes if build GDAL is not run.

The platform_key deprecation warning should be harmless, and will be fixed once we get a newer build from GDALBuilder working. Other than this you didn't get any errors on build GDAL?

@kharazity
Copy link
Author

Sorry, I was afk all weekend. Uhh, it's a package our team built, and it's proprietary, so I can't really share it. I did not experience this issue in mac OS julia 1.0 or 1.1, but when I built on a linux node I experienced this issue.

@visr
Copy link
Member

visr commented Feb 4, 2019

Ok, no need to share the package, all I am looking for is a way to reproduce your situation. Do you have some steps that we can reproduce to determine if this is an issue with GDAL.jl? Right now it looks to me that the required packages were just not installed correctly. Perhaps you did dev GDAL, which will not automatically call build GDAL, or something similar?

If you just have a julia script with using GDAL, then you first need to make sure you add GDAL:

pkg> add GDAL

This will download GDAL.jl and build it as well. If it is used indirectly by another package, this should be done automatically by the package manager as long as GDAL.jl is correctly listed as a dependency.

@kharazity
Copy link
Author

kharazity commented Feb 4, 2019

Right, I'll explain what I did, I'm working on a remote Linux node on an HPC.

So I downloaded the julia 1.1 tarball (I've downloaded with and without dependencies and get the same results) locally and scp'd it into the node. I then make julia 1.1 and then install. Then, I set the julia project to the package directory that we made. Then, in the package manager REPL, I ]instantiate and ]build. It fails to build because of the above issue. Then I went and did some extra experimenting. I exited julia 1.1 and started it again, but without use of the current project, and try ]add GDAL, which seems to work, but when I execute using GDAL I get the error: WARNING: could not import GDAL.libgdal into C ERROR: InitError: UndefVarError: libgdal not defined Then, I tried ]test GDAL which gives a bit more detail as described above.

@kharazity
Copy link
Author

kharazity commented Feb 4, 2019

Upon further inspection, after I ]rm GDAL and retry ]add GDAL I can run using GDAL but it still fails when I try ]test GDAL. Here's an attached picture of the REPL.
screen shot 2019-02-04 at 10 08 23 am

@visr
Copy link
Member

visr commented Feb 4, 2019

And does it work if you build GDAL? You can build GDAL --verbose to get more information.

In the screenshot I see that on add GDAL it doesn't build. If it is the first time you add a package it will call build as well, but note that rm GDAL doesn't actually remove the package and build (just marks it as unused, such that the package manager can clean it up on gc, so if you rm then add it just picks up the same installation again.

(v1.1) pkg> add GDAL
  Updating registry at `C:\Users\visser_mn\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed GDAL ─ v0.2.0
  Updating `C:\Users\visser_mn\.julia\environments\v1.1\Project.toml`
 [no changes]
  Updating `C:\Users\visser_mn\.julia\environments\v1.1\Manifest.toml`
 [no changes]
  Building GDAL → `C:\Users\visser_mn\.julia\packages\GDAL\vec6Y\deps\build.log`

(v1.1) pkg> test GDAL
   Testing GDAL
    Status `C:\Users\VISSER~1\AppData\Local\Temp\jl_2ADE.tmp\Manifest.toml`
  [b99e7846] BinaryProvider v0.5.3
  [add2ef01] GDAL v0.2.0
  [2a0f44e3] Base64  [`@stdlib/Base64`]
  [ade2ca70] Dates  [`@stdlib/Dates`]
  [8ba89e20] Distributed  [`@stdlib/Distributed`]
  [b77e0a4c] InteractiveUtils  [`@stdlib/InteractiveUtils`]
  [76f85450] LibGit2  [`@stdlib/LibGit2`]
  [8f399da3] Libdl  [`@stdlib/Libdl`]
  [56ddb016] Logging  [`@stdlib/Logging`]
  [d6f4376e] Markdown  [`@stdlib/Markdown`]
  [44cfe95a] Pkg  [`@stdlib/Pkg`]
  [de0858da] Printf  [`@stdlib/Printf`]
  [3fa0cd96] REPL  [`@stdlib/REPL`]
  [9a3f8284] Random  [`@stdlib/Random`]
  [ea8e919c] SHA  [`@stdlib/SHA`]
  [9e88b42a] Serialization  [`@stdlib/Serialization`]
  [6462fe0b] Sockets  [`@stdlib/Sockets`]
  [8dfed614] Test  [`@stdlib/Test`]
  [cf7118a7] UUIDs  [`@stdlib/UUIDs`]
  [4ec0a83e] Unicode  [`@stdlib/Unicode`]
┌ Info: GDAL 2.2.4, released 2018/03/19
│ 164 GDAL drivers found
└ 51 OGR drivers found
   Testing GDAL tests passed

Also what is the output of versioninfo() on the cluster? It could be that the architecture is not one of the supported ones here: https://github.com/JuliaGeo/GDAL.jl/blob/v0.2.0/deps/build.jl#L35-L42

@kharazity
Copy link
Author

kharazity commented Feb 4, 2019

Ok, got it. Doesn't build. versioninfo() gives:

Julia Version 1.1.0
Commit 80516ca (2019-01-21 21:24 UTC)
Platform Info:
OS: Linux (x86_64-redhat-linux)
CPU: Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, haswell)

@visr
Copy link
Member

visr commented Feb 4, 2019

Your x86_64 linux should work fine and is also tested, so that shouldn't be the problem.

Could you try removing your entire .julia\packages\GDAL\ and then do

(v1.1) pkg> add GDAL
 Resolving package versions...
 Installed GDAL ─ v0.2.0
  Updating `C:\Users\visser_mn\.julia\environments\v1.1\Project.toml`
 [no changes]
  Updating `C:\Users\visser_mn\.julia\environments\v1.1\Manifest.toml`
 [no changes]
  Building GDAL → `C:\Users\visser_mn\.julia\packages\GDAL\vec6Y\deps\build.log`

And then post the entire contents of the linked build.log? For me after doing this it looks like this:

┌ Warning: platform_key() is deprecated, use platform_key_abi() from now on
│   caller = ip:0x0
└ @ Core :-1
[ Info: Downloading https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.1/Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz to C:\Users\visser_mn\.julia\packages\GDAL\vec6Y\deps\usr\downloads\Zlib.v1.2.11.x86_64-w64-mingw32.tar.gz...
[ Info: Downloading https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3/GEOS.v3.6.2.x86_64-w64-mingw32.tar.gz to C:\Users\visser_mn\.julia\packages\GDAL\vec6Y\deps\usr\downloads\GEOS.v3.6.2.x86_64-w64-mingw32.tar.gz...
[ Info: Downloading https://github.com/JuliaGeo/PROJBuilder/releases/download/v4.9.3-3/PROJ.v4.9.3.x86_64-w64-mingw32.tar.gz to C:\Users\visser_mn\.julia\packages\GDAL\vec6Y\deps\usr\downloads\PROJ.v4.9.3.x86_64-w64-mingw32.tar.gz...
┌ Warning: Could not extract the platform key of https://github.com/JuliaGeo/GDALBuilder/releases/download/v2.2.4-1/GDAL.x86_64-w64-mingw32.tar.gz; continuing...
└ @ BinaryProvider C:\Users\visser_mn\.julia\packages\BinaryProvider\4F5Hq\src\Prefix.jl:185
[ Info: Downloading https://github.com/JuliaGeo/GDALBuilder/releases/download/v2.2.4-1/GDAL.x86_64-w64-mingw32.tar.gz to C:\Users\visser_mn\.julia\packages\GDAL\vec6Y\deps\usr\downloads\GDAL.x86_64-w64-mingw32.tar.gz...

And afterwards test GDAL runs fine and returns what I posted above.

@kharazity
Copy link
Author

kharazity commented Feb 4, 2019

Yeah, I removed GDAL and then added it. Still having a problem.

(v1.1) pkg> add GDAL
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed GDAL ─ v0.2.0
  Updating `~/.julia/environments/v1.1/Project.toml`
 [no changes]
  Updating `~/.julia/environments/v1.1/Manifest.toml`
 [no changes]
  Building GDAL → `~/.julia/packages/GDAL/vec6Y/deps/build.log`
┌ Error: Error building `GDAL`: 
[12:20:54] ######################################################################## 100.0%
┌ Warning: platform_key() is deprecated, use platform_key_abi() from now on          56.3%
│ │   caller = ip:0x0
│ └ @ Core :-1
│ [ Info: Downloading https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.1/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz to /home/6tk/.julia/packages/GDAL/vec6Y/deps/usr/downloads/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz...
│ [ Info: Downloading https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz to /home/6tk/.julia/packages/GDAL/vec6Y/deps/usr/downloads/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz...
│ ERROR: LoadError: LoadError: LibraryProduct(nothing, ["libgeos_c"], :libgeos, "Prefix(/home/6tk/.julia/packages/GDAL/vec6Y/deps/usr)") is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] #write_deps_file#152(::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/6tk/.julia/packages/BinaryProvider/4F5Hq/src/Products.jl:414
│  [3] write_deps_file(::String, ::Array{LibraryProduct,1}) at /home/6tk/.julia/packages/BinaryProvider/4F5Hq/src/Products.jl:395
│  [4] top-level scope at none:0
│  [5] include at ./boot.jl:326 [inlined]
│  [6] include_relative(::Module, ::String) at ./loading.jl:1038
│  [7] include(::Module, ::String) at ./sysimg.jl:29
│  [8] include(::String) at ./client.jl:403
│  [9] top-level scope at none:0
│  [10] eval(::Module, ::Any) at ./boot.jl:328
│  [11] top-level scope at /home/6tk/.julia/packages/GDAL/vec6Y/deps/build.jl:15
│  [12] include at ./boot.jl:326 [inlined]
│  [13] include_relative(::Module, ::String) at ./loading.jl:1038
│  [14] include(::Module, ::String) at ./sysimg.jl:29
│  [15] include(::String) at ./client.jl:403
│  [16] top-level scope at none:0
│ in expression starting at /home/6tk/.julia/packages/GDAL/vec6Y/deps/build_GEOS.v3.6.2.jl:42
│ in expression starting at /home/6tk/.julia/packages/GDAL/vec6Y/deps/build.jl:11
[12:21:05] ######################################################################## 100.0%3%
└ @ Pkg.Operations ~/julia/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075

(v1.1) pkg> test GDAL
   Testing GDAL
    Status `/tmp/tmplGBkYW/Manifest.toml`
  [b99e7846] BinaryProvider v0.5.3
  [add2ef01] GDAL v0.2.0
  [2a0f44e3] Base64  [`@stdlib/Base64`]
  [ade2ca70] Dates  [`@stdlib/Dates`]
  [8ba89e20] Distributed  [`@stdlib/Distributed`]
  [b77e0a4c] InteractiveUtils  [`@stdlib/InteractiveUtils`]
  [76f85450] LibGit2  [`@stdlib/LibGit2`]
  [8f399da3] Libdl  [`@stdlib/Libdl`]
  [56ddb016] Logging  [`@stdlib/Logging`]
  [d6f4376e] Markdown  [`@stdlib/Markdown`]
  [44cfe95a] Pkg  [`@stdlib/Pkg`]
  [de0858da] Printf  [`@stdlib/Printf`]
  [3fa0cd96] REPL  [`@stdlib/REPL`]
  [9a3f8284] Random  [`@stdlib/Random`]
  [ea8e919c] SHA  [`@stdlib/SHA`]
  [9e88b42a] Serialization  [`@stdlib/Serialization`]
  [6462fe0b] Sockets  [`@stdlib/Sockets`]
  [8dfed614] Test  [`@stdlib/Test`]
  [cf7118a7] UUIDs  [`@stdlib/UUIDs`]
  [4ec0a83e] Unicode  [`@stdlib/Unicode`]
WARNING: could not import GDAL.libgdal into C
ERROR: LoadError: InitError: UndefVarError: libgdal not defined
Stacktrace:
 [1] CPLSetErrorHandler at /home/6tk/.julia/packages/GDAL/vec6Y/src/C/cpl_error.jl:160 [inlined]
 [2] __init__() at /home/6tk/.julia/packages/GDAL/vec6Y/src/GDAL.jl:55
 [3] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:633
 [4] _require_from_serialized(::String) at ./loading.jl:684
 [5] _require(::Base.PkgId) at ./loading.jl:967
 [6] require(::Base.PkgId) at ./loading.jl:858
 [7] require(::Module, ::Symbol) at ./loading.jl:853
 [8] include at ./boot.jl:326 [inlined]
 [9] include_relative(::Module, ::String) at ./loading.jl:1038
 [10] include(::Module, ::String) at ./sysimg.jl:29
 [11] include(::String) at ./client.jl:403
 [12] top-level scope at none:0
during initialization of module GDAL
in expression starting at /home/6tk/.julia/packages/GDAL/vec6Y/test/runtests.jl:1
ERROR: Package GDAL errored during testing


@visr
Copy link
Member

visr commented Feb 4, 2019

Aha now at least we have the error:

│ [ Info: Downloading https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.1/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz to /home/6tk/.julia/packages/GDAL/vec6Y/deps/usr/downloads/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz...
│ [ Info: Downloading https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz to /home/6tk/.julia/packages/GDAL/vec6Y/deps/usr/downloads/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz...
│ ERROR: LoadError: LoadError: LibraryProduct(nothing, ["libgeos_c"], :libgeos, "Prefix(/home/6tk/.julia/packages/GDAL/vec6Y/deps/usr)") is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] #write_deps_file#152(::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /home/6tk/.julia/packages/BinaryProvider/4F5Hq/src/Products.jl:414
│  [3] write_deps_file(::String, ::Array{LibraryProduct,1}) at /home/6tk/.julia/packages/BinaryProvider/4F5Hq/src/Products.jl:395

So it downloaded the GEOS tarball from GEOSBuilder, but then it couldn't find/satisfy the libgeos_c shared library inside? That is odd, because the tarball is there and it has that shared library inside.

Do you always get this as the error? Could you check if you see that shared library, and if it is there, if you can dlopen it? Did you by any chance already load another library that could interfere?

@kharazity
Copy link
Author

Ok, so inside .julia/packages/GDAL/deps/usr/include there are a few references to a "libgeos_c". In lib there is: libgeos_c.la, libgeos_c.so.1. There is also the following path to another file that might be of interest: ./logs/update_linkage_libgeos_c.so.1.10.2_libgeos-3.6.2.so.log.

So, I couldn't imagine that another package could be the problem, I went ahead and removed all other packages manually from package list, including GDAL. And ran add GDAL and the same errors persist. So I was working in an empty environment and I still got the libgeos_c error.

@visr
Copy link
Member

visr commented Feb 4, 2019

Could you try going in the usr\lib folder and doing:

using Libdl
dlopen("libgeos_c")

@kharazity
Copy link
Author

Sure:

julia> cd("/home/6tk/.julia/packages/GDAL/vec6Y/deps/usr/lib/")

julia> pwd()
"/home/6tk/.julia/packages/GDAL/vec6Y/deps/usr/lib"

julia> using Libdl

julia> dlopen("libgeos_c")
ERROR: could not load library "libgeos_c"
libgeos_c.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] #dlopen#3(::Bool, ::Function, ::String, ::UInt32) at /home/6tk/julia/usr/share/julia/stdlib/v1.1/Libdl/src/Libdl.jl:109
 [2] dlopen at /home/6tk/julia/usr/share/julia/stdlib/v1.1/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] top-level scope at none:0

@visr
Copy link
Member

visr commented Feb 4, 2019

Huh odd, I'd expect that file to be there.
If I download the tarball that your logs show you are downloading: https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz

I see in the lib dir all of these files, do you have the same ones?

libgeos_c.so.1.10.2
libgeos_c.a
libgeos_c.la
libgeos_c.so
libgeos_c.so.1
libgeos.a
libgeos.la
libgeos.so
libgeos-3.6.2.so

Of those these are symlinks:

libgeos_c.so
libgeos_c.so.1
libgeos.so

But perhaps on your cluster symlinks are not allowed? Which BinaryProvider version is used here? In the latest release I see this was added: JuliaPackaging/BinaryProvider.jl#112

Perhaps you can try setting the environment variable as suggested to BINARYPROVIDER_COPYDEREF=true.

I'd really like to make a new build available, but didn't manage so far: JuliaGeo/GDALBuilder#5 (comment)

@kharazity
Copy link
Author

Yes, I do. I've got:

./lib/libgeos_c.so.1.10.2
./lib/libgeos_c.so
./lib/libgeos.so
./lib/libz.so.1
./lib/libgeos_c.so.1
./lib/libgeos_c.la
./lib/libgeos-3.6.2.so
./lib/libgeos.a
./lib/libgeos.la

and

./logs/update_rpath_libgeos-3.6.2.so.log
./logs/update_linkage_libgeos_c.so.1.10.2_libgeos-3.6.2.so.log

I also set BINARYPROVIDER_COPYDEREF=true in startup.jl, but I don't see any changes.

I'll ask sys admins about symlinks.

@kharazity
Copy link
Author

Also, there doesn't seem to be any issues with the symlinks. The node seems to handle them just fine.

@visr
Copy link
Member

visr commented Feb 7, 2019

Sorry, forgot for a moment you need to be explicit about the path on Linux, this went wrong because it should be dlopen("./libgeos_c"). Would be good to verify that, you should get something like Ptr{Nothing} @0x000000000283bfe0 back.

If this works, the question is, why is BinaryProvider not satisfied here? You should try several versions of BinaryProvider, and if for instance it broke in later versions, it should be reported as an issue in the BinaryProvider repository. I just tried building GDAL using the latest BinaryProvider on CentOS, but had no issues.

@kharazity
Copy link
Author

kharazity commented Feb 7, 2019

Oh... Yeah you're right, duh. I'm not getting the above. I get:

julia> dlopen("./libgeos_c")
ERROR: could not load library "./libgeos_c"
/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./libgeos_c.so)
Stacktrace:
 [1] #dlopen#3(::Bool, ::Function, ::String, ::UInt32) at /home/6tk/julia/usr/share/julia/stdlib/v1.1/Libdl/src/Libdl.jl:109
 [2] dlopen at /home/6tk/julia/usr/share/julia/stdlib/v1.1/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] top-level scope at none:0

What is GLIBCXX? I haven't seen that until now, I believe.

@visr
Copy link
Member

visr commented Feb 7, 2019

GLIBCXX refers to the C++ standard library (libstdc++) that is needed.

I think I get it now. You built julia from source with an old GCC. Can you check the version? I assume it's GCC 4.x.

The BinaryBuilder GDAL build is built with GCC 5.1, and links to a newer libstdc++ than you have available. Since libstdc++ is backwards compatible, newer versions should be ok, but older are not.

To resolve this there are some different options. You could instead of building julia from source, download the generic julia binaries and use those, they come shipped with a newer libstdc++. If you prefer I think you can also just copy the newer libstdc++ into your $JULIA_HOME/lib.

Of course it would be best if this package just works with self built julia. In BinaryBuilder they added a solution to that, where you can compile different binaries for different GCC versions. See JuliaPackaging/BinaryBuilder.jl#230. Though I don't think that's even needed here, because currently BinaryBuilder defaults to GCC 4.8.5 by default, using a libstdc++ version of 3.4.18 (link). So if your GCC is at least 4.8.5 that will work.

All the options that require a new GDAL build are currently stuck on JuliaGeo/GDALBuilder#5 (comment). Hopefully someone can help out there.

Ah and here are some tables with GCC and libstdc++ versions: http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html

@kharazity
Copy link
Author

kharazity commented Feb 8, 2019

Wait, sorry, I spoke prematurely. Uhh, it's still failing in the same spot, even when I run it from the Julia 1.1 provided binary.

@kharazity kharazity reopened this Feb 8, 2019
@visr
Copy link
Member

visr commented Feb 8, 2019

What error exactly do you see? That might give a clue. You also didn't mention yet which GCC version you used to build julia. Having this information will help to validate (or throw out) my theory above.

I'm happy that you reported this issue, such that we can fix it and people in the future will not get stuck on this. It will be extra helpful if you try to use the information and links I provided and go further to try to look for an answer. Truth is I also had to search for most of this information, I'm not an expert at all. So if it doesn't work now, next question that pops up is, which version of libstdc++ is provided in the julia binary? Or can you get your hands on the required version of libstdc++ through other means?

@kharazity
Copy link
Author

I'm using gcc version 4.8.5

@kharazity
Copy link
Author

The error is the same errors as provided above.

@visr
Copy link
Member

visr commented Feb 8, 2019

If it is exactly the same as above:

/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./libgeos_c.so)

That would mean it didn't load the libstdc++ included with the julia binaries, but the one in /lib64/.

@Balinus
Copy link

Balinus commented Dec 12, 2019

Same problem here. Is there a way to manually point to the adequate library?

Not sure what the cause of the problem is since I am able to dlopen the library inside /deps/usr/lib.

i.e.:

julia> using Libdl

julia> dlopen("libgeos_c")
Ptr{Nothing} @0x00000000018c98b0

julia> versioninfo()
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
  OS: Linux (x86_64-redhat-linux)
  CPU: Intel(R) Xeon(R) Gold 6150 CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 16

Trying to load GDAL

julia> using GDAL
[ Info: Recompiling stale cache file /gpfs/home/dl2594/.julia/compiled/v1.2/GDAL/6JYbv.ji for GDAL [add2ef01-049f-52c4-9ee2-e494f65e021a]
WARNING: could not import GDAL.libgdal into C
ERROR: InitError: UndefVarError: libgdal not defined
Stacktrace:
 [1] CPLSetErrorHandler at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/src/C/cpl_error.jl:160 [inlined]
 [2] __init__() at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/src/GDAL.jl:55
 [3] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:685
 [4] _require_from_serialized(::String) at ./loading.jl:736
 [5] _require(::Base.PkgId) at ./loading.jl:1023
 [6] require(::Base.PkgId) at ./loading.jl:911
 [7] require(::Module, ::Symbol) at ./loading.jl:906
during initialization of module GDAL

The content of the directory /deps/usr/lib is:


-rwxr-xr-x 1 dl2594 dl2594 21211256 Jul  6  2018 libgeos-3.6.2.so
-rw-r--r-- 1 dl2594 dl2594 35981394 Jul  6  2018 libgeos.a
-rw-r--r-- 1 dl2594 dl2594  2179594 Jul  6  2018 libgeos_c.a
-rwxr-xr-x 1 dl2594 dl2594     1055 Jul  6  2018 libgeos_c.la
lrwxrwxrwx 1 dl2594 dl2594       19 Jul  6  2018 libgeos_c.so -> libgeos_c.so.1.10.2
lrwxrwxrwx 1 dl2594 dl2594       19 Jul  6  2018 libgeos_c.so.1 -> libgeos_c.so.1.10.2
-rwxr-xr-x 1 dl2594 dl2594  1624576 Jul  6  2018 libgeos_c.so.1.10.2
-rwxr-xr-x 1 dl2594 dl2594     1012 Jul  6  2018 libgeos.la
lrwxrwxrwx 1 dl2594 dl2594       16 Jul  6  2018 libgeos.so -> libgeos-3.6.2.so
-rw-r--r-- 1 dl2594 dl2594   165482 Jun 24  2018 libz.a
lrwxrwxrwx 1 dl2594 dl2594       14 Jun 24  2018 libz.so -> libz.so.1.2.11
lrwxrwxrwx 1 dl2594 dl2594       14 Jun 24  2018 libz.so.1 -> libz.so.1.2.11
-rwxr-xr-x 1 dl2594 dl2594   125680 Jun 24  2018 libz.so.1.2.11
drwxrwxr-x 2 dl2594 dl2594     1024 Jun 24  2018 pkgconfig

I set up in .bashrc:

export BINARYPROVIDER_COPYDEREF=true

The build.log file shows:

[ Info: Downloading https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.1/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz to /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr/downloads/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz...
[ Info: Downloading https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz to /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr/downloads/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz...
ERROR: LoadError: LoadError: LibraryProduct(nothing, ["libgeos_c"], :libgeos, "Prefix(/gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr)") is not satisfied, cannot generate deps.jl!
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] #write_deps_file#134(::Bool, ::typeof(write_deps_file), ::String, ::Array{LibraryProduct,1}) at /gpfs/home/dl2594/.julia/packages/BinaryProvider/ZbFxn/src/Products.jl:393
 [3] write_deps_file(::String, ::Array{LibraryProduct,1}) at /gpfs/home/dl2594/.julia/packages/BinaryProvider/ZbFxn/src/Products.jl:380
 [4] top-level scope at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/build_GEOS.v3.6.2.jl:42
 [5] include at ./boot.jl:328 [inlined]
 [6] include_relative(::Module, ::String) at ./loading.jl:1094
 [7] include(::Module, ::String) at ./Base.jl:31
 [8] include(::String) at ./client.jl:431
 [9] top-level scope at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/build.jl:11
 [10] eval(::Module, ::Any) at ./boot.jl:330
 [11] top-level scope at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/build.jl:15
 [12] include at ./boot.jl:328 [inlined]
 [13] include_relative(::Module, ::String) at ./loading.jl:1094
 [14] include(::Module, ::String) at ./Base.jl:31
 [15] include(::String) at ./client.jl:431
 [16] top-level scope at none:5
in expression starting at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/build_GEOS.v3.6.2.jl:42
in expression starting at /gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/build.jl:11
[14:08:48] --2019-12-12 14:08:47--  https://github.com/bicycle1885/ZlibBuilder/releases/download/v1.0.1/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz
[14:08:48] Resolving github.com (github.com)... 192.30.253.112
[14:08:48] Connecting to github.com (github.com)|192.30.253.112|:443... connected.
[14:08:48] HTTP request sent, awaiting response... 302 Found
[14:08:48] Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/126450947/27973e90-77d4-11e8-9e23-0d26ccb7e41a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191212%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191212T190848Z&X-Amz-Expires=300&X-Amz-Signature=f0ca656f950129033049adcba872861963822f66e1d181d7ac76ba459ff65718&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DZlib.v1.2.11.x86_64-linux-gnu.tar.gz&response-content-type=application%2Foctet-stream [following]
[14:08:48] --2019-12-12 14:08:48--  https://github-production-release-asset-2e65be.s3.amazonaws.com/126450947/27973e90-77d4-11e8-9e23-0d26ccb7e41a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191212%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191212T190848Z&X-Amz-Expires=300&X-Amz-Signature=f0ca656f950129033049adcba872861963822f66e1d181d7ac76ba459ff65718&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DZlib.v1.2.11.x86_64-linux-gnu.tar.gz&response-content-type=application%2Foctet-stream
[14:08:48] Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.11.68
[14:08:48] Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.11.68|:443... connected.
[14:08:48] HTTP request sent, awaiting response... 200 OK
[14:08:48] Length: 163289 (159K) [application/octet-stream]
[14:08:48] Saving to: '/gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr/downloads/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz'
[14:08:48] 
[14:08:49]      0K .......... .......... .......... .......... .......... 31%  277K 0s
[14:08:49]     50K .......... .......... .......... .......... .......... 62%  296K 0s
[14:08:49]    100K .......... .......... .......... .......... .......... 94%  362K 0s
[14:08:49]    150K .........                                             100% 4.89M=0.5s
[14:08:49] 
[14:08:49] 2019-12-12 14:08:49 (326 KB/s) - '/gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr/downloads/Zlib.v1.2.11.x86_64-linux-gnu.tar.gz' saved [163289/163289]
[14:08:49] 
[14:08:49] --2019-12-12 14:08:49--  https://github.com/JuliaGeo/GEOSBuilder/releases/download/v3.6.2-3/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz
[14:08:49] Resolving github.com (github.com)... 192.30.253.112
[14:08:49] Connecting to github.com (github.com)|192.30.253.112|:443... connected.
[14:08:50] HTTP request sent, awaiting response... 302 Found
[14:08:50] Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/126503800/921adf5c-8179-11e8-896f-38fccf0ad09d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191212%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191212T190850Z&X-Amz-Expires=300&X-Amz-Signature=d4a9980881b30b1a200198f098cdc2bf00b7285afeb2cba2fc4df79729dfc50a&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DGEOS.v3.6.2.x86_64-linux-gnu.tar.gz&response-content-type=application%2Foctet-stream [following]
[14:08:50] --2019-12-12 14:08:50--  https://github-production-release-asset-2e65be.s3.amazonaws.com/126503800/921adf5c-8179-11e8-896f-38fccf0ad09d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191212%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191212T190850Z&X-Amz-Expires=300&X-Amz-Signature=d4a9980881b30b1a200198f098cdc2bf00b7285afeb2cba2fc4df79729dfc50a&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DGEOS.v3.6.2.x86_64-linux-gnu.tar.gz&response-content-type=application%2Foctet-stream
[14:08:50] Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.11.68
[14:08:50] Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.11.68|:443... connected.
[14:08:50] HTTP request sent, awaiting response... 200 OK
[14:08:50] Length: 21912922 (21M) [application/octet-stream]
[14:08:50] Saving to: '/gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr/downloads/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz'
[14:08:50] 
[14:08:50]      0K .......... .......... .......... .......... ..........  0%  368K 58s
[14:08:50]     50K .......... .......... .......... .......... ..........  0%  279K 67s
[14:08:50]    100K .......... .......... .......... .......... ..........  0%  543K 58s
[14:08:51]    150K .......... .......... .......... .......... ..........  0%  371K 57s
[14:08:51]    200K .......... .......... .......... .......... ..........  1%  373K 57s
[14:08:51]    250K .......... .......... .......... .......... ..........  1%  549K 54s
[...]
[14:09:00]  21200K .......... .......... .......... .......... .......... 99% 8.13M 0s
[14:09:00]  21250K .......... .......... .......... .......... .......... 99% 22.0M 0s
[14:09:00]  21300K .......... .......... .......... .......... .......... 99% 2.46M 0s
[14:09:00]  21350K .......... .......... .......... .......... ......... 100% 9.89M=9.9s
[14:09:00] 
[14:09:00] 2019-12-12 14:09:00 (2.11 MB/s) - '/gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr/downloads/GEOS.v3.6.2.x86_64-linux-gnu.tar.gz' saved [21912922/21912922]
[14:09:00] 

@visr
Copy link
Member

visr commented Dec 13, 2019

Strange, not sure what is happening there, or why you get

LoadError: LibraryProduct(nothing, ["libgeos_c"], :libgeos, "Prefix(/gpfs/home/dl2594/.julia/packages/GDAL/vec6Y/deps/usr)") is not satisfied, cannot generate deps.jl!

Is using Julia 1.3 an option for you? My aim is to move the install over to the new Artifact system as soon as possible, and given the complexity of the GDAL build, it will be hard to make that work for older Julia releases as well.

Since this is failing on GEOS, you could try installing LibGEOS v0.6.0 on Julia 1.3. That already uses the new system, so will be a good indication if this will help for you.

Is there a way to manually point to the adequate library?

So it seems the provided GDAL is not working well on your system. If you have a separate GDAL installed on your system, you could try pointing it to that by replacing the paths in the deps/deps_*.jl.

@Balinus
Copy link

Balinus commented Dec 13, 2019

ok!
I was able to install LibGEOS on Julia 1.2 (tests passed -- version 0.5.1).

I'll ask the sys admin to install Julia 1.3. This may take some time though as this is a big cluster. If this does not work, I'll ask for a system-wide installation of GDAL and update this thread accordingly.

@Balinus
Copy link

Balinus commented Dec 23, 2019

I think that somehow I was using version 0.2.0. Don't know why. Anyway, I removed some packages this morning and updated my ecosystem and GDAL went from 0.2.0 to 1.0.1 and can now build and test correctly.

I guess I should have verified the module version and not assume it was the latest! :/

edit - It was ArchGDAL that was holding GDAL to 0.2.

@visr
Copy link
Member

visr commented Dec 23, 2019

Ok good to know. We hope to have a new build soon, see JuliaGeo/GDALBuilder#12. That should allow ArchGDAL to use the latest GDAL version again.

@visr
Copy link
Member

visr commented Dec 26, 2019

I think I'll close this issue now that in GDAL.jl 1.0.2 we use the new build of #81. That should fix several build issues. @kharazity if you still have issues with that release, please open a new issue.

@visr visr closed this as completed Dec 26, 2019
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