Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 May 2013 19:05:21 GMT
From:      Ed Maste <emaste@freebsd.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/178958: glib-2.0 missing -lintl in glib-2.0.pc, breaks static linking
Message-ID:  <201305241905.r4OJ5LKX044336@freefall.freebsd.org>
Resent-Message-ID: <201305241910.r4OJA0V9044635@freefall.freebsd.org>

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

>Number:         178958
>Category:       ports
>Synopsis:       glib-2.0 missing -lintl in glib-2.0.pc, breaks static linking
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 24 19:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Ed Maste
>Release:        FreeBSD 9.1-STABLE amd64
>Organization:
FreeBSD
>Environment:
System: FreeBSD feynman 9.1-STABLE FreeBSD 9.1-STABLE #0 r248833M: Thu Mar 28 11:33:24 EDT 2013 emaste@feynman:/data2/emaste/obj/home/emaste/src/9/sys/TEST amd64

>Description:

I tried to statically link an app against libglib, and it failed due to
unresolved dependencies from libintl.  Looking at glib's installed .pc
file, I see:

% egrep ^Libs /usr/local/libdata/pkgconfig/glib-2.0.pc
Libs: -L${libdir} -lglib-2.0 -lintl 
Libs.private: -pthread  -L/usr/local/lib -lpcre     -liconv

Indeed, no -lintl there.

The port's Makefile explicitly adds -lintl to LDFLAGS, and this appears
to cause configure to decide the gettext API is available without any
additional -l flags.  If I remove the the explicit -lintl then the
configure script determines that it's necessary, and adds it to the .pc
file:

% egrep ^Libs /usr/local/libdata/pkgconfig/glib-2.0.pc
Libs: -L${libdir} -lglib-2.0 -lintl 
Libs.private: -pthread  -L/usr/local/lib -lpcre   -lintl  -liconv

>How-To-Repeat:
Try to statically link using $(pkg-config --static --libs glib-2.0)

>Fix:
feynman% diff -u Makefile.orig Makefile
--- Makefile.orig       2013-05-24 14:59:25.000000000 -0400
+++ Makefile    2013-05-24 14:59:30.000000000 -0400
@@ -38,7 +38,7 @@
                --with-pcre=system \
                --disable-fam
 CPPFLAGS+=     -I${LOCALBASE}/include
-LDFLAGS+=      -L${LOCALBASE}/lib -lintl
+LDFLAGS+=      -L${LOCALBASE}/lib
 
 OPTIONS_DEFINE=        COLLATION_FIX DEBUG
 COLLATION_FIX_DESC=    fix string collation

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



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