Date: Wed, 23 Sep 2020 11:25:15 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 249546] Ports using gfortran broken due to bsd.sys.mk (-fuse-ld=/...) Message-ID: <bug-249546-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249546 Bug ID: 249546 Summary: Ports using gfortran broken due to bsd.sys.mk (-fuse-ld=3D/...) Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: se@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 w= hen building ports: # Please keep this if in sync with kern.mk=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 .if ${LD} !=3D "ld" && (${CC:[1]:H} !=3D ${LD:[1]:H} || ${LD:[1]:T} !=3D "l= d") # Add -fuse-ld=3D${LD} if $LD is in a different directory or not called "ld= ".=20=20=20=20=20 # Note: Clang 12+ will prefer --ld-path=3D over -fuse-ld=3D.=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 .if ${COMPILER_TYPE} =3D=3D "clang" # Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> = lld.=20 LDFLAGS+=3D -fuse-ld=3D${LD:[1]:S/^ld.//1W} .else # GCC does not support an absolute path for -fuse-ld so we just print this= =20=20=20=20=20=20 # warning instead and let the user add the required symlinks.=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 .warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld=3D is = not supported .endif .endif This causes a build error in lang/ratfor, for example: gfortran9 -O -Wl,-rpath=3D/usr/local/lib/gcc9 -Wl,-rpath=3D/usr/local/li= b/gcc9=20 -L/usr/local/lib/gcc9 -B/usr/local/bin -fstack-protector-strong=20=20=20 -fuse-ld=3D/usr/local/bin/ld test.f -o test gfortran9: error: unrecognized command line option '-fuse-ld=3D/usr/local/b= in/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=3Dbfd is acceptable to use the GNU linker. I have not found any method to suppress the addition of that -fuse-ld optio= n to the gfortran command line (and this should affect all ports that use gfortr= an 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 syst= em 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 tha= t do not occur in the base system (i.e. use of gfortran in this particular case). --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249546-227>