Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-04

Using Cairo lib on Linux without X

15 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen

FPC has the API wrapper for Cairo lib. I am studying its dependencies and maybe use it in a Linux server with no X Window installed, for generating PDFs.

Cairo is advertized to support multiple output devices, including X Window, image buffers, PostScript, PDF, and SVG file output. I understand it means that X Window is required only for the X Window backend. PDF or SVG backends should not require X Window.

However on my Linux Mint 17 libcairo has a dependency for libX11.so.6. See :

# ldd /usr/lib/i386-linux-gnu/libcairo.so.2
linux-gate.so.1 => (0xf77a7000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf763b000) libpixman-1.so.0 => /usr/lib/i386-linux-gnu/libpixman-1.so.0 (0xf7591000)
libfontconfig.so.1 =>
/usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xf7555000) libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xf74b5000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xf748d000) libxcb-shm.so.0 => /usr/lib/i386-linux-gnu/libxcb-shm.so.0 (0xf7489000) libxcb-render.so.0 =>
/usr/lib/i386-linux-gnu/libxcb-render.so.0 (0xf747f000) libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xf745c000) libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xf7451000) libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xf731d000) libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xf730a000) libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf72f0000) librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf72e6000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf72a0000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf70f2000) /lib/ld-linux.so.2 (0xf77a8000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xf70c9000) libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xf70c5000) libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xf70bd000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf70b8000)

Juha

Ewald
to Juha Manninen
Juha Manninen wrote 10 lines
FPC has the API wrapper for Cairo lib. I am studying its dependencies and maybe use it in a Linux server with no X Window installed, for generating PDFs. Cairo is advertized to support multiple output devices, including X Window, image buffers, PostScript, PDF, and SVG file output. I understand it means that X Window is required only for the X Window backend. PDF or SVG backends should not require X Window. However on my Linux Mint 17 libcairo has a dependency for libX11.so.6.

Maybe libcairo always links to it, but does not use X11 functionality when XOpenDisplay fails?

Just an idea... I'm no expert on the matter.

Ewald
David W Noon
to Juha Manninen: FPC has the API wrapper for Cairo lib. I am studying its dependencies and maybe use it in…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 7 Apr 2015 22:13:51 +0300, Juha Manninen
() wrote about "[fpc-pascal] Using Cairo lib
on Linux without X" (in
):

[snip]

Cairo is advertized to support multiple output devices, including X Window, image buffers, PostScript, PDF, and SVG file output. I understand it means that X Window is required only for the X Window backend. PDF or SVG backends should not require X Window.

If you build the library from source, you can select various output streams during the configure script. We Gentoo users have that choice since we build almost everything from source with configuration flags to drive the configure script.

However on my Linux Mint 17 libcairo has a dependency for libX11.so.6.

That's because the Mint people have configured it for X11.
- --
Regards,

Dave [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUkMe8ACgkQogYgcI4W/5QOtgCgplRdO5D1YXUHCiIIUKtOGdyB CG0AoLV/tfRJKIGZMwsgHDRnAe0aRHB4
=LJZz
-----END PGP SIGNATURE-----

Graeme Geldenhuys
to Juha Manninen: FPC has the API wrapper for Cairo lib. I am studying its dependencies and maybe use it in…
Juha Manninen wrote
However on my Linux Mint 17 libcairo has a dependency for libX11.so.6.

Pretty much the same here under FreeBSD 10.1

[lib]$ ldd libcairo.so
libcairo.so:
libpixman-1.so.0 => /usr/local/lib/libpixman-1.so.0 (0x8016f8000) libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x80199b000) libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x801bda000) libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x801e70000) libxcb-shm.so.0 => /usr/local/lib/libxcb-shm.so.0 (0x8020a8000) libxcb-render.so.0 => /usr/local/lib/libxcb-render.so.0 (0x8022aa000) libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x8024b3000) libXrender.so.1 => /usr/local/lib/libXrender.so.1 (0x8026d1000) libX11.so.6 => /usr/local/lib/libX11.so.6 (0x8028d9000) libXext.so.6 => /usr/local/lib/libXext.so.6 (0x802c0b000) libz.so.6 => /lib/libz.so.6 (0x802e1c000)
libm.so.5 => /lib/libm.so.5 (0x803032000)
libthr.so.3 => /lib/libthr.so.3 (0x80325a000)
libc.so.7 => /lib/libc.so.7 (0x80081f000)
libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x80347f000) libbz2.so.4 => /usr/lib/libbz2.so.4 (0x8036a5000)
libXau.so.6 => /usr/local/lib/libXau.so.6 (0x8038b7000) libpthread-stubs.so.0 => /usr/local/lib/libpthread-stubs.so.0 (0x803ab9000) libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x803cba000) librpcsvc.so.5 => /usr/lib/librpcsvc.so.5 (0x803ebf000)

