Cinder
Cinder copied to clipboard
'cinder/cairo/Cairo.h' not found when building via cmake on macOS
Hi everyone!
A bit of a cmake noob here - so please forgive me if I am missed anything obvious.
I'm trying to compile the CairoBasic
sample on macOS (10.14.6) using cmake (3.22.1). The build goes fine from the XCode project, but I can't manage to get it working via cmake - and I want to understand a bit more of how cmake works so that I can reuse the same knowledge when working under linux.
I'm currently following the guide here: https://libcinder.org/docs/guides/cmake/cmake.html#building-your-application-with-cmake
This is what I get after I try to make
:
/path/to/cinder_0.9.2_mac/samples/CairoBasic/src/CairoBasicApp.cpp:6:10: fatal error: 'cinder/cairo/Cairo.h' file not found
#include "cinder/cairo/Cairo.h
If i search around ($ find ../../../ -name "Cairo.h"
) for that header file it appears to be in ../../../blocks/Cairo/include/cinder/cairo/Cairo.h
. So I thought of adding blocks/Cairo/include
to the ci_make_app
call, like this:
ci_make_app(
CINDER_PATH ${CINDER_PATH}
INCLUDES ${CINDER_PATH}/blocks/Cairo/include
SOURCES ${APP_PATH}/src/CairoBasicApp.cpp
)
If I do that, I get a linker error (after running cmake ../proj/cmake
and make
again from my build
dir) :
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/CairoBasic.dir/Users/vvzen/creative-coding/cinder_0.9.2_mac/samples/CairoBasic/src/CairoBasicApp.cpp.o -o Debug/CairoBasic/CairoBasic.app/Contents/MacOS/CairoBasic /Users/vvzen/creative-coding/cinder/lib/macosx/Debug/libcinder.a /Users/vvzen/creative-coding/cinder/lib/macosx/libboost_system.a /Users/vvzen/creative-coding/cinder/lib/macosx/libboost_filesystem.a -framework Cocoa -framework OpenGL -framework AudioToolbox -framework AVFoundation -framework AudioUnit -framework CoreAudio -framework CoreMedia -framework CoreVideo -framework Accelerate -framework IOSurface -framework IOKit
Undefined symbols for architecture x86_64:
"cinder::cairo::SurfaceEps::SurfaceEps(boost::filesystem::path const&, double, double, bool)", referenced from:
CairoBasicApp::keyDown(cinder::app::KeyEvent) in CairoBasicApp.cpp.o
"cinder::cairo::SurfacePdf::SurfacePdf(boost::filesystem::path const&, double, double)", referenced from:
CairoBasicApp::keyDown(cinder::app::KeyEvent) in CairoBasicApp.cpp.o
"cinder::cairo::SurfaceSvg::SurfaceSvg(boost::filesystem::path const&, unsigned int, unsigned int)", referenced from:
CairoBasicApp::keyDown(cinder::app::KeyEvent) in CairoBasicApp.cpp.o
"cinder::cairo::SurfaceBase::~SurfaceBase()", referenced from:
cinder::cairo::SurfaceSvg::~SurfaceSvg() in CairoBasicApp.cpp.o
cinder::cairo::SurfaceEps::~SurfaceEps() in CairoBasicApp.cpp.o
cinder::cairo::SurfacePs::~SurfacePs() in CairoBasicApp.cpp.o
cinder::cairo::SurfacePdf::~SurfacePdf() in CairoBasicApp.cpp.o
cinder::cairo::SurfaceQuartz::~SurfaceQuartz() in CairoBasicApp.cpp.o
"cinder::cairo::GradientRadial::GradientRadial(glm::vec<2, float, (glm::qualifier)0> const&, float, glm::vec<2, float, (glm::qualifier)0> const&, float)", referenced from:
CairoBasicApp::renderScene(cinder::cairo::Context&) in CairoBasicApp.cpp.o
"cinder::cairo::createWindowSurface()", referenced from:
CairoBasicApp::draw() in CairoBasicApp.cpp.o
"cinder::cairo::Context::newSubPath()", referenced from:
Flower::makePath(cinder::cairo::Context&) const in CairoBasicApp.cpp.o
"cinder::cairo::Context::setSourceRgba(double, double, double, double)", referenced from:
cinder::cairo::Context::setSource(cinder::ColorAT<float> const&) in CairoBasicApp.cpp.o
"cinder::cairo::Context::arc(double, double, double, double, double)", referenced from:
cinder::cairo::Context::arc(glm::vec<2, float, (glm::qualifier)0> const&, double, double, double) in CairoBasicApp.cpp.o
"cinder::cairo::Context::fill()", referenced from:
Flower::draw(cinder::cairo::Context&) const in CairoBasicApp.cpp.o
"cinder::cairo::Context::paint()", referenced from:
CairoBasicApp::renderScene(cinder::cairo::Context&) in CairoBasicApp.cpp.o
"cinder::cairo::Context::stroke()", referenced from:
Flower::draw(cinder::cairo::Context&) const in CairoBasicApp.cpp.o
"cinder::cairo::Context::closePath()", referenced from:
Flower::makePath(cinder::cairo::Context&) const in CairoBasicApp.cpp.o
"cinder::cairo::Context::setSource(cinder::cairo::Pattern const&)", referenced from:
CairoBasicApp::renderScene(cinder::cairo::Context&) in CairoBasicApp.cpp.o
"cinder::cairo::Context::Context(cinder::cairo::SurfaceBase const&)", referenced from:
CairoBasicApp::keyDown(cinder::app::KeyEvent) in CairoBasicApp.cpp.o
CairoBasicApp::draw() in CairoBasicApp.cpp.o
"cinder::cairo::Context::~Context()", referenced from:
CairoBasicApp::keyDown(cinder::app::KeyEvent) in CairoBasicApp.cpp.o
CairoBasicApp::draw() in CairoBasicApp.cpp.o
"cinder::cairo::Pattern::~Pattern()", referenced from:
cinder::cairo::Gradient::~Gradient() in CairoBasicApp.cpp.o
"cinder::cairo::Gradient::addColorStopRgb(double, double, double, double)", referenced from:
cinder::cairo::Gradient::addColorStop(double, cinder::ColorT<float> const&) in CairoBasicApp.cpp.o
"cinder::cairo::SurfacePs::SurfacePs(boost::filesystem::path const&, double, double, bool)", referenced from:
CairoBasicApp::keyDown(cinder::app::KeyEvent) in CairoBasicApp.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Debug/CairoBasic/CairoBasic.app/Contents/MacOS/CairoBasic] Error 1
make[1]: *** [CMakeFiles/CairoBasic.dir/all] Error 2
make: *** [all] Error 2
Could anyone point me to some docs or could shed a light on what I'm doing wrong? I have a feeling that it's not actually pick up the correct Cairo.h, but I'm not sure how to go on about fixing it. Thanks!
Valerio
I am having the same issue on Arch Linux.
Yep, experiencing the same issue on Ubuntu. The issue is being caused because the function createWindowSurface()
is defined only for OSX and Windows, and not Linux. Looking into the Cairo.h
file, I could see that:
#if defined( CINDER_COCOA )
SurfaceQuartz createWindowSurface();
#elif defined( CINDER_MSW )
SurfaceGdi createWindowSurface();
#endif