<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1434861843;
mso-list-type:hybrid;
mso-list-template-ids:-965719694 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">This is not a cairo specific issue.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">A general guide for solving ‘undefined reference’ errors in Linux/Unix:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1">Figure out which library (.a or .so) provides the missing functions. E.g:<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">> nm thirdparty/cairo/lib/libcairo.a | grep -w 'cairo_image_surface_create'<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal">0000000000000da0 T cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"> U cairo_image_surface_create<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The line with T indicates that 'cairo_image_surface_create' is indeed defined by this library.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0cm" start="2" type="1">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1">Ensure that the directory of this file is passed to the compiler/linker command line via -L<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1">Ensure that the name of this file without prefix and suffix is passed to the compiler/linker command line via -l, e.g. -lcairo in this case.<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo1">If still failing, move -lcairo to the end of the command line, the linking order is important.<o:p></o:p></li></ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">That’s it. Also suggesting to switch over to CMake, writing makefiles by hand feels more like writing PostScript by hand.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">HTH<o:p></o:p></p>
<p class="MsoNormal">Paavo<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> cairo <cairo-bounces@cairographics.org> <b>On Behalf Of
</b>Byron Blue<br>
<b>Sent:</b> teisipäev, 5. detsember 2023 18:34<br>
<b>To:</b> cairo@cairographics.org<br>
<b>Subject:</b> [External] [cairo] Installation<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="background:#A6A6A6;padding:5.25pt 1.5pt 5.25pt 1.5pt"></td>
<td width="100%" style="width:100.0%;background:#EAEAEA;padding:5.25pt 3.75pt 5.25pt 11.25pt">
<div>
<p class="MsoNormal" style="mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
<span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:#212121">You don't often get email from
<a href="mailto:byronblue@hotmail.com">byronblue@hotmail.com</a>. <a href="https://aka.ms/LearnAboutSenderIdentification">
Learn why this is important</a><o:p></o:p></span></p>
</div>
</td>
<td width="75" style="width:56.25pt;background:#EAEAEA;padding:5.25pt 3.75pt 5.25pt 3.75pt;align:left">
</td>
</tr>
</tbody>
</table>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">I've been trying (for quite a number of days) to get a simple addition of my code to compile under NetBSD 9.1 using a few Cairo graphics functions. I know my makefile must be missing something
obvious. The installation instructions are poor at best. Here is the complaints from my compiler (gcc):<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3280: undefined reference to `cairo_create'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3305: undefined reference to `cairo_image_surface_create'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3306: undefined reference to `cairo_create'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3307: undefined reference to `cairo_set_source_rgba'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3308: undefined reference to `cairo_rectangle'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3309: undefined reference to `cairo_fill'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3311: undefined reference to `cairo_set_source_rgba'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3312: undefined reference to `cairo_rectangle'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3313: undefined reference to `cairo_fill'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3315: undefined reference to `cairo_destroy'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">ld: /home/byron/working/unix/utilityModules.c:3316: undefined reference to `cairo_surface_destroy'</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Thank you for any help,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Byron</span><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>