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

LoadError: error compiling anonymous: could not load library "libgobject-2.0" + LoadError: Failed to precompile Gtk to /Applications/JuliaPro-0.6.2.2.app/Contents/Resources/pkgs-0.6.2.2/lib/v0.6/Gtk.ji. #146

Closed
bjce opened this issue May 3, 2018 · 13 comments

Comments

@bjce
Copy link

bjce commented May 3, 2018

Hello

I'm using macOS 10.13.4

I'm trying to load an image with ImageView

I passed the following command:

using ImageView, Images
img = load("/Users/mymac/Downloads/image.jpg")

But get the following error message

Precompiling module ImageView.
ERROR: LoadError: LoadError: error compiling anonymous: could not load library "libgobject-2.0"
dlopen(libgobject-2.0.dylib, 1): image not found
Stacktrace:
 [1] include_from_node1(::String) at ./loading.jl:576
 [2] include(::String) at ./sysimg.jl:14
 [3] include_from_node1(::String) at ./loading.jl:576
 [4] include(::String) at ./sysimg.jl:14
 [5] anonymous at ./<missing>:2
while loading /Applications/JuliaPro-0.6.2.2.app/Contents/Resources/pkgs-0.6.2.2/v0.6/Gtk/src/GLib/GLib.jl, in expression starting on line 68
while loading /Applications/JuliaPro-0.6.2.2.app/Contents/Resources/pkgs-0.6.2.2/v0.6/Gtk/src/Gtk.jl, in expression starting on line 8
ERROR: LoadError: Failed to precompile Gtk to /Applications/JuliaPro-0.6.2.2.app/Contents/Resources/pkgs-0.6.2.2/lib/v0.6/Gtk.ji.
Stacktrace:
 [1] compilecache(::String) at ./loading.jl:710
 [2] _require(::Symbol) at ./loading.jl:463
 [3] require(::Symbol) at ./loading.jl:405
 [4] include_from_node1(::String) at ./loading.jl:576
 [5] include(::String) at ./sysimg.jl:14
 [6] anonymous at ./<missing>:2
while loading /Applications/JuliaPro-0.6.2.2.app/Contents/Resources/pkgs-0.6.2.2/v0.6/ImageView/src/ImageView.jl, in expression starting on line 7
@zygmuntszpak
Copy link
Member

Hi,

