<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7136</bug_id>
          
          <creation_ts>2015-01-13 18:58:29 +0000</creation_ts>
          <short_desc>Packaging non-versioned libraries is non-trivial</short_desc>
          <delta_ts>2022-02-04 07:12:54 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>Development Manual</product>
          <component>development</component>
          <version>2.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.0 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Henry Bruce">henry.bruce</reporter>
          <assigned_to name="Michael Opdenacker">michael.opdenacker</assigned_to>
          <cc>henry.bruce</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>michael.opdenacker</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>47894</commentid>
    <comment_count>0</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2015-01-13 18:58:29 +0000</bug_when>
    <thetext>When creating a recipe to package a pre-built closed source shared library the default package was not created.

Basis of libfoo_0.1.bb looked like this.

SRC_URI = &quot;file://libfoo.so&quot;
FILES_${PN} = &quot;${libdir}/libfoo.so&quot;
do_install () {
   install -m 0755 -d ${D}${libdir}
   install -m 0644 ${WORKDIR}/libfoo.so ${D}${libdir}
}

&quot;bitbake libfoo&quot; ran just fine but libfoo_0.1_arch.ipk was not created. 
libfoo.so was in images, package and sysroot-destdir folders 
but was not in packages-split/libfoo and had not been selected for packaging. 
No errors or warning could be found in any logs.

I worked around the issue by adding the following line
PACKAGES = &quot;${PN} ${PN}-dbg ${PN}-dev&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47936</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-01-15 15:10:07 +0000</bug_when>
    <thetext>This is due to the fact that these prebuilt libraries you have don&apos;t follow the standard naming practices for Linux shared libraries. For example on my Ubuntu system:

lrwxrwxrwx 1 root root     35 May 13  2013 /usr/lib/x86_64-linux-gnu/libz.so -&gt; /lib/x86_64-linux-gnu/libz.so.1.2.8
lrwxrwxrwx 1 root root     13 May 13  2013 /lib/x86_64-linux-gnu/libz.so.1 -&gt; libz.so.1.2.8
-rw-r--r-- 1 root root 100728 May 13  2013 /lib/x86_64-linux-gnu/libz.so.1.2.8

So there is a .so file symlinked to a .so.&lt;majorversion&gt; which in turn links to a .so.&lt;minorversion&gt;.&lt;pointversion&gt;

Our default patterns for library packaging match this format, not the one your closed source shared libs are using. This isn&apos;t really something we&apos;d want to change the defaults for.

Note that your lib would have been packaged, its just the .so file would have been placed into libfoo-dev_0.1_arch.ipk since the system would (incorrectly) think it was a development file.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47946</commentid>
    <comment_count>2</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2015-01-15 19:23:43 +0000</bug_when>
    <thetext>Richard - thanks for taking the time to look a this.

I tried installing as per standard shared library naming practices, but .so file is still omitted from ipk. Snippet from intuvision_6.3.1.bb below installs libintuVision.so.6.3.1 and libintuVision.so.6 but not libintuVision.so

libiv = &quot;libintuVision.so&quot;
do_install () {
   PV_MAJOR=`echo ${PV} | cut -d &apos;.&apos; -f 1`
   install -m 0755 -d ${D}${libdir}
   install -m 0644 ${WORKDIR}/${MACHINE_ARCH}/${libiv}.${PV} ${D}${libdir}
   ln -sf ${D}${libdir}/${libiv}.${PV} ${D}${libdir}/${libiv}.${PV_MAJOR}
   ln -sf ${D}${libdir}/${libiv}.${PV} ${D}${libdir}/${libiv}  
}

Feedback on do_install is welcome!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47949</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-01-15 21:06:25 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Richard - thanks for taking the time to look a this.
&gt; 
&gt; I tried installing as per standard shared library naming practices, but .so
&gt; file is still omitted from ipk. Snippet from intuvision_6.3.1.bb below
&gt; installs libintuVision.so.6.3.1 and libintuVision.so.6 but not
&gt; libintuVision.so
&gt; 
&gt; libiv = &quot;libintuVision.so&quot;
&gt; do_install () {
&gt;    PV_MAJOR=`echo ${PV} | cut -d &apos;.&apos; -f 1`
&gt;    install -m 0755 -d ${D}${libdir}
&gt;    install -m 0644 ${WORKDIR}/${MACHINE_ARCH}/${libiv}.${PV} ${D}${libdir}
&gt;    ln -sf ${D}${libdir}/${libiv}.${PV} ${D}${libdir}/${libiv}.${PV_MAJOR}
&gt;    ln -sf ${D}${libdir}/${libiv}.${PV} ${D}${libdir}/${libiv}  
&gt; }
&gt; 
&gt; Feedback on do_install is welcome!

