Recent

Author Topic: /usr/bin/ld: cannot find -lgdk-x11-2.0  (Read 14888 times)

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« on: October 07, 2006, 01:19:37 am »
hi guys,


i believe to have all the necessary libs installed, but i can't compile lazarus for gtk2 nor any gtk2-applications?! just gtk1, but i seriously want gtk2, any ideas?



ciao
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: /usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #1 on: October 07, 2006, 02:06:10 am »
That message means that you need to install a package probably named libgdk-x11-2.0

Which distribution do you use? Each distro has a different tool to install packages.

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #2 on: October 07, 2006, 02:20:55 am »
well, i've got debian etch and can't find such a package in apt, not even a similar...
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #3 on: October 07, 2006, 02:28:13 am »
i just found a rpm-file which contains that library.
when i made a .deb out of it and tried to install it...

dpkg: error processing libgtk+-x11-2.0-0_2.8.3-4.1_i386.deb (--install):
 trying to overwrite `/usr/lib/libgdk-x11-2.0.so.0', which is also in package libgtk2.0-0


..which means, that i do have that file, but how to tell lazarus that it is located there?



ciao
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #4 on: October 07, 2006, 03:06:40 am »
You have the library, but Lazarus need the development packages that is linked to that library.

More specifically, take a look at the name of the library:

/usr/lib/libgdk-x11-2.0.so.0

Notice the .so.0 on the end. This is a trick that allows many different versions of a single library to be installed on the same system. Your software will actually look for a libgdk-x11-2.0.so, and if linux fids a .0, a .1 and a .2 it will choose the correct one for your software.

But on the linking process we need the exact name of the library, so what development packages do is create a simbolic link from /usr/lib/libgdk-x11-2.0.so --> /usr/lib/libgdk-x11-2.0.so.0

So you can just create that simbolic link manually and it's the same as if you installed the devel package.

The command to create simbolic links is: "ln -s"

don't remember exactly which should go first, the target or the link on the parameters

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #5 on: October 07, 2006, 03:37:00 am »
the file goes first, then the target/symbolic link

well, i did it and it solved the problem, thank you very much, but compiling still doesn't success, the error now is


/usr/bin/ld: cannot find -lgdk_pixbuf-2.0
project1.lpr(17,1) Error: Error while linking


here you can see a list of all my files in /usr/lib, beginning with libgdk_pixbuf, the first entry there is a symbolic link i made, i hoped that it will solve that problem like the one before, but i just did not. maybe you know what to do now?

Code: [Select]
/usr/lib# ls -l libgdk_pixbuf*
lrwxrwxrwx 1 root root     22 2006-10-07 03:24 libgdk_pixbuf-2.0 -> libgdk_pixbuf-2.0.so.0
lrwxrwxrwx 1 root root     29 2006-10-06 22:49 libgdk_pixbuf-2.0.so.0 -> libgdk_pixbuf-2.0.so.0.800.20
-rw-r--r-- 1 root root  88724 2006-08-14 18:40 libgdk_pixbuf-2.0.so.0.800.20
-rw-r--r-- 1 root root 101222 2005-11-16 20:22 libgdk_pixbuf.a
-rw-r--r-- 1 root root    980 2005-11-16 20:22 libgdk_pixbuf.la
lrwxrwxrwx 1 root root     22 2006-10-07 01:01 libgdk_pixbuf.so -> libgdk_pixbuf.so.2.0.0
lrwxrwxrwx 1 root root     22 2006-10-07 00:53 libgdk_pixbuf.so.2 -> libgdk_pixbuf.so.2.0.0
-rw-r--r-- 1 root root  77700 2005-11-16 20:22 libgdk_pixbuf.so.2.0.0
lrwxrwxrwx 1 root root     34 2006-10-06 22:49 libgdk_pixbuf_xlib-2.0.so.0 -> libgdk_pixbuf_xlib-2.0.so.0.800.20
-rw-r--r-- 1 root root  57552 2006-08-14 18:40 libgdk_pixbuf_xlib-2.0.so.0.800.20
-rw-r--r-- 1 root root 139678 2005-11-16 20:22 libgdk_pixbuf_xlib.a
-rw-r--r-- 1 root root   1041 2005-11-16 20:22 libgdk_pixbuf_xlib.la
lrwxrwxrwx 1 root root     27 2006-10-07 01:01 libgdk_pixbuf_xlib.so -> libgdk_pixbuf_xlib.so.2.0.0
lrwxrwxrwx 1 root root     27 2006-10-07 00:53 libgdk_pixbuf_xlib.so.2 -> libgdk_pixbuf_xlib.so.2.0.0
-rw-r--r-- 1 root root 113900 2005-11-16 20:22 libgdk_pixbuf_xlib.so.2.0.0
[/color]


ciao
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #6 on: October 07, 2006, 03:51:37 am »
Quote from: "miro"
the first entry there is a symbolic link i made, i hoped that it will solve that problem like the one before, but i just did not. maybe you know what to do now?


The simbolic link should be called: libgdk_pixbuf-2.0.so

And not: libgdk_pixbuf-2.0

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #7 on: October 07, 2006, 04:19:16 am »
hm, thanks a lot, i did that - and the same with about 20 additional libraries. i just don't know, why lazarus needs such a setup? i mean, i've got another computer with the same version installed and everything works fine there...maybe it is just a malconfiguration of my system, i'm not sure....


however, thanks for the support, i also just compiled lazarus iself for gtk2
just one single additional question...
if i compile very small programs, for example, an application with a simple close-button....then it becomes several MB large, about 7mb - that isn't normal, isn't it? how do decrease the filesize of the executables?


ciao
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #8 on: October 07, 2006, 04:36:13 am »
Quote from: "miro"
hm, thanks a lot, i did that - and the same with about 20 additional libraries. i just don't know, why lazarus needs such a setup?


It's not lazarus that needs it. I think this is a requirement of the GNU Linker to link software. In this case to link to gtk2 you need the simbolic links to gtk2 packages

Quote
i mean, i've got another computer with the same version installed and everything works fine there...maybe it is just a malconfiguration of my system, i'm not sure....


Well, that computer probably has the appropriate development packages installed.

Quote
however, thanks for the support,


You are welcome =)

Quote
i also just compiled lazarus iself for gtk2
just one single additional question...
if i compile very small programs, for example, an application with a simple close-button....then it becomes several MB large, about 7mb - that isn't normal, isn't it? how do decrease the filesize of the executables?


That executable contains debug information so you can use the step-by-step debugger on the IDE. To remove it and get a stripped executable, go to the console and write:

strip --strip-all myexecutable

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #9 on: October 07, 2006, 04:39:14 am »
hi,


thanks again. well, that decreased the size from 7mb to 2,5, but it stil seems to be too much, hm?
once someone told me that lazarus links the libraries too, i'm not sure, do you know more..?


ciao
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #10 on: October 07, 2006, 05:13:30 am »
Quote from: "miro"
thanks again. well, that decreased the size from 7mb to 2,5, but it stil seems to be too much, hm?
once someone told me that lazarus links the libraries too, i'm not sure, do you know more..?


I created an image to illustrate this:

http://wiki.lazarus.freepascal.org/images/d/de/Lazarus_vs_cpp.png

What happens is that the hello world lazarus software already includes a huge amount of features. It includes:

* XML handling library
* Image handling library for png, xpm, bmp and ico files
* Almost all widgets from the Lazarus Component Library
* All of the Free Pascal Runtime Library

So it's very big, but it already includes almost everything a realworld non-trivial app will need.

The key thing is that because of the Free Pascal compiler and the way lazarus forms operate, the software will increase in size very slowly when you add extra forms, and add code to it.

So in fact, Lazarus produces horrible hello worlds, but in a real world app it's size very quickly becomes much smaller then a comparable project in c++ for example.

Lazarus executable size starts big, bug grows very slowly. My lazarus ide executable has 8 MB, and it has millions of lines of code, and hundreds of forms.

A c++ project (just an example, but applies to other languages / tools too) starts very small on the hello world, but quickly grows exponencially when you need features to write a non-trivial application.

miro

  • New member
  • *
  • Posts: 7
    • http://xrmb2.net/
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #11 on: October 10, 2006, 12:41:10 pm »
hi,


thanks again, very much for your help. i've got everything running and didn't know about that fact about the filesize...


ciao
http://xrmb2.net/
Got Screenshots? Place them here:
.. XrMb2 ImageHost ..

Spike

  • New member
  • *
  • Posts: 9
/usr/bin/ld: cannot find -lgdk-x11-2.0
« Reply #12 on: October 29, 2006, 04:19:21 pm »
You can also use upx to further reduce the executable size
http://upx.sourceforge.net/

 

TinyPortal © 2005-2018