Perhaps this has something to do with the PATH environment variable in Atom (i.e. JuliaPro's IDE).
Could you please try running the above commands from a terminal outside of the Juno/Atom IDE?
That is, launch Julia directly from a terminal and try the commands you posted again.

@bjce
Copy link
Author

bjce commented May 6, 2018

Thank you for your answer @zygmuntszpak

from the REPL I typed the following command (after I was asked to run Pkg.add("ImageView") again):

using ImageView, Images

and got the error message:

(process:33259): Gtk-WARNING **: 19:27:17.550: Locale not supported by C library. Using the fallback 'C' locale.

I ran
using ImageView, Images from Jupyter notbook, didn't have an error message but when entering img = load("/Users/mymac/Downloads/img.jpg”) I got syntax: incomplete: invalid string syntax

@zygmuntszpak
Copy link
Member

with regard to the invalid string syntax, comparing load("/Users/mymac/Downloads/img.jpg") vs load("/Users/mymac/Downloads/img.jpg”) it seems that your last set of quotation marks are italic for some reason. Using this tool shows that you have typed U+201D : RIGHT DOUBLE QUOTATION MARK {double comma quotation mark}, whereas I just typed U+0022 : QUOTATION MARK. I just used the default " that you get by holding down shift and pressing comma on the keyboard. Perhaps your text editor is doing some auto replacement?

It seems that others are getting a similar problem with GTK. See this issue for example.

What happens when you try to build Gtk? That is, from the REPL (outside of Juno) type Pkg.build("Gtk")?

@bjce
Copy link
Author

bjce commented May 8, 2018

Thank you very much @zygmuntszpak : i wrote properly the quotation mark, ran Pkg.update() and it worked. Many thanks!

@Evizero Evizero closed this as completed May 8, 2018
@zygmuntszpak
Copy link
Member

@bjce Glad it worked! Could you please confirm that ImageView works inside Atom/Juno and not just IJulia or the REPL launched from the terminal? I've been chasing down an issue where the Atom editor doesn't import your $PATH environment variable properly. I believe that several issues that are appearing for users of different packages are somehow related to the path problem. I'd appreciate it if you could do the following.

  1. Launch Julia from the terminal.
  2. Type ; (that is, press the semi-colon to enter shell mode).
  3. Type echo $ENV.
  4. Look for "PATH"=>..... and copy and paste it to a text file temporarily.

Then from inside Juno/Atom, launch the terminal and repeat the above four steps.

Compare the PATH entries. Are they the same?

@bjce
Copy link
Author

bjce commented May 8, 2018

Ok

Here is what I just did in Julia Pro 0.6.2.2 (which runs on Atom/Juno):

  • Pkg.build("Gtk"): no error
  • using ImageView, Images: no error
  • load("/Users/mymac/Downloads/coins_and_pills.jpg"): no error (+ info 600x800 Array {RGB4{N0f8}, 2}:)

$PATH Problem

When running your commands from Shell Julia and Atom/Juno, the 2 paths are not the same

Here is the PATH from command echo $ENV from Shell Julia

PATH"=>"/Applications/Julia-0.6.app/Contents/Resources/julia/bin:/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/anaconda3/bin:/Users/mymac/anaconda3/bin:/Users/mymac/anaconda/bin:/Applications/Python/anaconda/bin:/Applications/Python/anaconda/bin:/Users/mymac/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

Here is the PATH from command echo $ENV from Atom/Juno

"PATH"=>"/Applications/Julia-0.6.app/Contents/Resources/julia/bin:/anaconda3/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/anaconda3/bin:/Users/mymac/anaconda3/bin:/Users/mymac/anaconda/bin:/Applications/Python/anaconda/bin:/Applications/Python/anaconda/bin:/Users/mymac/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin"

@zygmuntszpak
Copy link
Member

Thank you, it doesn't look like the PATH is an issue in your case. I think I've found the culprit for some Atom installations. If one installs Atom in Linux Mint using the Software Manager then it is installed using something called Flatpack. This creates a sandbox for Atom and I believe it is the reason why Atom doesn't have access to many standard things which manifest in compilation problems.

@bjce
Copy link
Author

bjce commented Jul 26, 2019

Hello again @zygmuntszpak.

I'm allowing to write again on this issue because I just installed the freshest Julia Pro version (1.1.1.1) but the problem unfortunately persists. Do you have any Idea how the problem could be solved?

@johnnychen94
Copy link
Member

I guess you need to wait until JuliaGraphics/Cairo.jl#271 is fixed

@timholy
Copy link
Member

timholy commented Jul 30, 2019

Or force glib 2.58.3? JuliaGraphics/Cairo.jl#271 (comment)

@bjce
Copy link
Author

bjce commented Jul 30, 2019

Thank you for your answer @timholy . Although I might lose some credibility here but when I entered the following line in Terminal: Homebrew.brew(switch glib 2.58.3) I get the following message:

-bash: syntax error near unexpected token ``switch glib 2.58.3`'

@timholy
Copy link
Member

timholy commented Jul 30, 2019

I think you do it from the Julia prompt.

@johnnychen94
Copy link
Member

johnnychen94 commented Jul 30, 2019

Some time ago I played with it and tried to support MacOS CI but faild.

Installing specific glib version 2.58 using Homebrew.jl solves Segmentation fault 11;
but there's a _jl_libcairo error in front of it. You can check the travis-ci logs of #174 for more details.

JuliaPackaging/Homebrew.jl#229 might give a luck though.

I think we can reopen this issue?

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

5 participants