When you did this, did you remember to remove the FILES and PACKAGES changes you&apos;d made? This should work...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47950</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-01-15 21:08:50 +0000</bug_when>
    <thetext>I&apos;d also add that there are the oe_soinstall and oe_libinstall functions (see meta/classes/utils.bbclass) which can handle some of this for you.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48007</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-01-16 16:41:13 +0000</bug_when>
    <thetext>If the binary comes as a .so I wouldn&apos;t bother making symlinks as they&apos;ll never be used.  The solution here is to just set FILES_${PN} = &quot;${libdir]/*.so&quot;

Some form of additional sanity test to identify this happening would be useful as many people don&apos;t know how library versioning is meant to work - I find myself answering this for someone in bugzilla/irc/mailing list once every few weeks.  Something along the lines of &quot;if PN is empty and PN-dev contains a .so that isn&apos;t a symlink, warn&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48052</commentid>
    <comment_count>6</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2015-01-19 23:28:36 +0000</bug_when>
    <thetext>Ross: I agree with your comments. They would certainly improve ease of use with pre-built binaries. I set FILES_${PN} = &quot;${libdir}/*.so&quot; , but no change in behavior. .so is still not packaged.

Richard: My &apos;intuvision&apos; example used default FILES and PACKAGES values but .so is still not packaged. Thanks for heads up on oe_soinstall. This caused a &apos;too much recursion&apos; python exception at split_and_strip_files line 222. Further investigation showed that vendor&apos;s so did not have an ELF &apos;soname&apos; tag and oe_soinstall does not test for its absence. Maybe this is the root cause. I&apos;ll get vendor to add the tag and report back.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48053</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-01-19 23:34:24 +0000</bug_when>
    <thetext>Sorry, you&apos;ll need to unset FILES_${PN}-dev, which will be taking the files before ${PN} can.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48054</commentid>
    <comment_count>8</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2015-01-20 00:06:09 +0000</bug_when>
    <thetext>Ross: I also need to package include files so my app can use this library. Unsetting FILES_${PN}-dev causes an &quot;installed but not shipped&quot; error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48061</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-01-20 11:25:05 +0000</bug_when>
    <thetext>So you&apos;ll need something like this:

FILES_${PN} = &quot;${libdir}/*.so&quot;
FILES_${PN}-dev = &quot;${includedir}/*.h&quot;

Fix the paths as appropriate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48912</commentid>
    <comment_count>10</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2015-02-18 18:01:14 +0000</bug_when>
    <thetext>I received .so from vendor with SONAME tag and oe_soinstall now works as expected, creating valid package.

do_install () {
   install -m 0755 -d ${D}${libdir}
   oe_soinstall ${WORKDIR}/${MACHINE_ARCH}/libintuVision.so.${PV} ${D}${libdir}
   oe_soinstall ${WORKDIR}/${MACHINE_ARCH}/libDigitalVideo.so.${PV} ${D}${libdir}
   install -m 0755 -d ${D}${includedir}
   install -m 0755 ${WORKDIR}/include/* ${D}${includedir}
}

Ross: If I had time to fiddle about with recipe I may have been able to generate a package with .so that didn&apos;t have SONAME tag, but I didn&apos;t think it was worth the effort.

Going forward I recommend three steps
1. Document process of adding prebuilt libraries. Is there a place I can do this so that Scott can edit content and transfer to public docs?
2. Open a new issue for oe_soinstall throwing an exception if .so doesn&apos;t have SONAME tag
3. Don&apos;t silently fail to package a library if that is obviously the intent of the recipe. Not so sure how to fix this.

I&apos;ll do (1) and (2). Maybe this bug stays open to flag (3). I&apos;ll attempt to fix (2) and send a patch to mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49622</commentid>
    <comment_count>11</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2015-03-21 21:15:14 +0000</bug_when>
    <thetext>Henry, did filing new bugs for (1) and (2) happen?

I&apos;m not sure what could be done about (3), maybe sanity-checking that libfoo.so in the -dev package is a symlink?  I wonder if that would have too many false-positives.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64501</commentid>
    <comment_count>12</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-07-26 16:43:25 +0000</bug_when>
    <thetext>For future reference I think the neatest way to package a non-versioned library would be to:

# This says that the real library is .so
SOLIBS=&quot;.so&quot;
# This clears the dev library names so they don&apos;t get packaged into PN-dev
FILES_SOLIBSDEV=&quot;&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65209</commentid>
    <comment_count>13</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2016-08-15 21:57:57 +0000</bug_when>
    <thetext>Sorry, I dropped the ball on this.

(1). Thanks to Ross for addressing this in https://wiki.yoctoproject.org/wiki/TipsAndTricks/PackagingNonversionedLibrary
(2) I created bug 10146.
(3) I&apos;ll go with Ross&apos;s recommendation and drop the request as this doesn&apos;t seem to be an issue for anyone else.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66144</commentid>
    <comment_count>14</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-09-14 15:58:17 +0000</bug_when>
    <thetext>(2) is now integrated so this bug is now about getting (1) into the actual documentation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66361</commentid>
    <comment_count>15</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-09-20 15:20:04 +0000</bug_when>
    <thetext>Scott, can you massage the documentation I wrote at https://wiki.yoctoproject.org/wiki/TipsAndTricks/PackagingNonversionedLibrary into the manual?  Under the development manual seems sensible, maybe a subsection under Writing A New Recipe?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86157</commentid>
    <comment_count>16</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2020-01-29 16:49:11 +0000</bug_when>
    <thetext>Assigning to Mark.

Mark, see comment #15.  I wrote a wiki page with an overview for packaging non-versioned libraries which needs to be integrated somewhere into the proper documentation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92466</commentid>
    <comment_count>17</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2022-02-03 16:15:44 +0000</bug_when>
    <thetext>Now closed in &quot;master&quot;
https://git.yoctoproject.org/yocto-docs/commit/?id=5e46cad9e4b4ab03e33f4d5aea34e56f6b15fe27</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92474</commentid>
    <comment_count>18</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2022-02-04 07:12:54 +0000</bug_when>
    <thetext>Available on https://docs.yoctoproject.org/dev-manual/common-tasks.html#working-with-pre-built-libraries</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>