Bug 188993 - devel/florist-gpl unusable because libflorist.a has no symbol
Summary: devel/florist-gpl unusable because libflorist.a has no symbol
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: John Marino
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-25 17:10 UTC by Natacha Porté
Modified: 2014-04-26 02:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Natacha Porté 2014-04-25 17:10:00 UTC
When linking a project involving florist (hmac-md5 in this example), I guess a lot of errors caused by undefined symbols, like in the following transcript:


gnatbind -x /home/nat/code/natools/obj/hmac-md5.ali
gnatlink /home/nat/code/natools/obj/hmac-md5.ali -O3 /usr/local/lib/florist/libf
lorist.a -Wl,-rpath,/usr/local/gcc-aux/lib/gcc/x86_64-aux-freebsd9.2/4.9.0/adali
b/ -o /home/nat/code/natools/bin/hmac-md5
b~hmac-md5.o: In function `ada_main__finalize_library':
b~hmac-md5.adb:(.text+0x10): undefined reference to `posix__signals_E'
b~hmac-md5.adb:(.text+0x1a): undefined reference to `posix__signals_E'
b~hmac-md5.adb:(.text+0x1f): undefined reference to `posix__signals__finalize_sp
ec'
b~hmac-md5.o: In function `adainit.part.0':
b~hmac-md5.adb:(.text+0x895): undefined reference to `posix___elabs'
b~hmac-md5.adb:(.text+0x89c): undefined reference to `posix_E'
b~hmac-md5.adb:(.text+0x8a6): undefined reference to `posix_E'
[cut of about ~100 "undefined reference" lines]
collect2: error: ld returned 1 exit status
gnatlink: error when calling /usr/local/gcc-aux/bin/ada
gnatmake: *** link failed.


further inspection of the statc library using `nm -a /usr/local/lib/florist/libflorist.a` and `readelf -s /usr/local/lib/florist/libflorist.a` showed that there is absolutely no symbol in any of the .o files inside libflorist.a, which explains the linking error.

Subsequent investigation showed that libflorist.a was correctly built, but symbols are lost at installation time.

