JuliaGraphics/FreeType.jl

LoadError: FreeType library could not be found.

JanVanDieBos opened this issue ยท 10 comments

Hey I am running ubuntu and got the following error:

==============================[ ERROR: FreeType ]===============================

LoadError: FreeType library could not be found. Please file an issue here: https://github.com/jhasse/FreeType.jl/issues/new
while loading /home/jan/.julia/v0.4/FreeType/deps/build.jl, in expression starting on line 18

================================================================================

================================[ BUILD ERRORS ]================================

WARNING: FreeType had build errors.

  • packages with build errors remain installed in /home/jan/.julia/v0.4
  • build the package(s) and all dependencies with Pkg.build("FreeType")
  • build a single package by running its deps/build.jl script

whilst trying to build FreeType in julia termanl

Have you manually installed freetype on the system?

Currently FreeType.jl searches these locations. I've submitted a PR #18 which provides the ability to automatically install freetype for users.

My anaconda navigator states that freetype 2.5.5 is installed, however it also treats this as the latest version while freetype 2.7.1 is supposed to be. Do you think this could be the issue?

@17643015 I guess anaconda installed freetype in a specific path which is unfortunately not included in this list. A workaround is to add the above mentioned path into the list and then run Pkg.build("FreeType") in julia again.

Hey man please excuse my ignorance, I am new to both linux and julia. So my understanding is that I must edit my build.jl file adding in the directory (/home/jan/.julia/v0.4/FreeType) in which my freetype folder is found?

Then this would amount to the edited lines:
const freetype = Libdl.find_library(
["libfreetype", "libfreetype-6", "libfreetype.6", "freetype"],
[
"/usr/lib/i386-linux-gnu", "/usr/lib/x86_64-linux-gnu", "/usr/.julia/v0.4",
Pkg.dir("WinRPM", "deps", "usr", "$(Sys.ARCH)-w64-mingw32", "sys-root", "mingw", "bin"),
"/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/freetype2", "/usr/X11/lib/"
]
)

No, not this path /usr/.julia/v0.4, it's the path returned by conda info freetype, so Julia can find the freetype installed by anaconda.

const freetype = Libdl.find_library(
["libfreetype", "libfreetype-6", "libfreetype.6", "freetype"],
[
"/usr/lib/i386-linux-gnu", "/usr/lib/x86_64-linux-gnu", "your/anaconda/path/freetype",
Pkg.dir("WinRPM", "deps", "usr", "$(Sys.ARCH)-w64-mingw32", "sys-root", "mingw", "bin"),
"/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/freetype2", "/usr/X11/lib/"
]
)

So "conda info freetype" doesn't seem to return a directory:
freetype 2.5.5 1

file name : freetype-2.5.5-1.tar.bz2
name : freetype
version : 2.5.5
build string: 1
build number: 1
channel : defaults
size : 2.5 MB
arch : x86_64
date : 2016-06-02
license : FreeType License
license_family: Other
md5 : 7ee1d1c769f343a4ad3a5926efd3fb05
platform : linux
requires : ()
url : https://repo.continuum.io/pkgs/free/linux-64/freetype-2.5.5-1.tar.bz2

However the freetype folder for anaconda is given in the following directory:
/home/jan/anaconda2/pkgs.
Using this directory doesn't seem to change the error though.

Well, I'm currently not working on Linux, so it's hard to diagnose. Another way is to use my PR #18, but it's not merged yet. The PR is equivalent to manually do the following steps:

  • Step1: replace /home/jan/.julia/v0.4/FreeType/deps/build.jl with
using Compat

using BinDeps
@BinDeps.setup

libfreetype = library_dependency("libfreetype", aliases=["libfreetype-6", "libfreetype.6", "freetype"])

if is_windows()
    using WinRPM
    provides(WinRPM.RPM,"libfreetype6", libfreetype, os = :Windows)
end

if is_apple()
    if Pkg.installed("Homebrew") === nothing
        error("Homebrew package not installed, please run Pkg.add(\"Homebrew\")")
    end
    using Homebrew
    provides(Homebrew.HB, "freetype", libfreetype, os = :Darwin)
end

provides(AptGet, "libfreetype6", libfreetype)
provides(Yum, "freetype", libfreetype)
provides(Zypper, "freetype", libfreetype)

@BinDeps.install Dict(:libfreetype => :freetype)
  • Step2: Add BinDeps and @osx Homebrew into /home/jan/.julia/v0.4/FreeType/REQUIRE, now your REQUIRE should be:
julia 0.4
BinDeps
@osx Homebrew
@windows WinRPM
Compat 0.9.2
  • Step3: run Pkg.build("FreeType") in julia

you probably need to run Pkg.add("BinDeps") before running Pkg.build("FreeType").

Success! Thank you so much!

Glad to hear that ๐Ÿ˜‰