[Bug 249546] Ports using gfortran broken due to bsd.sys.mk (-fuse-ld=/...)
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Sep 23 11:25:15 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249546
Bug ID: 249546
Summary: Ports using gfortran broken due to bsd.sys.mk
(-fuse-ld=/...)
Product: Base System
Version: Unspecified
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: misc
Assignee: bugs at FreeBSD.org
Reporter: se at FreeBSD.org
--- This is not a ports bug, AFAICT, but affects building of some ports ---
Compiling ports that use gfortran is broken on systems that use clang as
default compiler.
The cause is the following fragment of bsd.sys.mk, which is also included when
building ports:
# Please keep this if in sync with kern.mk
.if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld")
# Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld".
# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=.
.if ${COMPILER_TYPE} == "clang"
# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld.
LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W}
.else
# GCC does not support an absolute path for -fuse-ld so we just print this
# warning instead and let the user add the required symlinks.
.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not
supported
.endif
.endif
This causes a build error in lang/ratfor, for example:
gfortran9 -O -Wl,-rpath=/usr/local/lib/gcc9 -Wl,-rpath=/usr/local/lib/gcc9
-L/usr/local/lib/gcc9 -B/usr/local/bin -fstack-protector-strong
-fuse-ld=/usr/local/bin/ld test.f -o test
gfortran9: error: unrecognized command line option '-fuse-ld=/usr/local/bin/ld'
(Full build log:
http://beefy18.nyi.freebsd.org/data/head-amd64-default/p549547_s365984/logs/errors/ratfor-1985.06_13.log)
This particular -fuse-ld option should only be passed to compilers that
actually accept it.
For GCC or GFORTRAN only -fuse-ld=bfd is acceptable to use the GNU linker.
I have not found any method to suppress the addition of that -fuse-ld option to
the gfortran command line (and this should affect all ports that use gfortran
as part of the build process) other than patching a ".f:" rule into the
internal Makefile of the port. That should not be required and it caused me
quite some effort to track down the cause of the build failure in this system
make file.
Inclusion of bsd.sys.mk into the ports system provides useful defaults for a
number of parameters, but it should be robust if used in constellations that do
not occur in the base system (i.e. use of gfortran in this particular case).
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list