Above is the default, but similar to what David W Noon mentioned about Gentoo, under FreeBSD with the ports system I can configure the dependencies without OpenGL, X11 or XCB. So probably compiling libcairo.so yourself is the only option.

Alternative for PDF generation, as I mentioned before to you I believe, fpGUI includes a very good PDF report engine which could easily work without depending on fpGUI or any GUI.

Michael van Canneyt also created a PDF report engine (based on some of the code included in fpGUI), and I believe this is already in FPC Trunk (Michael?).

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
fredvs
to Juha Manninen: FPC has the API wrapper for Cairo lib. I am studying its dependencies and maybe use it in…
If you build the library from source, you can select various output streams during the configure script.

=>

$ sudo apt-get build-dep cairo
$ cd cairo
$ ./configure --disable-libX11
$ make
$ sudo make install

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Using-Cairo-lib-on-Linux-without-X-tp5721574p5721578.html Sent from the Free Pascal - General mailing list .
Juha Manninen
to Graeme Geldenhuys: Pretty much the same here under FreeBSD 10.1 [lib]$ ldd libcairo.so libcairo.so:…

Thanks for answers everybody.

Graeme Geldenhuys wrote
Alternative for PDF generation, as I mentioned before to you I believe, fpGUI includes a very good PDF report engine which could easily work without depending on fpGUI or any GUI.

Don't worry Graeme, I did not forget that PDF engine. It only has so different API that I could not yet join it into our code which currently uses PowerPDF. The standard Canvas API fits there more easily.

Michael van Canneyt also created a PDF report engine (based on some of the code included in fpGUI), and I believe this is already in FPC Trunk (Michael?).

I checked carefully the recent FPC trunk history using your Git mirror and Gitk. I don't see any PDF engine there.
In any case I will continue to adapt the PDF engine either from FpGUI or from FPC once it is committed by Michael.
An ideal situation would be proof of concept versions using both Cairo lib and this pure-Pascal engine.

Regards,
Juha

Juha Manninen
to fredvs: => $ sudo apt-get build-dep cairo $ cd cairo $ ./configure --disable-libX11 $ make $ sudo…
fredvs wrote 6 lines
> If you build the library from source, you can select > various output streams during the configure script. => $ sudo apt-get build-dep cairo

Interesting. That works in Ubuntu but not in Mint. They are more and more distinct.

$ cd cairo

I guess I must download the Cairo sources from somewhere before doing "cd cairo".

$ ./configure --disable-libX11 $ make $ sudo make install

Regards,
Juha

Graeme Geldenhuys
to Juha Manninen: Thanks for answers everybody. On Tue, Apr 7, 2015 at 11:17 PM, Graeme Geldenhuys Don't…
Juha Manninen wrote
different API that I could not yet join it into our code which currently uses PowerPDF.

No worries. Maybe somebody will one day contribute an adapter class for a PowerPDF-to-fpGUI_PDF api. ;-)

I checked carefully the recent FPC trunk history using your Git mirror and Gitk. I don't see any PDF engine there.

