<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic shared libraries, internal names and search paths in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-internal-names-and-search-paths/m-p/4437897#M682713</link>
    <description>&lt;!--!*#--&gt;I am using boost-build to manage a project consisting of several libraries,&lt;BR /&gt;many of which depend on libraries that are part of the project. Boost-build&lt;BR /&gt;builds link lines that specify dependent libraries using a relative path to &lt;BR /&gt;the library, rather than using the typical -L&lt;SEARCH path=""&gt; -l&lt;LIBNAME&gt;&lt;BR /&gt;options. This causes a problem because the linker embeds the dependent library&lt;BR /&gt;name as the entire path passed on the link line. In an attempted work around,&lt;BR /&gt;I told boost build to build each lib with an internal name using the +h &lt;BR /&gt;linker option. This seems to work OK when I have a single dependency, but &lt;BR /&gt;fails when I have more than one. For example, suppose I have three libs, foo, &lt;BR /&gt;bar and baz, bar depends on foo and baz depends on bar, each built in their own&lt;BR /&gt;directory. The first two libraries get built like so:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ cd foo; aCC -c foo.c; aCC -b -Wl,+h,libfoo.so -olibfoo.so foo.o ; cd ..&lt;BR /&gt;$ cd bar; aCC -c -I../foo bar.c; aCC -b -Wl,+h,libbar.so -olibbar.so bar.o ../foo/libfoo.so ; cd ..&lt;BR /&gt;&lt;BR /&gt;The problem comes when I build the third:&lt;BR /&gt;$ cd baz; aCC -c -I../bar baz.c; aCC -b -olibbaz.so baz.o ../bar/libbar.so&lt;BR /&gt;ld: Can't find dependent library "libfoo.so"&lt;BR /&gt;Fatal error.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Even if I add libfoo to the link line, I get the same error:&lt;BR /&gt;$ aCC -b -olibbaz.so baz.o ../bar/libbar.so ../foo/libfoo.so&lt;BR /&gt;ld: Can't find dependent library "libfoo.so"&lt;BR /&gt;Fatal error.&lt;BR /&gt;&lt;BR /&gt;However, if I add a search path, it links:&lt;BR /&gt;$ aCC -b -olibbaz.so baz.o ../bar/libbar.so -L../foo&lt;BR /&gt;&lt;BR /&gt;Shouldn't the linker use the libraries supplied on the command line to satisfy &lt;BR /&gt;dependencies?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Jim Gallagher&lt;/LIBNAME&gt;&lt;/SEARCH&gt;</description>
    <pubDate>Thu, 11 Jun 2009 18:33:15 GMT</pubDate>
    <dc:creator>Jim Gallagher</dc:creator>
    <dc:date>2009-06-11T18:33:15Z</dc:date>
    <item>
      <title>shared libraries, internal names and search paths</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-internal-names-and-search-paths/m-p/4437897#M682713</link>
      <description>&lt;!--!*#--&gt;I am using boost-build to manage a project consisting of several libraries,&lt;BR /&gt;many of which depend on libraries that are part of the project. Boost-build&lt;BR /&gt;builds link lines that specify dependent libraries using a relative path to &lt;BR /&gt;the library, rather than using the typical -L&lt;SEARCH path=""&gt; -l&lt;LIBNAME&gt;&lt;BR /&gt;options. This causes a problem because the linker embeds the dependent library&lt;BR /&gt;name as the entire path passed on the link line. In an attempted work around,&lt;BR /&gt;I told boost build to build each lib with an internal name using the +h &lt;BR /&gt;linker option. This seems to work OK when I have a single dependency, but &lt;BR /&gt;fails when I have more than one. For example, suppose I have three libs, foo, &lt;BR /&gt;bar and baz, bar depends on foo and baz depends on bar, each built in their own&lt;BR /&gt;directory. The first two libraries get built like so:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ cd foo; aCC -c foo.c; aCC -b -Wl,+h,libfoo.so -olibfoo.so foo.o ; cd ..&lt;BR /&gt;$ cd bar; aCC -c -I../foo bar.c; aCC -b -Wl,+h,libbar.so -olibbar.so bar.o ../foo/libfoo.so ; cd ..&lt;BR /&gt;&lt;BR /&gt;The problem comes when I build the third:&lt;BR /&gt;$ cd baz; aCC -c -I../bar baz.c; aCC -b -olibbaz.so baz.o ../bar/libbar.so&lt;BR /&gt;ld: Can't find dependent library "libfoo.so"&lt;BR /&gt;Fatal error.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Even if I add libfoo to the link line, I get the same error:&lt;BR /&gt;$ aCC -b -olibbaz.so baz.o ../bar/libbar.so ../foo/libfoo.so&lt;BR /&gt;ld: Can't find dependent library "libfoo.so"&lt;BR /&gt;Fatal error.&lt;BR /&gt;&lt;BR /&gt;However, if I add a search path, it links:&lt;BR /&gt;$ aCC -b -olibbaz.so baz.o ../bar/libbar.so -L../foo&lt;BR /&gt;&lt;BR /&gt;Shouldn't the linker use the libraries supplied on the command line to satisfy &lt;BR /&gt;dependencies?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Jim Gallagher&lt;/LIBNAME&gt;&lt;/SEARCH&gt;</description>
      <pubDate>Thu, 11 Jun 2009 18:33:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-internal-names-and-search-paths/m-p/4437897#M682713</guid>
      <dc:creator>Jim Gallagher</dc:creator>
      <dc:date>2009-06-11T18:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: shared libraries, internal names and search paths</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-internal-names-and-search-paths/m-p/4437898#M682714</link>
      <description>&amp;gt;build each lib with an internal name using the +h&lt;BR /&gt;&lt;BR /&gt;I wouldn't think that's the purpose of +h but it works.&lt;BR /&gt;&lt;BR /&gt;If you leave off -Wl,+h, it also links.  But I suppose you want to solve the issue in your other thread:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1347136" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1347136&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Shouldn't the linker use the libraries supplied on the command line to satisfy&lt;BR /&gt;dependencies?&lt;BR /&gt;&lt;BR /&gt;Why?  These can be completely different files:&lt;BR /&gt;libfoo.so from the dependent shlib and ../foo/libfoo.so.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if I add a search path, it links:&lt;BR /&gt;&lt;BR /&gt;Yes, -L also affects searching for dependent shlibs.</description>
      <pubDate>Fri, 12 Jun 2009 05:58:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shared-libraries-internal-names-and-search-paths/m-p/4437898#M682714</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-12T05:58:21Z</dc:date>
    </item>
  </channel>
</rss>

