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

Apple Silicon and GMT.jl? #1421

Open
srivatsabprasad opened this issue Apr 23, 2024 · 1 comment
Open

Apple Silicon and GMT.jl? #1421

srivatsabprasad opened this issue Apr 23, 2024 · 1 comment

Comments

@srivatsabprasad
Copy link

Sorry if this has already been resolved elsewhere, but I couldn't find anything relevant on Github, Stackexchange or in the open or closed issues for GMT.jl.

I have a Macbook with Apple Silicon (Mac M1 chip). When I try to install GMT.jl via
] add GMT
the precompilation fails; it gives me the error
ERROR: LoadError: could not load library "/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib" dlopen(/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib, 0x0001): tried: '/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib' (no such file), '/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/Users/sbprasad/.julia/conda/3/lib/libgmt.6.4.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/sbprasad/.julia/conda/3/lib/libgmt.6.4.0.dylib' (no such file), '/Users/sbprasad/.julia/conda/3/lib/libgmt.6.4.0.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) Stacktrace: [1] GMT_Create_Session @ ~/.julia/packages/GMT/1kBBX/src/libgmt.jl:2 [inlined] [2] GMT_Create_Session(tag::String, pad::Int64, mode::Int64) @ GMT ~/.julia/packages/GMT/1kBBX/src/libgmt.jl:2 [3] top-level scope @ ~/.julia/packages/GMT/1kBBX/src/get_enums.jl:9 [4] include(mod::Module, _path::String) @ Base ./Base.jl:495 [5] include(x::String) @ GMT ~/.julia/packages/GMT/1kBBX/src/GMT.jl:1 [6] top-level scope @ ~/.julia/packages/GMT/1kBBX/src/GMT.jl:259 [7] include @ ./Base.jl:495 [inlined] [8] 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, UInt128}}, source::Nothing) @ Base ./loading.jl:2222 [9] top-level scope @ stdin:3 in expression starting at /Users/sbprasad/.julia/packages/GMT/1kBBX/src/get_enums.jl:9 in expression starting at /Users/sbprasad/.julia/packages/GMT/1kBBX/src/GMT.jl:1 in expression starting at stdin:3 ✗ GMT 0 dependencies successfully precompiled in 4 seconds. 21 already precompiled.

I uninstalled and reinstalled GMT on Conda, within Julia, via
using Conda Conda.rm("GMT") Conda.add("GMT")
yet this error persists. If I try to install and precompile GMT.jl without anything installed via Conda, it gives me the error:

Failed to precompile GMT [5752ebe1-31b9-557e-87aa-f909b540aa54] to "/Users/sbprasad/.julia/compiled/v1.10/GMT/jl_c7TPsK". ERROR: LoadError: could not load library "/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib" dlopen(/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib, 0x0001): tried: '/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib' (no such file), '/Users/sbprasad/.julia/conda/3/lib/libgmt.dylib' (no such file) Stacktrace: [1] GMT_Create_Session @ ~/.julia/packages/GMT/1kBBX/src/libgmt.jl:2 [inlined] [2] GMT_Create_Session(tag::String, pad::Int64, mode::Int64) @ GMT ~/.julia/packages/GMT/1kBBX/src/libgmt.jl:2 [3] top-level scope @ ~/.julia/packages/GMT/1kBBX/src/get_enums.jl:9 [4] include(mod::Module, _path::String) @ Base ./Base.jl:495 [5] include(x::String) @ GMT ~/.julia/packages/GMT/1kBBX/src/GMT.jl:1 [6] top-level scope @ ~/.julia/packages/GMT/1kBBX/src/GMT.jl:259 [7] include @ ./Base.jl:495 [inlined] [8] 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, UInt128}}, source::Nothing) @ Base ./loading.jl:2222 [9] top-level scope @ stdin:3 in expression starting at /Users/sbprasad/.julia/packages/GMT/1kBBX/src/get_enums.jl:9 in expression starting at /Users/sbprasad/.julia/packages/GMT/1kBBX/src/GMT.jl:1 in expression starting at stdin: Stacktrace: [1] pkgerror(msg::String) @ Pkg.Types ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70 [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{…}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{…}) @ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:1659 [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{_from_loading::Bool}) @ Pkg.API ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:159 [4] precompile @ ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:147 [inlined] [5] #precompile#114 @ ~/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:146 [inlined] [6] #invokelatest#2 @ ./essentials.jl:894 [inlined] [7] invokelatest @ ./essentials.jl:889 [inlined] [8] _require(pkg::Base.PkgId, env::String) @ Base ./loading.jl:1963 [9] __require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1812 [10] #invoke_in_world#3 @ ./essentials.jl:926 [inlined] [11] invoke_in_world @ ./essentials.jl:923 [inlined] [12] _require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1803 [13] macro expansion @ ./loading.jl:1790 [inlined] [14] macro expansion @ ./lock.jl:267 [inlined] [15] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1753 [16] #invoke_in_world#3 @ ./essentials.jl:926 [inlined] [17] invoke_in_world @ ./essentials.jl:923 [inlined] [18] require(into::Module, mod::Symbol) @ Base ./loading.jl:1746 Some type information was truncated. Use show(err) to see complete types.

I have tried removing and adding GMT outside Julia via both Homebrew and Macports, and neither addresses this issue. Clearly, Conda is installing a version of GMT that is incompatible with Apple Silicon/ARM, but how do I fix this? Is there a fix?

@joa-quim
Copy link
Member

Hmm, I've seen something alike (but with no errors). Sometimes for some unknown reason the package installer insists in installing an old version. GMT.jl does not use Conda since version 1.0. Try to force installing the current version

] add GMT#1.12.2

I have also this recipe to make GMT.jl use a system wide installed GMT (a local build). It should work too

# The file deps/deps.jl is created by compile from the deps/build.jl
# On Windows we use a system wide GMT if it is found from path or install it from a GMT installer. It is a MSVC binary.
# On Unix the default is to use the GMT_jll artifact. However this can be changed to use a system wide GMT installation.
# To swap to a system wide GMT installation, do (in REPL):
# 1- ENV["SYSTEMWIDE_GMT"] = 1;
# 2- import Pkg; Pkg.build("GMT")
# 3- restart Julia
#
# Note the above will work up until some other reason triggers a Julia recompile, where the JLL artifacts 
# will be used again. To make the ENV["SYSTEMWIDE_GMT"] = 1 solution permanent, declare a "SYSTEMWIDE_GMT"
# environment variable permanently in your .bashrc (or whatever).

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

2 participants