JuliaGraphics / Cairo.jl

Bindings to the Cairo graphics library.
Other
87 stars 56 forks source link

Error building Cairo on macOS #288

Closed sbacelar closed 5 years ago

sbacelar commented 5 years ago

I had a similar issue in the past. I tried the same solutions without success. I am using Julia 1.2 on a MacBookPro and I wanted to use the package Agents but when I try it I get this error:

julia> using Agents
[ Info: Precompiling Agents [46ada45e-f475-11e8-01d0-f70cc89e6671]
ERROR: LoadError: Cairo not properly installed. Please run
Pkg.build("Cairo")
Stacktrace:
 [1] error(::String, ::String) at ./error.jl:42
 [2] top-level scope at /Users/sergiobacelar/.julia/packages/Cairo/p68X8/src/Cairo.jl:9
 [3] include at ./boot.jl:328 [inlined]
 [4] include_relative(::Module, ::String) at ./loading.jl:1094
 [5] include(::Module, ::String) at ./Base.jl:31
 [6] top-level scope at none:2
 [7] eval at ./boot.jl:330 [inlined]
 [8] eval(::Expr) at ./client.jl:432
 [9] top-level scope at ./none:3
in expression starting at /Users/sergiobacelar/.julia/packages/Cairo/p68X8/src/Cairo.jl:9
ERROR: LoadError: Failed to precompile Cairo [159f3aea-2a34-519c-b102-8c37f9878175] to /Users/sergiobacelar/.julia/compiled/v1.2/Cairo/l6vnT.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1253
 [3] _require(::Base.PkgId) at ./loading.jl:1013
 [4] require(::Base.PkgId) at ./loading.jl:911
 [5] require(::Module, ::Symbol) at ./loading.jl:906
 [6] include at ./boot.jl:328 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1094
 [8] include(::Module, ::String) at ./Base.jl:31
 [9] top-level scope at none:2
 [10] eval at ./boot.jl:330 [inlined]
 [11] eval(::Expr) at ./client.jl:432
 [12] top-level scope at ./none:3
in expression starting at /Users/sergiobacelar/.julia/packages/Agents/6V8vz/src/Agents.jl:17
ERROR: Failed to precompile Agents [46ada45e-f475-11e8-01d0-f70cc89e6671] to /Users/sergiobacelar/.julia/compiled/v1.2/Agents/nTsV8.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1253
 [3] _require(::Base.PkgId) at ./loading.jl:1013
 [4] require(::Base.PkgId) at ./loading.jl:911
 [5] require(::Module, ::Symbol) at ./loading.jl:906

And when I try to build Cairo I get this error:

(agent-env) pkg> build Cairo
  Building LibCURL ─→ `~/.julia/packages/LibCURL/lWJxD/deps/build.log`
  Building WinRPM ──→ `~/.julia/packages/WinRPM/Y9QdZ/deps/build.log`
  Building Homebrew → `~/.julia/packages/Homebrew/s09IX/deps/build.log`
  Building Cairo ───→ `~/.julia/packages/Cairo/p68X8/deps/build.log`
┌ Error: Error building `Cairo`, showing the last 100 of log:
│ checking for Mac OS X Cocoa support... yes
│ checking for grep that handles long lines and -e... /usr/bin/grep
│ checking for egrep... /usr/bin/grep -E
│ checking whether we are using the GNU C Library 2.1 or newer... no
│ checking whether to enable garbage collector friendliness... no
│ checking whether to disable memory pools... no
│ readlink: illegal option -- f
│ usage: readlink [-n] [file ...]
│ checking for c++... c++
│ checking whether we are using the GNU C++ compiler... yes
│ checking whether c++ accepts -g... yes
│ checking dependency style of c++... gcc3
│ checking for gcc... (cached) gcc
│ checking whether we are using the GNU C compiler... (cached) yes
│ checking whether gcc accepts -g... (cached) yes
│ checking for gcc option to accept ISO C89... (cached) none needed
│ checking dependency style of gcc... (cached) gcc3
│ checking whether gcc and cc understand -c and -o together... yes
│ checking for special C compiler options needed for large files... no
│ checking for _FILE_OFFSET_BITS value needed for large files... no
│ checking for pkg-config... /usr/local/bin/pkg-config
│ checking pkg-config is at least version 0.16... yes
│ checking for gawk... (cached) gawk
│ checking for perl5... no
│ checking for perl... perl
│ checking for indent... indent
│ checking for perl... /Users/sergiobacelar/anaconda3/bin/perl
│ checking for a Python interpreter with version >= 2.5... python
│ checking for python... /Users/sergiobacelar/anaconda3/bin/python
│ checking for python version... 3.7
│ checking for python platform... darwin
│ checking for python script directory... ${prefix}/lib/python3.7/site-packages
│ checking for python extension module directory... ${exec_prefix}/lib/python3.7/site-packages
│ checking for iconv_open... no
│ checking for libiconv_open in -liconv... no
│ checking for iconv_open in -liconv... yes
│ checking whether to cache iconv descriptors... yes
│ checking for ZLIB... yes
│ checking for ANSI C header files... yes
│ checking for sys/types.h... yes
│ checking for sys/stat.h... yes
│ checking for stdlib.h... yes
│ checking for string.h... yes
│ checking for memory.h... yes
│ checking for strings.h... yes
│ checking for inttypes.h... yes
│ checking for stdint.h... yes
│ checking for unistd.h... yes
│ checking for LIBFFI... no
│ configure: error: Package requirements (libffi >= 3.0.0) were not met:
│
│ No package 'libffi' found
│
│ Consider adjusting the PKG_CONFIG_PATH environment variable if you
│ installed software in a non-standard prefix.
│
│ Alternatively, you may set the environment variables LIBFFI_CFLAGS
│ and LIBFFI_LIBS to avoid the need to call pkg-config.
│ See the pkg-config man page for more details.
│ [ Info: Attempting to create directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/downloads
│ [ Info: Directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/downloads already exists
│ [ Info: Downloading file http://ftp.gnome.org/pub/gnome/sources/glib/2.34/glib-2.34.3.tar.xz
│ [ Info: Done downloading file http://ftp.gnome.org/pub/gnome/sources/glib/2.34/glib-2.34.3.tar.xz
│ [ Info: Attempting to create directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/src
│ [ Info: Directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/src already exists
│ [ Info: Attempting to create directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps
│ [ Info: Directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps already exists
│ [ Info: Path /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/src/glib-2.34.3 already exists
│ [ Info: Attempting to create directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/builds/gobject
│ [ Info: Directory /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/builds/gobject already exists
│ [ Info: Changing directory to /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/builds/gobject
│ ERROR: LoadError: failed process: Process(setenv(`/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/src/glib-2.34.3/configure --prefix=/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/usr`,["_CE_M=", "ENV=/usr/local/Cellar/modules/4.3.0/init/profile.sh", "PATH=/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/usr/bin:/Users/sergiobacelar/.julia/packages/Homebrew/s09IX/deps/usr/bin:/Users/sergiobacelar/.julia/packages/Homebrew/s09IX/deps/usr/sbin:/Users/sergiobacelar/anaconda3/bin:/Users/sergiobacelar/anaconda3/condabin:/usr/local/Cellar/modules/4.3.0/bin:/Users/sergiobacelar/local/bin:/Users/sergiobacelar/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Users/sergiobacelar/Judy-master:/Users/sergiobacelar/.julia/packages/Homebrew/s09IX/deps/usr/opt/git/libexec/git-core", "EDITOR=ec", "ARCHFLAGS=-arch x86_64", "MANPATH=:", "MODULEPATH=/usr/local/Cellar/modules/4.3.0/modulefiles:/Users/sergiobacelar/.modules", "ITERM_PROFILE=Atom", "GIT_TEMPLATE_DIR=/Users/sergiobacelar/.julia/packages/Homebrew/s09IX/deps/usr/opt/git/share/git-core", "Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.1Pfvyjdf8K/Render"  …  "DISPLAY=/private/tmp/com.apple.launchd.YaOokHt7i0/org.macosforge.xquartz:0", "TERM_PROGRAM=iTerm.app", "CPPFLAGS= -I/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/usr/include", "LDFLAGS= -L/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/usr/lib -Wl,-rpath -Wl,/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/usr/lib", "CONDA_PREFIX=/Users/sergiobacelar/anaconda3", "TERM_SESSION_ID=w0t0p0:1E880695-3165-46B7-83D9-F1FF04A9A47D", "PKG_CONFIG_PATH=/Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/usr/lib/pkgconfig", "JULIA_LOAD_PATH=@:/var/folders/tq/f5jbfqp97y52w_y7byn05_fw0000gn/T/jl_iHmllb", "BASH_FUNC__module_raw%%=() {  unset _mlshdbg;\n if [ \"\${MODULES_SILENT_SHELL_DEBUG:-0}\" = '1' ]; then\n case \"\$-\" in \n *v*x*)\n set +vx;\n _mlshdbg='vx'\n ;;\n *v*)\n set +v;\n _mlshdbg='v'\n ;;\n *x*)\n set +x;\n _mlshdbg='x'\n ;;\n *)\n _mlshdbg=''\n ;;\n esac;\n fi;\n unset _mlre _mlIFS;\n if [ -n \"\${IFS+x}\" ]; then\n _mlIFS=\$IFS;\n fi;\n IFS=' ';\n for _mlv in \${MODULES_RUN_QUARANTINE:-};\n do\n if [ \"\${_mlv}\" = \"\${_mlv##*[!A-Za-z0-9_]}\" -a \"\${_mlv}\" = \"\${_mlv#[0-9]}\" ]; then\n if [ -n \"`eval 'echo \${'\$_mlv'+x}'`\" ]; then\n _mlre=\"\${_mlre:-}\${_mlv}_modquar='`eval 'echo \${'\$_mlv'}'`' \";\n fi;\n _mlrv=\"MODULES_RUNENV_\${_mlv}\";\n _mlre=\"\${_mlre:-}\${_mlv}='`eval 'echo \${'\$_mlrv':-}'`' \";\n fi;\n done;\n if [ -n \"\${_mlre:-}\" ]; then\n eval `eval \${_mlre}/usr/bin/tclsh /usr/local/Cellar/modules/4.3.0/libexec/modulecmd.tcl bash '\"\$@\"'`;\n else\n eval `/usr/bin/tclsh /usr/local/Cellar/modules/4.3.0/libexec/modulecmd.tcl bash \"\$@\"`;\n fi;\n _mlstatus=\$?;\n if [ -n \"\${_mlIFS+x}\" ]; then\n IFS=\$_mlIFS;\n else\n unset IFS;\n fi;\n unset _mlre _mlv _mlrv _mlIFS;\n if [ -n \"\${_mlshdbg:-}\" ]; then\n set -\$_mlshdbg;\n fi;\n unset _mlshdbg;\n return \$_mlstatus\n}", "OPENBLAS_MAIN_FREE=1"]), ProcessExited(1)) [1]
│
│ Stacktrace:
│  [1] pipeline_error at ./process.jl:813 [inlined]
│  [2] #run#536(::Bool, ::typeof(run), ::Cmd) at ./process.jl:728
│  [3] run(::Cmd) at ./process.jl:726
│  [4] run(::BinDeps.SynchronousStepCollection) at /Users/sergiobacelar/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:521
│  [5] run(::FileRule) at /Users/sergiobacelar/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:483
│  [6] run(::BinDeps.SynchronousStepCollection) at /Users/sergiobacelar/.julia/packages/BinDeps/ZEval/src/BinDeps.jl:521 (repeats 2 times)
│  [7] satisfy!(::BinDeps.LibraryDependency, ::Array{DataType,1}) at ./string:944
│  [8] satisfy!(::BinDeps.LibraryGroup, ::Array{DataType,1}) at ./string:910
│  [9] satisfy!(::BinDeps.LibraryGroup) at ./string:874
│  [10] top-level scope at string:977
│  [11] include at ./boot.jl:328 [inlined]
│  [12] include_relative(::Module, ::String) at ./loading.jl:1094
│  [13] include(::Module, ::String) at ./Base.jl:31
│  [14] include(::String) at ./client.jl:431
│  [15] top-level scope at none:5
│ in expression starting at /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/build.jl:176
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│ ignored: dlclose()
│
│ Full log at /Users/sergiobacelar/.julia/packages/Cairo/p68X8/deps/build.log
└ @ Pkg.Operations /Users/sabae/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.2/Pkg/src/backwards_compatible_isolation.jl:647

I did this in a new and clean environment. I deleted Manifest.toml and Project.toml. After that I only added the following packages: Cairo, Rsvg, VegaLite and Agents. In a past similar issue, the problem was related to glib. Now, using brewI get the following:

Warning: glib 2.60.6 is already installed
The currently linked version is 2.58.3
You can use `brew switch glib 2.60.6` to link this version.
sbacelar commented 5 years ago

The past and similar issue is #279 .

sbacelar commented 5 years ago

Solved at last! I did so many things that I can't remember exactly what I did. In a new environment, using Homebrew#master and so on. But I think the real solution was doing in Terminal:

brew switch glib 2.58.3
# Cleaning /usr/local/Cellar/glib/2.58.3
# Cleaning /usr/local/Cellar/glib/2.60.6
# 152 links created for /usr/local/Cellar/glib/2.58.3

and then build Cairo(two times!).