Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2014 16:00:47 GMT
From:      Natacha Porté <natbsd@instinctive.eu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/188993: devel/florist-gpl unusable because libflorist.a has no symbol
Message-ID:  <201404251600.s3PG0lqY074205@cgiserv.freebsd.org>
Resent-Message-ID: <201404251610.s3PGA0Bg074588@freefall.freebsd.org>

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

>Number:         188993
>Category:       ports
>Synopsis:       devel/florist-gpl unusable because libflorist.a has no symbol
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 16:10:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Natacha Porté
>Release:        9.2-RELEASE
>Organization:
>Environment:
FreeBSD rebma.instinctive.eu 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:
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.
>How-To-Repeat:
Try to build an Ada project depending on Florist using port-provided florist.gpr and libflorist.a
>Fix:
Install libflorist.a without stripping.

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



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