Bug 185994 - [PATCH] net/liveMedia need -fPIC/-fpic in CXXFLAGS too
Summary: [PATCH] net/liveMedia need -fPIC/-fpic in CXXFLAGS too
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Thomas Zander
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-22 10:50 UTC by Matthieu Volat
Modified: 2014-07-24 21:29 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (308 bytes, patch)
2014-01-22 10:50 UTC, Matthieu Volat
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthieu Volat 2014-01-22 10:50:01 UTC
net/liveMedia build do not specify -fPIC/-fpic flags for C++ sources, so build (or linking, to be precise) will fail.

Fix: Here's the trivial patch:
How-To-Repeat: make -C /usr/ports/net/liveMedia build
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-01-22 10:50:10 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-multimedia

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Thomas Zander freebsd_committer freebsd_triage 2014-07-22 18:45:17 UTC
[riggs] /usr/ports/net/liveMedia > make -V CXXFLAGS
-O2 -pipe -fPIC -fstack-protector -fno-strict-aliasing

Could you check whether this is still an issue?
Comment 3 Matthieu Volat 2014-07-22 19:42:44 UTC
Yes, still is:
root@freedom:/usr/ports/net/liveMedia # make -V CXXFLAGS
-g -O3 -march=core-avx-i -pipe

It seems that having a CXXFLAGS definition in /etc/make.conf is the trigger...
Comment 4 Thomas Zander freebsd_committer freebsd_triage 2014-07-22 21:58:01 UTC
Did you happen to set CXXFLAGS to not include CFLAGS in make.conf? Because if so, this is likely to cause issues and not supported anyway. In /usr/share/examples/etc/make.conf this is explained:
# CXXFLAGS controls the compiler settings used when compiling C++ code.
# Note that CXXFLAGS is initially set to the value of CFLAGS.  If you wish
# to add to CXXFLAGS value, "+=" must be used rather than "=".  Using "="
# alone will remove the often needed contents of CFLAGS from CXXFLAGS.
Comment 5 Matthieu Volat 2014-07-23 12:53:05 UTC
This seems 90s-like to say C++ is extended C... For example, what if I wanted to set clang to the Gnu89 idiom to match gcc's default via CFLAGS? 
CFLAGS=-std=gnu89
CXXFLAGS=$CFLAGS -std=gnu++89
seems a bit silly... and what if I want -g for C programs only?
Comment 6 Thomas Zander freebsd_committer freebsd_triage 2014-07-24 21:29:57 UTC
This is because the most common use for CFLAGS is to add some dir to the include path, debug flags, architecture, optimizations etc., and in this case in most cases you want to pass this to the c++ compiler as well.
And actually, for your own projects nothing prevents you from setting those flags to whatever you like or need.
But please do not specify an unsupported combination of CFLAGS and CXXFLAGS _in the global make.conf_ and expect all src and ports builds to still work.
This behaves as documented, so this is not bug.