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

julia 1.8.2-5, 1.9 compile error #1052

Open
benibilme opened this issue Nov 18, 2022 · 28 comments
Open

julia 1.8.2-5, 1.9 compile error #1052

benibilme opened this issue Nov 18, 2022 · 28 comments

Comments

@benibilme
Copy link

benibilme commented Nov 18, 2022

Hello,

I am new to GMT as well as julia.

I have installed julia 1.8.2 in an arch linux environment. I have installed GMT without issues but it gives error during precompilation while using the module.

Following is the error:

julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]
ERROR: LoadError: could not load library "/usr/lib/libgmt.so"
/home/user/opt/julia-1.8.2/bin/../lib/julia/libcurl.so: version `CURL_OPENSSL_4' not found (required by /usr/lib/libgmt.so)
Stacktrace:
 [1] GMT_Create_Session (repeats 2 times)
   @ ~/.julia/packages/GMT/mzT4h/src/libgmt.jl:2 [inlined]
 [2] top-level scope
   @ ~/.julia/packages/GMT/mzT4h/src/get_enums.jl:9
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:419
 [4] include(x::String)
   @ GMT ~/.julia/packages/GMT/mzT4h/src/GMT.jl:1
 [5] top-level scope
   @ ~/.julia/packages/GMT/mzT4h/src/GMT.jl:287
 [6] include
   @ ./Base.jl:419 [inlined]
 [7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base ./loading.jl:1554
 [8] top-level scope
   @ stdin:1
in expression starting at /home/user/.julia/packages/GMT/mzT4h/src/get_enums.jl:9
in expression starting at /home/user/.julia/packages/GMT/mzT4h/src/GMT.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile GMT [5752ebe1-31b9-557e-87aa-f909b540aa54] to /home/user/.julia/compiled/v1.8/GMT/jl_WsZzh7.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:1707
 [3] compilecache
   @ ./loading.jl:1651 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1200
 [6] macro expansion
   @ ./loading.jl:1180 [inlined]
 [7] macro expansion
   @ ./lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144

Any help insight much appreciated.

@joa-quim
Copy link
Member

Oh dear, Linux is soooo painful. So it looks like booth Julia and GMT were linked against incompatible libcurl versions.

See if this is of any help https://askubuntu.com/questions/1211782/curl-openssl-4-not-found-required-by-curl

@benibilme
Copy link
Author

Hello,

Arch wiki states following:

`Note: The julia package is compiled against system libraries and is therefore unsupported by the upstream. While it may be suitable for basic usage it is incompatible with external packages (e.g. MKL, LLVM, LLVMExtra, or packages that depend on these, like CUDA or Flux) which rely on Julia's bundled versions of its dependencies. Bugs reported against this binary will be closed.