I couldn't find it in FPC either. Maybe I jumped the gun a bit with all the things discussed in private emails between Michael and myself.

An ideal situation would be proof of concept versions using both Cairo lib and this pure-Pascal engine.

In fpGUI there is already a PDF engine demo
(<fpgui>/examples/gui/reporting/) which shows many of the PDF engine feature.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
fredvs
to Juha Manninen: Interesting. That works in Ubuntu but not in Mint. They are more and more distinct. I…
$ sudo apt-get build-dep cairo Interesting. That works in Ubuntu but not in Mint. They are more and more distinct.

Ooops, indeed, just try on my Mint 17 => E: Impossible to find source for cairo package...

I guess I must download the Cairo sources from somewhere before doing "cd cairo".

Yep, usually i use sudo apt-get build-dep xxx but it does not work any more...

You may download src from =>
=> http://cairographics.org/releases/cairo-1.14.2.tar.xz => unzip it.
=> $ cd cairo-1.14.2
=> $ ./configure --disable-libX11 (or --disable-X11 ?) (or --enable-X11=no ?)
=> $ make
=> $ sudo make install

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Using-Cairo-lib-on-Linux-without-X-tp5721574p5721582.html Sent from the Free Pascal - General mailing list .
Graeme Geldenhuys
to fredvs
fredvs wrote
Yep, usually i use sudo apt-get build-dep xxx but it does not work any more...

You guys should switch to FreeBSD (or PC-BSD for that matter). ;-)

# cd /usr/ports/graphics/cairo
# make config (to configure the features you want) # make reinstall clean

That would download the latest Cairo release directly from http://cairographics.org, then build and update your existing install.

FreeBSD - Think correctly. ;-)

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
waldo kitty
to Juha Manninen
Juha Manninen wrote 8 lines
On Wed, Apr 8, 2015 at 4:36 PM, fredvs wrote: > Yep, usually i use sudo apt-get build-dep xxx but it does not work any > more... I also have XUbuntu where I could run that command. It downloaded and installed many packages but I don't find the cairo source directory. Where is it?

did you install the dev package as well? probably called cairo-dev...

NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted.
fredvs
to Juha Manninen: I also have XUbuntu where I could run that command. It downloaded and installed many…
Where is it?

Hum, from previous mail ;) =>

You may download src from =>
=> http://cairographics.org/releases/cairo-1.14.2.tar.xz => unzip it.
=> $ cd cairo-1.14.2
=> $ ./configure --disable-libX11 (or --disable-X11 ?) (or --enable-X11=no ?)
=> $ make
=> $ sudo make install

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Using-Cairo-lib-on-Linux-without-X-tp5721574p5721586.html Sent from the Free Pascal - General mailing list .
Juha Manninen
to fredvs
fredvs wrote 10 lines
Hum, from previous mail ;) => You may download src from => => http://cairographics.org/releases/cairo-1.14.2.tar.xz => unzip it. => $ cd cairo-1.14.2 => $ ./configure --disable-libX11 (or --disable-X11 ?) (or --enable-X11=no ?) => $ make => $ sudo make install

Right, sorry, I thought the sources should come from apt-get. I tested the configuration with the flags you suggested and also "--disable-Xlib" but they don't help. There is always : Xlib: yes
Xlib Xrender: yes
I think it must be configured in a machine without X.

FreeBSD or Gentoo would be valid choices except that my final target machine has an Ubuntu server.

I will continue with my experiments. This is not exactly related to FPC or Pascal any more.

Thanks for help.

Juha

Juha Manninen
to Juha Manninen

FYI, I got ssh access to a Linux server and tested a program made with Lazarus CairoCancas with NoGui widgetset.
The machine had Mint Linux and libcairo was installed. X11 was installed, too, but not running. "ldd" shows libcairo depends on X11.

The program amazingly works! It builds a PDF file with Unicode text in different languages.
The program can be found in lazarus/components/cairocanvas/examples in case somebody wants to try it.

Juha