Home > OS >  Cairo_quartz_font giving Undefined symbols for architecture x86_64 error
Cairo_quartz_font giving Undefined symbols for architecture x86_64 error

Time:03-15

I am trying to make a mac build of this. It is using the meson build system for Cairo. Whenever I $ make -j3 I get Undefined symbols for architecture x86_64: followed by this repeated for functions in the file.

  "_CFDataGetBytes", referenced from:
      __cairo_quartz_load_truetype_table in libcairo.a(cairo-quartz-font.c.o)

I am using an M1 mac, however, I am running all commands with arch -x86_64 so I doubt the M1 is the issue.

A snippet of my modified CmakeLists.txt in the ./src folder:

elseif(APPLE)
   target_link_libraries(project_libraries
        INTERFACE

            -lm
          
   )

endif()

I suspect I am missing something in the target_link_libraries however I am not sure what the issue is. Thanks! P.S I have also tried linking the ApplicationServices framework however it goes unused EDIT: here is my full errors list:

  "_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)

CodePudding user response:

Random guess: You need some CMake-equivalent for the following line (because you are using a static library for cairo):

quartz_deps = dependency('appleframeworks', modules : ['CoreFoundation', 'ApplicationServices'], required: get_option('quartz'))

https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/meson.build#L452

Just from the name of the function, CFDataGetBytes sounds like it could belong to CoreFoundation.

Related StackOverflow answer seems to be https://stackoverflow.com/a/18330634/436275

Per the accepted answer of the question above, you can apparently also use find_library to "get" frameworks.

CodePudding user response:

To add to @uli 's answer. I was also missing the

    "-framework ApplicationServices"
    "-framework OpenGL"

frameworks. Once added, I am not getting any more errors.

  • Related