Install julia-binAUR. The package provides official builds compiled against patched LLVM libs.`

Because of that, I have downloaded the official julia package from the julia web site which gave above error. I have also tried julia binary which is not officially supported Arch user repository, it gave the same error as well.

I have not understood the solution, should I delete the system libcurl library...

@benibilme
Copy link
Author

benibilme commented Nov 18, 2022

I installed 1.8.3 from julia web site, deleted internal softlink in the installation and linked the system library instead. In this case, julia did not start .

@joa-quim
Copy link
Member

I'm sorry you are suffering this and I'm also sorry of being of little help here (I'm a Windows guy). Post this in the Julia forum. There are Arch Linux users there.

How did you install GMT? Via a package manager?

@benibilme
Copy link
Author

I installed in both ways. By using julia binary tarball from https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.3-linux-x86_64.tar.gz and later by downloading and building from Arch Linux User repository. As stated above, Arch advises not to use official repositories because of julia environment depends on the bundled version of LLVM.

@joa-quim
Copy link
Member

I meant, how did you install GMT (not GMT.jl). Was it the automatic way, which is done via Conda or from the Arch Linux package manager, or even built by yourself?

@benibilme
Copy link
Author

I installed gmt via arc linux package manager from official repositories via pacman. However after your post, I removed it and tried using GMT. Julia tried to install it via conda. However I received following error.

By the way, I also changed the julia installation location to /opt from home directory.

julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]
Base.IOError("could not spawn `gmt --version`: no such file or directory (ENOENT)", -2)
ERROR: LoadError: could not load library "/home/user/.julia/conda/3/lib/libgmt.so"
/opt/dev/julia-1.8.3/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/user/.julia/conda/3/lib/./libgdal.so.31)
Stacktrace:
 [1] GMT_Create_Session (repeats 2 times)
   @ ~/.julia/packages/GMT/mzT4h/src/libgmt.jl:2 [inlined]
 [2] top-level scope
   @ ~/.julia/packages/GMT/mzT4h/src/get_enums.jl:9
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:419
 [4] include(x::String)
   @ GMT ~/.julia/packages/GMT/mzT4h/src/GMT.jl:1
 [5] top-level scope
   @ ~/.julia/packages/GMT/mzT4h/src/GMT.jl:287
 [6] include
   @ ./Base.jl:419 [inlined]
 [7] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base ./loading.jl:1554
 [8] top-level scope
   @ stdin:1
in expression starting at /home/user/.julia/packages/GMT/mzT4h/src/get_enums.jl:9
in expression starting at /home/user/.julia/packages/GMT/mzT4h/src/GMT.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile GMT [5752ebe1-31b9-557e-87aa-f909b540aa54] to /home/toktay/.julia/compiled/v1.8/GMT/jl_3zBdJr.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:1707
 [3] compilecache
   @ ./loading.jl:1651 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1200
 [6] macro expansion
   @ ./loading.jl:1180 [inlined]
 [7] macro expansion
   @ ./lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144

@t-bltg
Copy link

t-bltg commented Nov 19, 2022

/opt/dev/julia-1.8.3/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/user/.julia/conda/3/lib/./libgdal.so.31)

@benibilme, this issue is know (see JuliaLang/julia#34276), use:

$ LD_PRELOAD=$(g++ --print-file-name=libstdc++.so) julia
# or if you know the path to your `libstdc++.so`:
$ LD_PRELOAD=/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so julia  # this is on `ubuntu 22.04`

Can you also try:

julia> ENV["FORCE_INSTALL_GMT"] = 1
julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]
ErrorException("Forcing an automatic GMT install")
Building GMT ── [...]
[...]
julia> GMT.get_GMTver()
Base.IOError("could not spawn `gmt --version`: no such file or directory (ENOENT)", -2)
(v"6.4.0", true, "[...]/conda/lib/libgmt.so", "[...]/conda/lib/./libgdal.so.31", "[...]/conda/lib/././libproj.so.25", "[...]/conda/bin")

@joa-quim
Copy link
Member

joa-quim commented Nov 19, 2022

Yes, as @t-bltg said that is a known issue (it lasts since July (!!)) and although it finally was fixed recently it still not in 1.8.3 (really don't understand this, as if this was a minor issue). But it is fixed in 1.9 dev so I think the easiest is to install that Julia version that just got into the alpha stage.

Edit: But I suspect the libcurl problem can still persist even with the GMT Conda build. The problem seams really be tied to the Julia shipped libcurl.

@benibilme
Copy link
Author

julia> ENV["FORCE_INSTALL_GMT"] = 1
1

julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]
ErrorException("Forcing an automatic GMT install")
ERROR: LoadError: could not load library "/home/user/.julia/conda/3/lib/libgmt.so"
/opt/dev/julia-1.8.3/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/user/.julia/conda/3/lib/./libgdal.so.31)

@t-bltg
Copy link

t-bltg commented Nov 19, 2022

You are not using LD_PRELOAD as explained in #1052 (comment), are you ?

Can you show:

$ LD_PRELOAD=$(g++ --print-file-name=libstdc++.so) julia  # from your arch terminal
julia> using Libdl
julia> foreach(println, Libdl.dllist())
linux-vdso.so.1
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.so  # uses the system `libstdc++.so`, forced by `LD_PRELOAD`
/lib/x86_64-linux-gnu/libdl.so.2
/lib/x86_64-linux-gnu/libpthread.so.0
/lib/x86_64-linux-gnu/libc.so.6
[...]/bin/../lib/libjulia.so.1  # [...] denotes the directory where downloaded `julia` is extracted
/lib/x86_64-linux-gnu/libm.so.6
/lib64/ld-linux-x86-64.so.2
[...]/bin/../lib/julia/libgcc_s.so.1
[...]/bin/../lib/julia/libopenlibm.so
[...]/bin/../lib/julia/libjulia-internal.so.1
[...]/bin/../lib/julia/libunwind.so.8
/lib/x86_64-linux-gnu/librt.so.1
[...]/bin/../lib/julia/libz.so.1
[...]/bin/../lib/julia/libatomic.so.1
[...]/bin/../lib/julia/libjulia-codegen.so.1
[...]/bin/../lib/julia/libLLVM-13jl.so
[...]/lib/julia/sys.so
[...]/bin/../lib/julia/libpcre2-8.so
[...]/bin/../lib/julia/libgmp.so
[...]/bin/../lib/julia/libmpfr.so
[...]/bin/../lib/julia/libopenblas64_.so
[...]/bin/../lib/julia/libgfortran.so.5
[...]/bin/../lib/julia/libquadmath.so.0
[...]/bin/../lib/julia/libblastrampoline.so
[...]/bin/../lib/julia/libcholmod.so
[...]/bin/../lib/julia/libamd.so.2
[...]/bin/../lib/julia/libcolamd.so.2
[...]/bin/../lib/julia/libsuitesparseconfig.so.5
[...]/bin/../lib/julia/libccolamd.so.2
[...]/bin/../lib/julia/libcamd.so.2
[...]/bin/../lib/julia/libnghttp2.so.14
[...]/bin/../lib/julia/libcurl.so  # this is `libcurl` shipped by julia
[...]/bin/../lib/julia/libssh2.so.1
[...]/bin/../lib/julia/libmbedtls.so.14
[...]/bin/../lib/julia/libmbedx509.so.1
[...]/bin/../lib/julia/libmbedcrypto.so.7
julia> using GMT
julia> GMT.get_GMTver()

@benibilme
Copy link
Author

benibilme commented Nov 20, 2022

Sorry about missing what you pointed out. Following sequence, which you suggested, solved the problem. However, I need to preload libstd for each invokation to do using GMT even though ENV["FORCE_INSTALL_GMT"] = 1 is not needed. Yes, while I tried this, gmt from OS package manager was not installed. To be sure, I just cleaned ~/.julia directory where environments, packages are kept before doing below. Of course, after cleaning .julia, I have added GMT via Pkg.add

$  LD_PRELOAD=$(g++ --print-file-name=libstdc++.so)  julia
 julia> ENV["FORCE_INSTALL_GMT"] = 1
1
julia> using GMT
[ Info: Precompiling GMT [5752ebe1-31b9-557e-87aa-f909b540aa54]
ErrorException("Forcing an automatic GMT install")

Below is the additional things that you requested at the above comment.

julia> using Libdl

julia> foreach(println, Libdl.dllist())
linux-vdso.so.1
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/libstdc++.so
/usr/lib/libdl.so.2
/usr/lib/libpthread.so.0
/usr/lib/libc.so.6
/opt/dev/julia-1.8.3/bin/../lib/libjulia.so.1
/usr/lib/libm.so.6
/lib64/ld-linux-x86-64.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libgcc_s.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libopenlibm.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libjulia-internal.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libunwind.so.8
/usr/lib/librt.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libz.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libatomic.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libjulia-codegen.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libLLVM-13jl.so
/opt/dev/julia-1.8.3/lib/julia/sys.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libpcre2-8.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libgmp.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libmpfr.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libopenblas64_.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libgfortran.so.5
/opt/dev/julia-1.8.3/bin/../lib/julia/libquadmath.so.0
/opt/dev/julia-1.8.3/bin/../lib/julia/libblastrampoline.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libcholmod.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libcolamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libsuitesparseconfig.so.5
/opt/dev/julia-1.8.3/bin/../lib/julia/libccolamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libcamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libnghttp2.so.14
/opt/dev/julia-1.8.3/bin/../lib/julia/libcurl.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libssh2.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libmbedtls.so.14
/opt/dev/julia-1.8.3/bin/../lib/julia/libmbedx509.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libmbedcrypto.so.7

julia> using GMT

julia> GMT.get_GMTver()
Base.IOError("could not spawn `gmt --version`: no such file or directory (ENOENT)", -2)
(v"6.4.0", true, "/home/user/.julia/conda/3/lib/libgmt.so", "/home/user/.julia/conda/3/lib/./libgdal.so.31", "/home/user/.julia/conda/3/lib/././libproj.so.25", "/home/user/.julia/conda/3/bin")

I would like to be able to use gmt from console or bash as well. Can't OS gmt and julia install gmt live together?

@t-bltg
Copy link

t-bltg commented Nov 20, 2022

I would like to be able to use gmt from console or bash as well. Can't OS gmt and julia install gmt live together?

Can you run:

$ /home/user/.julia/conda/3/bin/gmt --version

Maybe the path exists at that location, and GMT.jl needs to adjust to the conda one ?

Good news, now that you know libstdc++ is incriminated, you can make the changes a bit more permanent (but still reversible):

$ cd /opt/dev/julia-1.8.3/bin
$ mv julia Julia  # if this fails, you need to prepend commands with `sudo`
$ echo -e '#!/usr/bin/env bash\nLD_PRELOAD='$(g++ --print-file-name=libstdc++.so)' exec '$(pwd)/'Julia "$@"' >julia
$ chmod +x julia
$ ./julia --version
julia version 1.8.3  # <-- should show this if correct

, so now that you run julia it always preloads libstdc++.

You need to use ENV["FORCE_INSTALL_GMT"] = 1 only once if the system gmt is uninstalled.

But now, you can maybe re-install gmt from arch repos an try with the modified julia (which uses libstdc++), it might work and fix the original libcurl issue !

$ ... # reinstall gmt using `pacman` (I guess) on `arch`
$ julia
julia> using Libdl
julia> foreach(println, Libdl.dllist())
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/libstdc++.so  # this is the path you want, please confirm
[...]  # rest truncated
julia> using GMT
julia> GMT.get_GMTver()
# <-- should use system paths, not paths with `conda` in it ...

@benibilme
Copy link
Author

benibilme commented Nov 20, 2022

Hello,

Thank you for the detailed instructions. Before reading your comment, I had done a similar thing to preload the libstdc++ when ever I started julia. I have local ~/sbin directory in my home, which comes before any path in my $PATH. I often use it replace or enhance some system commands for similar cases like this.

I again installed system provided gmt via package manager. Here are the versions.

$ /home/user/.julia/conda/3/bin/gmt --version
6.4.0
$ which gmt
/usr/bin/gmt
$  gmt --version
6.4.0

The list of linked libraries

julia> foreach(println, Libdl.dllist())
linux-vdso.so.1
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../lib/libstdc++.so
/usr/lib/libdl.so.2
/usr/lib/libpthread.so.0
/usr/lib/libc.so.6
/opt/dev/julia-1.8.3/bin/../lib/libjulia.so.1
/usr/lib/libm.so.6
/lib64/ld-linux-x86-64.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libgcc_s.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libopenlibm.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libjulia-internal.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libunwind.so.8
/usr/lib/librt.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libz.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libatomic.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libjulia-codegen.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libLLVM-13jl.so
/opt/dev/julia-1.8.3/lib/julia/sys.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libpcre2-8.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libgmp.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libmpfr.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libopenblas64_.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libgfortran.so.5
/opt/dev/julia-1.8.3/bin/../lib/julia/libquadmath.so.0
/opt/dev/julia-1.8.3/bin/../lib/julia/libblastrampoline.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libcholmod.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libcolamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libsuitesparseconfig.so.5
/opt/dev/julia-1.8.3/bin/../lib/julia/libccolamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libcamd.so.2
/opt/dev/julia-1.8.3/bin/../lib/julia/libnghttp2.so.14
/opt/dev/julia-1.8.3/bin/../lib/julia/libcurl.so
/opt/dev/julia-1.8.3/bin/../lib/julia/libssh2.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libmbedtls.so.14
/opt/dev/julia-1.8.3/bin/../lib/julia/libmbedx509.so.1
/opt/dev/julia-1.8.3/bin/../lib/julia/libmbedcrypto.so.7
/home/user/.julia/conda/3/lib/./libgdal.so.31
/home/user/.julia/conda/3/lib/././libcrypto.so.3
/home/user/.julia/conda/3/lib/././libtiledb.so.2.11
/home/user/.julia/conda/3/lib/././libpoppler.so.125
/home/user/.julia/conda/3/lib/././libjson-c.so.5
/home/user/.julia/conda/3/lib/././libfreexl.so.1
/home/user/.julia/conda/3/lib/././libgeos_c.so.1
/home/user/.julia/conda/3/lib/././libwebp.so.7
/home/user/.julia/conda/3/lib/././libkmlbase.so.1
/home/user/.julia/conda/3/lib/././libkmldom.so.1
/home/user/.julia/conda/3/lib/././libkmlengine.so.1
/home/user/.julia/conda/3/lib/././libkmlxsd.so.1
/home/user/.julia/conda/3/lib/././libkmlregionator.so.1
/home/user/.julia/conda/3/lib/././libexpat.so.1
/home/user/.julia/conda/3/lib/././libxerces-c-3.2.so
/home/user/.julia/conda/3/lib/././libopenjp2.so.7
/home/user/.julia/conda/3/lib/././libnetcdf.so.19
/home/user/.julia/conda/3/lib/././libmfhdf.so.0
/home/user/.julia/conda/3/lib/././libdf.so.0
/home/user/.julia/conda/3/lib/././libgif.so.7
/home/user/.julia/conda/3/lib/././libgeotiff.so.5
/home/user/.julia/conda/3/lib/././libpng16.so.16
/home/user/.julia/conda/3/lib/././libcfitsio.so.9
/home/user/.julia/conda/3/lib/././libpq.so.5
/home/user/.julia/conda/3/lib/././liblz4.so.1
/home/user/.julia/conda/3/lib/././libblosc.so.1
/home/user/.julia/conda/3/lib/././libzstd.so.1
/home/user/.julia/conda/3/lib/././liblzma.so.5
/home/user/.julia/conda/3/lib/././libproj.so.25
/home/user/.julia/conda/3/lib/././libsqlite3.so.0
/home/user/.julia/conda/3/lib/././libtiff.so.5
/home/user/.julia/conda/3/lib/././libjpeg.so.9
/home/user/.julia/conda/3/lib/././libdeflate.so.0
/home/user/.julia/conda/3/lib/././libspatialite.so.7
/home/user/.julia/conda/3/lib/././libLerc.so.4
/home/user/.julia/conda/3/lib/././libiconv.so.2
/home/user/.julia/conda/3/lib/././libxml2.so.2
/home/user/.julia/conda/3/lib/././libkea.so.1.4
/home/user/.julia/conda/3/lib/././libhdf5_cpp.so.200
/home/user/.julia/conda/3/lib/././libhdf5.so.200
/home/user/.julia/conda/3/lib/./././libbz2.so.1.0
/home/user/.julia/conda/3/lib/./././libssl.so.3
/home/user/.julia/conda/3/lib/./././libfreetype.so.6
/home/user/.julia/conda/3/lib/./././libfontconfig.so.1
/home/user/.julia/conda/3/lib/./././liblcms2.so.2
/home/user/.julia/conda/3/lib/./././libnss3.so
/home/user/.julia/conda/3/lib/./././libsmime3.so
/home/user/.julia/conda/3/lib/./././libplc4.so
/home/user/.julia/conda/3/lib/./././libnspr4.so
/home/user/.julia/conda/3/lib/./././libgeos.so.3.11.0
/home/user/.julia/conda/3/lib/./././libminizip.so
/home/user/.julia/conda/3/lib/./././liburiparser.so
/home/user/.julia/conda/3/lib/./././libkmlconvenience.so.1
/home/user/.julia/conda/3/lib/./././libnsl.so.3
/home/user/.julia/conda/3/lib/./././libicui18n.so.70
/home/user/.julia/conda/3/lib/./././libicuuc.so.70
/home/user/.julia/conda/3/lib/./././libicudata.so.70
/home/user/.julia/conda/3/lib/./././libhdf5_hl.so.200
/home/user/.julia/conda/3/lib/./././libzip.so.5
/home/user/.julia/conda/3/lib/./././libgssapi_krb5.so.2
/home/user/.julia/conda/3/lib/./././libsnappy.so.1
/home/user/.julia/conda/3/lib/./././librttopo.so.1
/home/user/.julia/conda/3/lib/./././libcharset.so.1
/home/user/.julia/conda/3/lib/././././libnssutil3.so
/home/user/.julia/conda/3/lib/././././libplds4.so
/home/user/.julia/conda/3/lib/././././libkrb5.so.3
/home/user/.julia/conda/3/lib/././././libk5crypto.so.3
/home/user/.julia/conda/3/lib/././././libcom_err.so.3
/home/user/.julia/conda/3/lib/././././libkrb5support.so.0
/home/user/.julia/conda/3/lib/././././libkeyutils.so.1
/usr/lib/libresolv.so.2
/home/user/.julia/conda/3/lib/libgmt.so
/home/user/.julia/conda/3/lib/./libpcre.so.1
/home/user/.julia/conda/3/lib/./libfftw3f.so.3
/home/user/.julia/conda/3/lib/./libfftw3f_threads.so.3
/home/user/.julia/conda/3/lib/./liblapack.so.3
/home/user/.julia/conda/3/lib/./libpostscriptlight.so.6

GMT version

julia> using GMT
julia> GMT.get_GMTver()
(v"6.4.0", false, "", "", "", "")

As far as I understand, GMT.jl do not install conda version if the system has available GMT installation. Since I preload the system libstdc++, I presume I should be able to use system gmt even if I remove gmt that comes with conda, I suppose.

@t-bltg
Copy link

t-bltg commented Nov 20, 2022

So everything works now ?

As far as I understand, GMT.jl do not install conda version if the system has available GMT installation.

Exactly, it tries first to use a system gmt, and if it fails, try to use a conda based one.

A note to @joa-quim, you might want to set up a Preferences.jl mechanism and maybe drop deps/build.jl. This is the way to go nowadays.

It's strange though that no path is listed in (v"6.4.0", false, "", "", "", "").
==> this is hardcoded, maybe GMT.jl should do something about it.
The false indicates that GMT.jl uses a system gmt.

It this works, you can remove the conda based gmt.

@benibilme
Copy link
Author

I have deleted ~/.julia directory, and going over everthing again to make sure that it is working as expected. Do you think ENV["FORCE_INSTALL_GMT"] = 1 is required even if system gmt is used?

@t-bltg
Copy link

t-bltg commented Nov 20, 2022

No, you shouldn't use it https://github.com/GenericMappingTools/GMT.jl/blob/master/src/GMT.jl#L34, if you use a system one.

Using FORCE_INSTALL_GMT=1 triggers the conda installation.

Please also synchronize the discourse post with your findings / updates, for other arch users.

@benibilme
Copy link
Author

Unfortunately, without conda gmt installed, it does not work, I still get the initial libcurl not found error.

@t-bltg
Copy link

t-bltg commented Nov 20, 2022

That's a pitty. Bad interactions with julia libs and libgmt.so (which should use a system libcurl as ldd showed: /usr/lib/libcurl.so.4).

But since you have /home/user/.julia/conda/3/bin/gmt available, you can use the conda based gmt I guess now ?

@benibilme
Copy link
Author

benibilme commented Nov 20, 2022

I am very much new to GMT, still trying to understand it. I guess, that will do. However, I install many packages which seems some of them are heavyweight packages, Makie etc. I believe they must needing libcurl as well. They all compile without problem. I have not checked my assumption. This is my little script to install or update my usual packages in a new environment. Do you thing other packages use system libcurl? I will check them.

import Pkg

Pkg.gc()
Pkg.update()

packages = [
  "Revise",
  "OhMyREPL",
  "AbstractTrees",
  "IJulia",
  "ArgParse",
  "CSV",
  "DataFrames",
  "DataFramesMeta",
  "Gadfly",
  "Makie",
  "ColorSchemes",
  "GMT",
  "Flux",
  "Knet"
]

for i in packages
  println("Adding $i")
  Pkg.add(i)
end

Pkg.precompile()

@t-bltg
Copy link

t-bltg commented Nov 20, 2022

IDK, I never used GMT, maybe @joa-quim knows more, since he maintains GMT.jl.
Either GMT.jl could be more robust while loading libraries / dependencies, or even provide a GMT_jll artifact.
Or the libraries provided from arch are not up to date / incompatible.

@joa-quim
Copy link
Member

joa-quim commented Nov 20, 2022

Thanks for thePreferences.jl pointer. That is something that I must really address but it's not the cause of current problem. By coincidence I very recently had this discussion in #1049, where it's also explained why a _JLL is a difficult thing to create.

The current case is, for me, a clear case of Julia and system's libraries incompatibilities. And since there was a very recent (October) release of a libcurl new version, my bet is Arch Linux is using a newer one that Julia.
Why other Julia packages do not show this problem? Probably because they have _JLL binaries that were built with the same libcurls as Julia. But this problem sooner or later will surface with another package.

Being true this points into a more general problem with Julia distributing their libraries that may not be in sync with system libraries. The solution would that Julia used those shared libs with different names so a conflict of this nature would never occur, but as you have seen from the tone in the Discourse topic, that is hardly going to happen.

But, so that I understand. The Conda installed GMT works?

(note, I'm going out for lunch in this beautifully sunny day in Algarve (Pt)) so will not reply in the next couple of hours).

@t-bltg
Copy link

t-bltg commented Nov 20, 2022

The current case is, for me, a clear case of Julia and system's libraries incompatibilities.

Yep, the few libraries shipped by julia can conflict, this is unfortunate that gmt hits libcurl.

By coincidence I very recently had this discussion in #1049

Thanks for pointing out #1049 (comment), I see that you already thought of this, and this is a difficult problem considering that gmt is quite old and suffers from legacy practices, and that it doesn't compile with mingw (but you could maybe distribute a GMT_jll only for linux atm, and maybe later for macOS and windows ?).

Thanks for thePreferences.jl pointer

Here some more implementations I've worked with, in case you need them for inspiration:

https://github.com/JuliaParallel/MPI.jl/tree/master/lib/MPIPreferences
https://github.com/jheinen/GR.jl/blob/master/src/preferences.jl

Some Preferences based mechanism for Plots is on the way for backend selection JuliaPlots/Plots.jl#4513.

@joa-quim
Copy link
Member

considering that gmt is quite old and suffers from legacy practices, and that it doesn't compile with mingw (but you could maybe distribute a GMT_jll only for linux atm, and maybe later for macOS and windows ?).

Sorry if I gave a wrong impression. GMT exists for more 30 years but it's code has been modernized along these times and it's build with a modern cmake solution. There is noting of legacy practices in it.

Regarding a GMT_jll for Linux and macOS, yes I've thought on that but the problem is what I referred in the #1049 comment. Current GDAL_jll does not contain netCDF/HDF5 and I don't want provide a GMT artifact crippled of those so important libraries for GDAL access. This has nothing to do with GMT itself but results from the fact currently all the artifact have to built in a cross compile from Linux. All would be much better if BinaryBuilder had a solution to let use native Window builds for Windows artifacts.

Meanwhile I found this page and trying one of the suggested thing in there I get from WSL installation.

nm -D /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so | grep CURL
0000000000000000 A CURL_GNUTLS_3

nm -D ~/.julia/juliaup/julia-1.8.1+0.x64/lib/julia/libcurl.so | grep CURL
0000000000000000 A CURL_4

So Julia's libcurl has CURL_4 (and not CURL_OPENSSL_4) whilst the system's one has CURL_GNUTLS_3 and things still work. What is it that you get @benibilme ?

@joa-quim
Copy link
Member

joa-quim commented Dec 9, 2022

I started to see this on CI test as well. Looks like netcdf and libcurl are out of phase.
https://github.com/GenericMappingTools/GMT.jl/actions/runs/3654301783/jobs/6174594528#step:12:117

@joa-quim
Copy link
Member

Yeap, see my findings in #1113. It's Julia's shipped libcurl that started to error in recent Linux distros.

@benibilme
Copy link
Author

benibilme commented May 11, 2023

Hello,

I would like to report that this problem still persist in my arch/manjaro systems and newly released julia 1.9. I can use GMT.jl only if I use following steps as suggested earlier. GMT is the only package affected and I have pretty hefty packages installed such as Flux, Knet, Makie, Gadfly etc.

  1. uninstall distribution provided gmt package from the system
  2. starting julia environment with LD_PRELOAD=$(g++ --print-file-name=libstdc++.so) julia
  3. in julia environment ENV[FORCE_INSTALL_GMT] = 1
  4. adding the package

I hope, a solution could be found.

@benibilme benibilme changed the title julia 1.8.2 compile error julia 1.8.2-5, 1.9 compile error May 11, 2023
@joa-quim
Copy link
Member

Don't use FORCE_INSTALL_GMT. That's for Windows only when we want to force an GMT (binaries) update.
Since you have your system in a somewhat messed state regarding GMT, this should clear it up:

import Pkg; Pkg.build("GMT")

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