rougier / freetype-gl

OpenGL text using one vertex buffer, one texture and FreeType
Other
1.65k stars 266 forks source link

OSX El Capitan makefont build error #93

Closed bakpakin closed 8 years ago

bakpakin commented 8 years ago

When I try to build freetype on OSX El Capitan, it seems to build most of the project, but fails on linking the makefont executable.

Output:

[ 1%] Building C object CMakeFiles/freetype-gl.dir/mat4.c.o [ 3%] Building C object CMakeFiles/freetype-gl.dir/texture-atlas.c.o [ 5%] Building C object CMakeFiles/freetype-gl.dir/texture-font.c.o [ 7%] Building C object CMakeFiles/freetype-gl.dir/vertex-buffer.c.o [ 9%] Building C object CMakeFiles/freetype-gl.dir/vertex-attribute.c.o [ 11%] Building C object CMakeFiles/freetype-gl.dir/font-manager.c.o [ 12%] Building C object CMakeFiles/freetype-gl.dir/text-buffer.c.o [ 14%] Building C object CMakeFiles/freetype-gl.dir/shader.c.o [ 16%] Building C object CMakeFiles/freetype-gl.dir/vector.c.o [ 18%] Building C object CMakeFiles/freetype-gl.dir/utf8-utils.c.o [ 20%] Building C object CMakeFiles/freetype-gl.dir/platform.c.o [ 22%] Building C object CMakeFiles/freetype-gl.dir/edtaa3func.c.o [ 24%] Linking C static library libfreetype-gl.a [ 24%] Built target freetype-gl [ 25%] Building C object CMakeFiles/makefont.dir/makefont.c.o [ 27%] Linking C executable makefont Undefined symbols for architecture x86_64: "_CFArrayAppendValue", referenced from: __glfwInitJoysticks in libglfw3.a(iokit_joystick.m.o) _getElementsCFArrayHandler in libglfw3.a(iokit_joystick.m.o) "_CFArrayApplyFunction", referenced from: _matchCallback in libglfw3.a(iokit_joystick.m.o) "_CFArrayCreateMutable", referenced from: __glfwInitJoysticks in libglfw3.a(iokit_joystick.m.o) _matchCallback in libglfw3.a(iokit_joystick.m.o) "_CFArrayGetCount", referenced from:

...

All of the errors seem to be glfw3 referencing undefined OSX framework symbols in CoreFoundation, CoreVideo, and IOKit. I'm not sure if this is an error with glfw3 or freetype-gl, but its not compiling. I tried adding the missing frameworks via -framework compiler flags in CMakeLists.txt, but it didn't help.

rougier commented 8 years ago

I'm also using El Capitan and I do not have such problem. How did you install glfw3 ? (I installed it through homebrew)

bakpakin commented 8 years ago

Same.

bakpakin commented 8 years ago

Right now I'm trying to install glfw through macports to see if that changes anything.

bakpakin commented 8 years ago

So with a bit of poking around, I think the problem is that cmake can't find glfw, and the Findglfw3.cmake that I provided was the wrong solution. I took a step back and did a standard cmake build from the the repository just as I cloned it.

➜  c  git clone https://github.com/rougier/freetype-gl.git
Cloning into 'freetype-gl'...
remote: Counting objects: 2224, done.
remote: Total 2224 (delta 0), reused 0 (delta 0), pack-reused 2224
Receiving objects: 100% (2224/2224), 12.21 MiB | 470.00 KiB/s, done.
Resolving deltas: 100% (1435/1435), done.
Checking connectivity... done.
➜  c  cd freetype-gl
➜  freetype-gl git:(master) mkdir build && cd build
➜  build git:(master) cmake ..
-- The C compiler identification is AppleClang 7.0.2.7000181
-- The CXX compiler identification is AppleClang 7.0.2.7000181
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /System/Library/Frameworks/OpenGL.framework
-- Found Freetype: /Library/Frameworks/freetype.framework
CMake Error at CMakeLists.txt:81 (FIND_PACKAGE):
  By not providing "Findglfw3.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "glfw3", but
  CMake did not find one.

  Could not find a package configuration file provided by "glfw3" with any of
  the following names:

    glfw3Config.cmake
    glfw3-config.cmake

  Add the installation prefix of "glfw3" to CMAKE_PREFIX_PATH or set
  "glfw3_DIR" to a directory containing one of the above files.  If "glfw3"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
See also "/Users/Calvin/code/c/freetype-gl/build/CMakeFiles/CMakeOutput.log".

So, as you can see, glfw3 can't be found. I think this is me be bad at cmake, but I'm not sure how to proceed. glfw3 is installed through homebrew.

rougier commented 8 years ago

Yes, I remember this issue (#78). The solution is to:

ln -s /usr/local/lib/cmake/glfw /usr/local/lib/cmake/glfw3
bakpakin commented 8 years ago

Ah, thank you. I just managed to make a custom Findglfw3.cmake that worked, but that looks easier.

rougier commented 8 years ago

Ok. Don't forget to close the issue if you think it is solved.