Cairo_quartz_font 给出架构的未定义符号 x86_64 错误
Cairo_quartz_font giving Undefined symbols for architecture x86_64 error
我正在尝试构建 this 的 mac。它使用开罗的介子构建系统。每当我 $ make -j3
我得到 Undefined symbols for architecture x86_64:
后跟文件中的函数重复。
"_CFDataGetBytes", referenced from:
__cairo_quartz_load_truetype_table in libcairo.a(cairo-quartz-font.c.o)
我正在使用 M1 mac,但是,我 运行 所有命令都带有 arch -x86_64
,所以我怀疑 M1 是问题所在。
我在 ./src
文件夹中修改 CmakeLists.txt
的片段:
elseif(APPLE)
target_link_libraries(project_libraries
INTERFACE
-lm
)
endif()
我怀疑我在 target_link_libraries
中遗漏了一些东西,但我不确定是什么问题。
谢谢!
P.S 我也尝试过链接 ApplicationServices 框架,但是它没有被使用
编辑:
这是我的完整错误列表:
"_CGBitmapContextCreate", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextRelease", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetAlpha", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetFont", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetFontSize", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetShouldAntialias", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetShouldSmoothFonts", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetTextMatrix", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextShowGlyphsAtPoint", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGFontCreateWithPlatformFont", referenced from:
_cairo_quartz_font_face_create_for_atsu_font_id in libcairo.a(cairo-quartz-font.c.o)
"_CGFontRelease", referenced from:
__cairo_quartz_font_face_create_for_toy in libcairo.a(cairo-quartz-font.c.o)
__cairo_quartz_font_face_destroy in libcairo.a(cairo-quartz-font.c.o)
_cairo_quartz_font_face_create_for_atsu_font_id in libcairo.a(cairo-quartz-font.c.o)
"_CGFontRetain", referenced from:
__cairo_quartz_font_face_create_for_toy in libcairo.a(cairo-quartz-font.c.o)
_cairo_quartz_font_face_create_for_cgfont in libcairo.a(cairo-quartz-font.c.o)
_cairo_quartz_font_face_create_for_atsu_font_id in libcairo.a(cairo-quartz-font.c.o)
"_CGPathApply", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGPathRelease", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectApplyAffineTransform", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMaxX", referenced from:
__cairo_quartz_font_face_scaled_font_create in libcairo.a(cairo-quartz-font.c.o)
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMaxY", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMinX", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMinY", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectIntegral", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
随机猜测:你需要一些 CMake-equivalent 用于以下行(因为你正在使用 cairo 的静态库):
quartz_deps = dependency('appleframeworks', modules : ['CoreFoundation', 'ApplicationServices'], required: get_option('quartz'))
https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/meson.build#L452
仅从函数名称来看,CFDataGetBytes
听起来可能属于 CoreFoundation
。
相关的 Whosebug 答案似乎是
根据上述问题的公认答案,您显然也可以使用 find_library
来“获取”框架。
添加到@uli 的回答中。我也错过了
"-framework ApplicationServices"
"-framework OpenGL"
框架。
添加后,我不会再收到任何错误。
我正在尝试构建 this 的 mac。它使用开罗的介子构建系统。每当我 $ make -j3
我得到 Undefined symbols for architecture x86_64:
后跟文件中的函数重复。
"_CFDataGetBytes", referenced from:
__cairo_quartz_load_truetype_table in libcairo.a(cairo-quartz-font.c.o)
我正在使用 M1 mac,但是,我 运行 所有命令都带有 arch -x86_64
,所以我怀疑 M1 是问题所在。
我在 ./src
文件夹中修改 CmakeLists.txt
的片段:
elseif(APPLE)
target_link_libraries(project_libraries
INTERFACE
-lm
)
endif()
我怀疑我在 target_link_libraries
中遗漏了一些东西,但我不确定是什么问题。
谢谢!
P.S 我也尝试过链接 ApplicationServices 框架,但是它没有被使用
编辑:
这是我的完整错误列表:
"_CGBitmapContextCreate", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextRelease", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetAlpha", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetFont", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetFontSize", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetShouldAntialias", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetShouldSmoothFonts", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextSetTextMatrix", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGContextShowGlyphsAtPoint", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGFontCreateWithPlatformFont", referenced from:
_cairo_quartz_font_face_create_for_atsu_font_id in libcairo.a(cairo-quartz-font.c.o)
"_CGFontRelease", referenced from:
__cairo_quartz_font_face_create_for_toy in libcairo.a(cairo-quartz-font.c.o)
__cairo_quartz_font_face_destroy in libcairo.a(cairo-quartz-font.c.o)
_cairo_quartz_font_face_create_for_atsu_font_id in libcairo.a(cairo-quartz-font.c.o)
"_CGFontRetain", referenced from:
__cairo_quartz_font_face_create_for_toy in libcairo.a(cairo-quartz-font.c.o)
_cairo_quartz_font_face_create_for_cgfont in libcairo.a(cairo-quartz-font.c.o)
_cairo_quartz_font_face_create_for_atsu_font_id in libcairo.a(cairo-quartz-font.c.o)
"_CGPathApply", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGPathRelease", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectApplyAffineTransform", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMaxX", referenced from:
__cairo_quartz_font_face_scaled_font_create in libcairo.a(cairo-quartz-font.c.o)
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMaxY", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMinX", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectGetMinY", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
"_CGRectIntegral", referenced from:
__cairo_quartz_scaled_glyph_init in libcairo.a(cairo-quartz-font.c.o)
随机猜测:你需要一些 CMake-equivalent 用于以下行(因为你正在使用 cairo 的静态库):
quartz_deps = dependency('appleframeworks', modules : ['CoreFoundation', 'ApplicationServices'], required: get_option('quartz'))
https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/meson.build#L452
仅从函数名称来看,CFDataGetBytes
听起来可能属于 CoreFoundation
。
相关的 Whosebug 答案似乎是
根据上述问题的公认答案,您显然也可以使用 find_library
来“获取”框架。
添加到@uli 的回答中。我也错过了
"-framework ApplicationServices"
"-framework OpenGL"
框架。 添加后,我不会再收到任何错误。