title: How correct link program with libperl.so
body: <p>How correct linking with libperl.so</p>
  <p>I use Fedora Core 16 and try to compile program with embedding perl follows way:</p>
  <pre><code>gcc -W -Wall -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -I/usr/include -I/usr/lib/include -I/usr/lib/perl5/CORE -c program.c
  gcc -L/lib -L/usr/lib/perl5/CORE -lperl -o program.run program.o
  </code></pre>
  <p>After trying to run program I getting following message:</p>
  <pre><code>error while loading shared libraries: libperl.so: cannot open shared object file: No such file or directory
  </code></pre>
  <p>if execute following command 'ldd program.run' then it output to console</p>
  <pre><code>ldd ./program.run 
      linux-gate.so.1 =&gt;  (0xb7751000)
      libperl.so =&gt; not found
      libc.so.6 =&gt; /lib/libc.so.6 (0x4eea5000)
      /lib/ld-linux.so.2 (0x4ee80000)
  </code></pre>
  <p>Yes i can set LD_LIBRARY_PATH environment variable and program will be work, but if i execute same command for '/usr/bin/perl' library will be found without setting specific environment variable e.g</p>
  <pre><code>ldd `which perl`
      linux-gate.so.1 =&gt;  (0xb77f4000)
      libperl.so =&gt; /usr/lib/perl5/CORE/libperl.so (0xb767b000)
      libresolv.so.2 =&gt; /lib/libresolv.so.2 (0x4f22f000)
      libnsl.so.1 =&gt; /lib/libnsl.so.1 (0x42eaf000)
      libdl.so.2 =&gt; /lib/libdl.so.2 (0x4f055000)
      libm.so.6 =&gt; /lib/libm.so.6 (0x4f085000)
      libcrypt.so.1 =&gt; /lib/libcrypt.so.1 (0x41ee6000)
      libutil.so.1 =&gt; /lib/libutil.so.1 (0x42ecc000)
      libpthread.so.0 =&gt; /lib/libpthread.so.0 (0x4f05c000)
      libc.so.6 =&gt; /lib/libc.so.6 (0x4eea5000)
      /lib/ld-linux.so.2 (0x4ee80000)
      libfreebl3.so =&gt; /lib/libfreebl3.so (0x42492000)
  </code></pre>
  <p>How correct link program with libperl.so</p>