Bug 193120 - [bsd.xfce.mk] erroneously poisons CPPFLAGS with -L${LOCALBASE}/lib
Summary: [bsd.xfce.mk] erroneously poisons CPPFLAGS with -L${LOCALBASE}/lib
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Many People
Assignee: freebsd-xfce (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-29 11:33 UTC by Dmitry Marakasov
Modified: 2017-09-28 09:59 UTC (History)
3 users (show)

See Also:


Attachments
bsd.xfce.mk.patch (803 bytes, patch)
2014-08-29 11:33 UTC, Dmitry Marakasov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov freebsd_committer freebsd_triage 2014-08-29 11:33:40 UTC
Created attachment 146483 [details]
bsd.xfce.mk.patch

xfce4-notification-daemon haven't built without my fix:

---
/usr/bin/ld: .libs/theme.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
.libs/theme.o: could not read symbols: Bad value
cc: error: linker command failed with exit code 1 (use -v to see invocation)
---

the fix (r366484):

---
Index: Makefile
===================================================================
--- Makefile	(revision 366483)
+++ Makefile	(revision 366484)
@@ -26,6 +26,7 @@
 USE_GNOME=	librsvg2
 USE_LDCONFIG=	yes
 USE_XFCE=	configenv libutil libgui
+CFLAGS+=	-fPIC
 
 CONFIGURE_ARGS+=	--libdir=${PREFIX}/lib/xfce4 \
 			--libexecdir=${PREFIX}/libexec/xfce4 \
---

tijl@ pointed out that it's not quite correct:

---
> Can you check config.log to see if the configure test for -fPIC fails
> without this change?
> Adding -fPIC to CFLAGS is a big hammer solution for what is usually a
> small problem and it causes executables and static libraries to be
> compiled with -fPIC as well when normally only shared libraries have
> to be compiled with it.
---

after investigation, I've found out that -fPIC test in configure
really fails as configure checks for -fPIC support not by analyzing
compiler exit code by by checking if it emits a warning (as it's
expected to emit a warning and ignore -fPIC if it's not supported).
This check fails, as compiler does emit a warning:

---
configure:7357: checking for cc option to produce PIC
configure:7567: result: -fPIC
configure:7575: checking if cc PIC flag -fPIC works
configure:7593: cc -c -O2 -pipe -fno-strict-aliasing -I/usr/local/include -L/usr/local/lib -fPIC -DPIC conftest.c >&5
cc: warning: argument unused during compilation: '-L/usr/local/lib'
configure:7597: $? = 0
configure:7610: result: no
---

this -L/usr/local/lib gets there from bsd.xfce.mk

---
configenv_CONFIGURE_ENV=        CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include -L${LOCALBASE}/lib"
---

Is there a reason for -L${LOCALBASE}/lib there?

It seems to me that it should be removed, and probably whole thing should be changed to appending CPPFLAGS instead of CONFIGURE_ENV, as CONFIGURE_ENV always contains CPPFLAGS anyway. See fix.
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2017-09-28 09:59:31 UTC
Looks like an equivalent fix has been committed in the while, so I'm closing this bug.

Thanks.