Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2014 16:18:50 GMT
From:      Natacha Porté <natbsd@instinctive.eu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   docs/190146: [patch] make explicit how to install static libraries
Message-ID:  <201405231618.s4NGIoCU008893@cgiserv.freebsd.org>
Resent-Message-ID: <201405231620.s4NGK1Vc010530@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         190146
>Category:       docs
>Synopsis:       [patch] make explicit how to install static libraries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 23 16:20:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Natacha Porté
>Release:        9.2-RELEASE
>Organization:
>Environment:
FreeBSD yulai 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
A lot of ports are currently using $(INSTALL_LIB) macro to install static libraries (*.a files), presumably because the name hints at installing any kind of library.

However stripping breaks static libraries, since they are only an archives of object files not yet linked.

I detailed my analysis in PR ports/188993, which was the first port I encountered with the problem. I later discovered that there are a lot of them affected. I guess the problem does not manifests often, since static linking is seldom used.

Currently, the porter's handbook doesn't say anything about static libraries. The attached patch adds a specific note about them, and distinguish them from shared libraries.
>How-To-Repeat:
Run

grep -r 'INSTALL_LIB.*\.a' /usr/ports

and see the amount of matches
>Fix:
Hopefully patching the documentation will help porters install static libraries correctly in the future.

Patch attached with submission follows:

Index: en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
===================================================================
--- en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml	(revision 44916)
+++ en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml	(working copy)
@@ -4362,7 +4362,8 @@
 
 	<listitem>
 	  <para><varname>INSTALL_LIB</varname> is a command to
-	    install shared libraries.</para>
+	    install shared libraries (but not static
+	    libraries).</para>
 	</listitem>
 
 	<listitem>
@@ -4375,7 +4376,7 @@
 
 	<listitem>
 	  <para><varname>INSTALL_DATA</varname> is a command to
-	    install sharable data.</para>
+	    install sharable data, including static libraries.</para>
 	</listitem>
 
 	<listitem>
@@ -4387,6 +4388,13 @@
 
       <para>These are basically the <command>install</command>
 	command with all the appropriate flags.</para>
+
+      <note>
+	<para>Do not use <varname>INSTALL_LIB</varname> to install
+	  static libraries (<filename>*.a</filename>), because
+	  stripping them render them useless. Use
+	  <varname>INSTALL_DATA</varname> instead.</para>
+      </note>
     </sect2>
 
     <sect2 xml:id="install-strip">


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405231618.s4NGIoCU008893>