Bug 220588 - devel/flang: flang's wrapper script causes clang warnings
Summary: devel/flang: flang's wrapper script causes clang warnings
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Johannes M Dieterich
Depends on:
Reported: 2017-07-10 04:11 UTC by Yuri Victorovich
Modified: 2017-12-12 02:54 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (jmd)


Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer 2017-07-10 04:11:44 UTC
Please see the description here: https://github.com/flang-compiler/flang/issues/113
Comment 1 Johannes M Dieterich freebsd_committer 2017-08-31 14:28:50 UTC
Addressing this will require upstream to change flang when used for linking to "know" about its own libraries so that we can remove the current wrapper script in our port.
Comment 2 Matthieu Volat 2017-10-29 18:43:18 UTC
In the meanwhile, maybe the wrapper could do something like [1] to avoid the warnings?


LDFLAGS="-L/usr/local/flang/lib -lflang -lflangmain -lflangrti -lompstub -lexecinfo"
for arg in $@; do
	case "$arg" in
	-c|-E) LDFLAGS="";;
	-v) CPPFLAGS=""; LDFLAGS="";;

exec /usr/local/flang/bin/flang $LDFLAGS $CPPFLAGS $@
Comment 3 Johannes M Dieterich freebsd_committer 2017-11-02 15:14:39 UTC
Thanks, I'll give your suggestion a poudriere run to see if anything pops up!
Comment 4 Johannes M Dieterich freebsd_committer 2017-11-17 03:17:31 UTC
Unfortunately, this breaks math/R in the configure stage when it tries to figure out the libraries of the Fortran compiler (to link against them in hybrid Fortran/C code).
Comment 5 Matthieu Volat 2017-11-17 14:00:25 UTC
Oh well, that's actually me thinking for years that -v was for "show the version" when it was "be verbose" and running stuff like "cc -v" to get compiler name/version is an unintended use.

In that case, the -v line makes no sense in the option test. The script should be simply (let's keep the case if somebody need to do more?):

LDFLAGS="-L/usr/local/flang/lib -lflang -lflangmain -lflangrti -lompstub -lexecinfo"
for arg in $@; do
	case "$arg" in
	-c|-E) LDFLAGS="";;

exec /usr/local/flang/bin/flang $LDFLAGS $CPPFLAGS $@
Comment 6 commit-hook freebsd_committer 2017-12-12 02:44:02 UTC
A commit references this bug:

Author: jmd
Date: Tue Dec 12 02:43:49 UTC 2017
New revision: 456079
URL: https://svnweb.freebsd.org/changeset/ports/456079

  devel/flang: silence warnings caused by the wrapper script shortcomings and only add linking flags if needed.

  PR:		220588
  Reviewed by:	swills (mentor)
  Approved by:	swills (mentor)
  Obtained from:	PR220588 (with changes)
  Differential Revision:	https://reviews.freebsd.org/D13371

Comment 7 Johannes M Dieterich freebsd_committer 2017-12-12 02:54:36 UTC
Comitted. Closing, thanks for your patch!