From: Patrice D. <per...@fr...> - 2010-10-05 20:36:52
|
On Tue, Oct 05, 2010 at 11:37:27AM -0400, Jennifer Adams wrote: > will have to figure out how to link statically. That long list of > dependent libraries is daunting! In my simple test program (rmf.c), > I am compiling/linking with this command: > > gcc -g rmf.c -o rmf -I/opt/local/include/cairo -L/opt/local/lib - > lcairo -L/usr/X11/lib -lX11 Indeed, with gcc, you only need to link dynamically against a library when you use a symbol from that library. But The library itself may need more symbols. When linking dynamically, you don't need to care, taking care of all the library dynamic dependency is the dynamic linker job. When you link statically, you have to do the job of the dynamic linker yourself, so that you need to supply all the libraries indirectly needed. > I have some more testing to do with fonts, and so I may have to add > some more libs to that list, but if my code doesn't require all > those dependent libs, I don't have to statically link them, do I? If the library you use require those dependent libs, you have to statically link them, even if your conde don't require them... You can laso link some libraries statically, and other dynamically. For example, the X libraries may be linked dynamically, even when most of th eother libraries are statically linked, and, unless I am wrong it is what is done for grads/opengrads. > As for backends, I am planning to use cairo to draw to an X window, > PNG, Postscript, PDF, and SVG. I do not see why it's necessary to > add the platform-specific window backends; X has been working fine > for GrADS all these years. Beware that there are 2 X backends: * xlib: Uses the Xlib interface to the X Window System. This backend can target Windows or Pixmaps. The Render extension is used if available, but is not required. * xcb: Provides support similar to the xlib backend, but uses the XCB interface rather than Xlib. I guess that for maximal portability you should use the xlib backend when compiling cairo, and not the xcb backend. -- Pat |