LinkLib Issues In freebsd Lazarus

Mike Meyer mwm-keyword-freebsdquestions.8c5a2e at mired.org
Sun Jul 16 21:03:29 UTC 2006


This is really more appropriate for -questions, so I've redirected it
there.

In <44BA98A9.9040903 at tamara-b.org>, Bob Richards <bob at tamara-b.org> typed:
> Hi Folks:
> 
> I believe this is a "hacker" issue, at least any possible solution is.
> 
> I recently moved from Linux to FreeBSD as my primary work environment.
> My development system of choice is FreePascal. I installed FPC-2.0.2
> from the official FreePascal distribution tar ball

I'd say this is a mistake. You should probably install the fpc port in
/usr/ports/lang/fpc. There may be reasons to install your own version
instead of a port, but you haven't presented any.

> My next step was to install Lazarus, the FPC IDE, and here is where I
> have run into troubles.

Again, you should probably have used the ports version, in
editors/fpc-ide.

> A tar-ball install ran well until Lazarus was being Linked. The errors were:
> 
> the following libraries were not found by ld: glib12, gdk12, and gtk12.

Where did you get these from? And what versions are they?

> a grep -r in the FPC-2.0.2 source tree revealed the problems, in every
> case of:
> 
> packages/extra/ glib, gtk, and  gdk the linklib statements were wrong thus:
> 
>  {$ifdef FreeBSD}
>    gtkdll='gtk12';
>    {$linklib gtk12}
> 
> So, I created a patch to fix the above constructs to:
> 
>   {$ifdef FreeBSD}
>      gtkdll='gtk-12';
>      {$linklib gtk-12}
> 
> For all three libraries; since freebsd names these libraries with a "-"
> 
> I recompiled and reinstalled FPC-2.0.2 with the patches applied,
> re-tested the compiler; all OK!
> 
> I went back to the Lazarus source tree gmake clean; gmake and received
> the following error:
> 
>   Free Pascal Compiler version 2.0.2 [2006/07/14] for i386
>   Copyright (c) 1993-2005 by Florian Klaempfl
>   Target OS: FreeBSD/ELF for i386
>   Compiling lazarus.pp
>   Linking ../lazarus
>   /usr/bin/ld: cannot find -lgdk_pixbuf
>   lazarus.pp(113,1) Error: Error while linking
> 
> a locate gdk_pixbuf finds: /usr/X11R6/lib/libgdk_pixbuf-2.0
> 
> So, at this point I just sym-linked my libgdk_pixbuf-2.0 to
> libgdk_pixbuf: ln -s libgdk_pixbuf-2.0.a libgdk_pixbuf.a

This is almost certainly a mistake, as a major version number change
indicates that the interface changed.

> and ran gmake again, only to produce:
> 
> Linking ../lazarus
> /usr/home/bob/lazarus/lcl/units/i386-freebsd/gtk/gtkint.o(.text+0x6f65):
> In function `DATASOURCEINITIALIZE':
> gtkobject.inc:2309: undefined reference to `gdk_pixbuf_get_from_drawable'
> 
> Many many more "undefined reference" to something missing in  gdk_pixbuf.

Well, yeah - you're linking against *the wrong library*. My system has
a /usr/X11R6/lib/libgdk_pixbuf.a, installed from the
graphics/gdk-pixbuf port. That does have the function you're looking
for.

> so: freebsd's stock-installed gdk_pixbuf does not contain the functions
> needed!

No, FreeBSD's stock-installed gdk_pixbuf-2.0 does not contain the
functions you need from gdk_pixbuf. This should not be surprising.

> So, I went to ports and found "ruby18-gdk_pixbuf2-0.14.1" a make
> install provided "gdk_pixbuf2.so" but no "gdk_pixbuf2.a" !! I find it
> odd that no provision is provided to link to this lib!

Again, you *don't want* gdk_pixbuf2. And that port doesn't provide
gdk_pixbuf2, but almost certainly requires it, so it'll install the
port to provide that library if it isn't there. But that doesn't help
you at all.

> Funny! I moved away from Linux mainly because of Library-Hell issues :-)

Shared library versioning hell is platform-independent. In general,
FreeBSD's port/package system is older than Linux package
managers. This means they got to learn from it, and are in some ways
better. On the other hand, it also means that the freebsd ports system
has features that those systems may not have yet.

In particular, you can use the sysutils/portupdate port to update
ports, and it will move old versions of shared librarys out of the way
so they don't confuse new builds, but will still be found by older
packages that depend on them.

You can also use the sysutils/portsearch port to find files that the
ports will install for you.

> Any thoughts on this would be greatly appreciated. I seem to have run
> out of things to try here. Surely someone has successfully compiled
> Lazarus on freebsd....

I'd install the fpc and fpc-ide ports. If you want to continue the way
you started, delete your bogus symlink, and install the
graphics/gdk-pixbuf port to get the library you need.

	<mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.


More information about the freebsd-questions mailing list