According to devel/florist-gpl/files/patch-Makefile.in, the install target is redefined to:
$(BSD_INSTALL_LIB)  floristlib/*.a $(DESTDIR)$(PREFIX)/lib/florist

but $(BSD_INSTALL_LIB) constains the strip flag, which presumably strips ALL symbols from libflorist.a, rendering useless.

Looking at other ports, the majority of the ports tree installs .a files using INSTALL_DATA macro, and comparatively few of them use INSTALL_LIB or plain INSTALL. However, those other uses of INSTALL_LIB might be failing without being noticed, since static linking is quite rare outside of Ada projects.

This led me to believe that INSTALL_DATA should be used rather than INSTALL_LIB for static libraries. The Porter's Handbook describes INSTALL_LIB as meant for shared libraries, but then again there is absolutely no mention of static libraries in there.

So I have changed devel/florist-gpl/files/patch-Makefile.in to use BSD_INSTALL_DATA instead of BSD_INSTALL_LIB, and reinstalled Florist. My Ada projects using Florist then built successfully.

Fix: 

Install libflorist.a without stripping.
How-To-Repeat: Try to build an Ada project depending on Florist using port-provided florist.gpr and libflorist.a
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-25 17:10:05 UTC
Responsible Changed
From-To: freebsd-ports-bugs->marino

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 freebsd.contact 2014-04-25 23:35:25 UTC
Natacha,
Your analysis is absolutely correct.  I have seen the exact thing on
other ports and fixed those just as you suggest.  I didn't realize there
were more Ada libraries getting installed stripped.  I'll fix this right
away.

John
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-04-26 00:25:53 UTC
Author: marino
Date: Fri Apr 25 23:25:46 2014
New Revision: 352172
URL: http://svnweb.freebsd.org/changeset/ports/352172
QAT: https://qat.redports.org/buildarchive/r352172/

Log:
  devel/florist-gpl: Don't strip static library
  
  Static libraries need to be installed with BSD_INSTALL_DATA macro
  rather than BSD_INSTALL_LIB macro because the former will strip the
  symbols from the library by default.
  
  PR:		ports/188993
  Submitted by:	Natacha Porte
  Approved by:	maintainer (self)
  MFH:		2014Q2

Modified:
  head/devel/florist-gpl/Makefile
  head/devel/florist-gpl/files/patch-Makefile.in

Modified: head/devel/florist-gpl/Makefile
==============================================================================
--- head/devel/florist-gpl/Makefile	Fri Apr 25 23:20:52 2014	(r352171)
+++ head/devel/florist-gpl/Makefile	Fri Apr 25 23:25:46 2014	(r352172)
@@ -3,17 +3,17 @@
 
 PORTNAME=	florist-gpl
 PORTVERSION=	2012
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	http://downloads.dragonlace.net/src/
 DISTNAME=	${PORTNAME}-${PORTVERSION}-src
-EXTRACT_SUFX=	.tgz
 
 MAINTAINER=	marino@FreeBSD.org
 COMMENT=	POSIX Ada binding, IEEE Standards 1003.5(b,c)
 
 LICENSE=	GPLv3
 
-USES=		ada
+USES=		ada tar:tgz
 GNU_CONFIGURE=	yes
 
 post-extract:

Modified: head/devel/florist-gpl/files/patch-Makefile.in
==============================================================================
--- head/devel/florist-gpl/files/patch-Makefile.in	Fri Apr 25 23:20:52 2014	(r352171)
+++ head/devel/florist-gpl/files/patch-Makefile.in	Fri Apr 25 23:25:46 2014	(r352172)
@@ -12,7 +12,7 @@
 +		 $(DESTDIR)$(PREFIX)/include/florist
 +	$(BSD_INSTALL_DATA) floristlib/*.ad[bs] $(DESTDIR)$(PREFIX)/include/florist
 +	$(BSD_INSTALL_DATA) floristlib/*.ali $(DESTDIR)$(PREFIX)/lib/florist
-+	$(BSD_INSTALL_LIB)  floristlib/*.a $(DESTDIR)$(PREFIX)/lib/florist
++	$(BSD_INSTALL_DATA) floristlib/*.a $(DESTDIR)$(PREFIX)/lib/florist
 +	$(BSD_INSTALL_DATA) florist.gpr $(DESTDIR)$(PREFIX)/lib/gnat
  
  .PHONY: install clean distclean regen
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 John Marino freebsd_committer freebsd_triage 2014-04-26 00:45:09 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 5 dfilter service freebsd_committer freebsd_triage 2014-04-26 02:12:26 UTC
Author: marino
Date: Sat Apr 26 01:12:22 2014
New Revision: 352203
URL: http://svnweb.freebsd.org/changeset/ports/352203
QAT: https://qat.redports.org/buildarchive/r352203/

Log:
  MFH: r352172
  
  devel/florist-gpl: Don't strip static library
  
  Static libraries need to be installed with BSD_INSTALL_DATA macro
  rather than BSD_INSTALL_LIB macro because the former will strip the
  symbols from the library by default.
  
  PR:		ports/188993
  Submitted by:	Natacha Porte
  Approved by:	maintainer (self)
  Approved by:	portmgr (bapt)

Modified:
  branches/2014Q2/devel/florist-gpl/Makefile
  branches/2014Q2/devel/florist-gpl/files/patch-Makefile.in
Directory Properties:
  branches/2014Q2/   (props changed)

Modified: branches/2014Q2/devel/florist-gpl/Makefile
==============================================================================
--- branches/2014Q2/devel/florist-gpl/Makefile	Sat Apr 26 00:39:39 2014	(r352202)
+++ branches/2014Q2/devel/florist-gpl/Makefile	Sat Apr 26 01:12:22 2014	(r352203)
@@ -3,17 +3,17 @@
 
 PORTNAME=	florist-gpl
 PORTVERSION=	2012
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	http://downloads.dragonlace.net/src/
 DISTNAME=	${PORTNAME}-${PORTVERSION}-src
-EXTRACT_SUFX=	.tgz
 
 MAINTAINER=	marino@FreeBSD.org
 COMMENT=	POSIX Ada binding, IEEE Standards 1003.5(b,c)
 
 LICENSE=	GPLv3
 
-USES=		ada
+USES=		ada tar:tgz
 GNU_CONFIGURE=	yes
 
 post-extract:

Modified: branches/2014Q2/devel/florist-gpl/files/patch-Makefile.in
==============================================================================
--- branches/2014Q2/devel/florist-gpl/files/patch-Makefile.in	Sat Apr 26 00:39:39 2014	(r352202)
+++ branches/2014Q2/devel/florist-gpl/files/patch-Makefile.in	Sat Apr 26 01:12:22 2014	(r352203)
@@ -12,7 +12,7 @@
 +		 $(DESTDIR)$(PREFIX)/include/florist
 +	$(BSD_INSTALL_DATA) floristlib/*.ad[bs] $(DESTDIR)$(PREFIX)/include/florist
 +	$(BSD_INSTALL_DATA) floristlib/*.ali $(DESTDIR)$(PREFIX)/lib/florist
-+	$(BSD_INSTALL_LIB)  floristlib/*.a $(DESTDIR)$(PREFIX)/lib/florist
++	$(BSD_INSTALL_DATA) floristlib/*.a $(DESTDIR)$(PREFIX)/lib/florist
 +	$(BSD_INSTALL_DATA) florist.gpr $(DESTDIR)$(PREFIX)/lib/gnat
  
  .PHONY: install clean distclean regen
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"