ldglibclazarusfreepascallibrary-path

Which missing library results in the message '/usr/bin/ld: cannot find -lglib-2.0'?


I am cross compiling a Lazarus program, creating a 32bit program on a 64bit Ubuntu 14.04 Trusty Tahr system, and everything apparently compiles to the very end when I get this messsage

/usr/bin/ld: cannot find -lglib-2.0

What is the full name of the library whose absence results in this error mesage?

libc6-dev:i386 appears to be the most likely library, but when I try to install it with apt indicates build-essential g++ gcc gcc-multilib will be removed so I abort it.

sudo apt-get install libc6-dev:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  linux-libc-dev linux-libc-dev:i386
Suggested packages:
  glibc-doc:i386 manpages-dev:i386
Recommended packages:
  gcc:i386 c-compiler:i386
The following packages will be REMOVED
  build-essential g++ gcc gcc-multilib
The following NEW packages will be installed
  libc6-dev:i386 linux-libc-dev:i386
The following packages will be upgraded:
  linux-libc-dev
1 to upgrade, 2 to newly install, 4 to remove and 18 not to upgrade.
Need to get 3,126 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Solution

  • It turns out it was the libglib2.0-0:i386 package. It was already installed earlier, but it had not been fully configured.

    It was present in the /lib/i386-linux directory and I had to create a symlink to it include it to the fpc.cfg configuration file used by Free Pascal.

    locate libglib | grep ^/lib produced:

    /lib/i386-linux-gnu/libglib-2.0.so.0
    /lib/i386-linux-gnu/libglib-2.0.so.0.4002.0
    /lib/x86_64-linux-gnu/libglib-2.0.so.0
    /lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0
    

    I symlinked it with the expected name:

    ln -s /lib/i386-linux-gnu/libglib-2.0.so.0 /lib/i386-linux-gnu/libglib-2.0.so
    

    then added to the Lazarus installations fpc.cfg file

    #ifdef cpui386
     -Fl/usr/lib32
     -Fl/lib/i386-linux-gnu
    #endif