Bug 186998

Summary: [patch] math/fftw3 port fails during configure on i386 with clang
Product: Ports & Packages Reporter: Don Lewis <truckman>
Component: Individual Port(s)Assignee: Brendan Fabeny <bf>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Don Lewis freebsd_committer freebsd_triage 2014-02-24 06:10:00 UTC
When attempting to build the math/fftw3 port, it fails during the configure
step:

checking for gcc... cc
checking whether the C compiler works... no
configure: error: in `/usr/ports/math/fftw3/work/fftw-3.3.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
===>  Script "configure" failed unexpectedly.
Please report the problem to bf@FreeBSD.org [maintainer] and attach the
"/usr/ports/math/fftw3/work/fftw-3.3.3/config.log" including the output of
the failure of your make command. Also, it might be a good idea to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/math/fftw3
*** Error code 1

Stop.
make: stopped in /usr/ports/math/fftw3


The following snippet of config.log shows that the cause of the problem is
that clang rejects the -malign-double command line option:

configure:4046: checking whether the C compiler works
configure:4068: cc -O2 -pipe -march=athlon64 -O3 -ffast-math -fstrict-aliasing -efomit-frame-pointer -malign-double   conftest.c  >&5
cc: error: unknown argument: '-malign-double'
configure:4072: $? = 1
configure:4110: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "fftw"
| #define PACKAGE_TARNAME "fftw"
| #define PACKAGE_VERSION "3.3.3"
| #define PACKAGE_STRING "fftw 3.3.3"
| #define PACKAGE_BUGREPORT "fftw@fftw.org"
| #define PACKAGE_URL ""
| #define PACKAGE "fftw"
| #define VERSION "3.3.3"
| #define FFTW_ENABLE_ALLOCA 1
| #define HAVE_SSE2 1
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:4115: error: in `/usr/ports/math/fftw3/work/fftw-3.3.3':
configure:4118: error: C compiler cannot create executables
See `config.log' for more details

Fix: The following Makefile patch fixes the problem for me.  It is untested
on a machine with gcc.
How-To-Repeat: 
Attempt to build the port on an i386 with clang version 3.4.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-02-24 06:10:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->bf

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Don Lewis freebsd_committer freebsd_triage 2014-02-26 05:36:41 UTC
This is probably a better patch:

Index: Makefile
===================================================================
--- Makefile	(revision 345674)
+++ Makefile	(working copy)
@@ -19,7 +19,7 @@
 FFTW3_SUFX=
 
 GNU_CONFIGURE=	yes
-USES=		pathfix perl5 pkgconfig
+USES=		pathfix perl5 pkgconfig compiler:features
 USE_PERL5=	build
 USE_LDCONFIG=	yes
 
@@ -62,7 +62,9 @@
 CFLAGS+=	-fomit-frame-pointer
 .  endif
 .  if ${ARCH} == "i386"
+.    if ${COMPILER_TYPE} == "gcc"
 CFLAGS+=	-malign-double
+.    endif
 .  endif
 WITHOUT_NO_STRICT_ALIASING=	yes
 .endif # end OPTIMIZED_CFLAGS
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-03-05 03:17:14 UTC
Author: bf
Date: Wed Mar  5 03:17:04 2014
New Revision: 347093
URL: http://svnweb.freebsd.org/changeset/ports/347093
QAT: https://qat.redports.org/buildarchive/r347093/

Log:
  Fix i386 builds using clang [1]; use staging;
  remove some outdated material
  
  PR:		186998 [1]
  Submitted by:	truckman [1]

Modified:
  head/math/fftw3-float/Makefile
  head/math/fftw3-long/Makefile
  head/math/fftw3-quad/Makefile
  head/math/fftw3/Makefile
  head/math/fftw3/pkg-plist

Modified: head/math/fftw3-float/Makefile
==============================================================================
--- head/math/fftw3-float/Makefile	Wed Mar  5 02:24:30 2014	(r347092)
+++ head/math/fftw3-float/Makefile	Wed Mar  5 03:17:04 2014	(r347093)
@@ -7,5 +7,4 @@ COMMENT=	Fast Discrete Fourier Transform
 FFTW3_FLAVOR=	float
 MASTERDIR=	${.CURDIR}/../../math/fftw3
 
-NO_STAGE=	yes
 .include "${MASTERDIR}/Makefile"

Modified: head/math/fftw3-long/Makefile
==============================================================================
--- head/math/fftw3-long/Makefile	Wed Mar  5 02:24:30 2014	(r347092)
+++ head/math/fftw3-long/Makefile	Wed Mar  5 03:17:04 2014	(r347093)
@@ -7,5 +7,4 @@ COMMENT=	Fast Discrete Fourier Transform
 FFTW3_FLAVOR=	long
 MASTERDIR=	${.CURDIR}/../../math/fftw3
 
-NO_STAGE=	yes
 .include "${MASTERDIR}/Makefile"

Modified: head/math/fftw3-quad/Makefile
==============================================================================
--- head/math/fftw3-quad/Makefile	Wed Mar  5 02:24:30 2014	(r347092)
+++ head/math/fftw3-quad/Makefile	Wed Mar  5 03:17:04 2014	(r347093)
@@ -6,5 +6,4 @@ COMMENT=	Fast Discrete Fourier Transform
 FFTW3_FLAVOR=	quad
 MASTERDIR=	${.CURDIR}/../../math/fftw3
 
-NO_STAGE=	yes
 .include "${MASTERDIR}/Makefile"

Modified: head/math/fftw3/Makefile
==============================================================================
--- head/math/fftw3/Makefile	Wed Mar  5 02:24:30 2014	(r347092)
+++ head/math/fftw3/Makefile	Wed Mar  5 03:17:04 2014	(r347093)
@@ -14,6 +14,8 @@ DISTNAME=	fftw-${PORTVERSION}
 MAINTAINER=	bf@FreeBSD.org
 COMMENT?=	Fast C routines to compute the Discrete Fourier Transform
 
+LICENSE=	GPLv2
+
 #current flavors: default, float, long, and quad
 FFTW3_FLAVOR?=	default
 FFTW3_SUFX=
@@ -28,12 +30,10 @@ CONFIGURE_ENV=	PTHREAD_CFLAGS="${PTHREAD
 		PTHREAD_LIBS="${PTHREAD_LIBS}"
 
 .if ${FFTW3_FLAVOR} == "default"
-MAN1=	fftw-wisdom-to-conf.1 fftw-wisdom.1
 INFO=	fftw3
 .else
 #For non-default flavors, build and install the flavor-dependent components
 #only, so that these flavors may coexist with the default flavor
-MAN1=	fftw${FFTW3_SUFX}-wisdom.1
 INSTALL_TARGET=	install-pkgconfigDATA install-libLTLIBRARIES install-exec
 .endif
 
@@ -44,30 +44,19 @@ OPENMP_DESC=		Build OpenMP multithreaded
 
 OPTIONS_DEFAULT=	OPTIMIZED_CFLAGS
 
-NO_STAGE=	yes
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MOPENMP}
 CONFIGURE_ARGS+=	--enable-openmp
 PLIST_SUB+=	OPENMP=""
-USE_GCC=	any
+USES+=		compiler:openmp
 .else
 CONFIGURE_ARGS+=	--disable-openmp
 PLIST_SUB+=	OPENMP="@comment "
+USES+=		compiler:env
 .endif
 
-.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
-CFLAGS+=	-O3 -ffast-math -fstrict-aliasing
-.  if !defined(WITH_DEBUG)
-CFLAGS+=	-fomit-frame-pointer
-.  endif
-.  if ${ARCH} == "i386"
-CFLAGS+=	-malign-double
-.  endif
-WITHOUT_NO_STRICT_ALIASING=	yes
-.endif # end OPTIMIZED_CFLAGS
-
-#Users must add altivec and avx to MACHINE_CPU when desired:
+#Users must add altivec to MACHINE_CPU when desired:
 #this is not currently done in bsd.cpu.mk
 .if ${FFTW3_FLAVOR} == "default"
 .  if !empty(MACHINE_CPU:Mavx)
@@ -87,10 +76,6 @@ CONFIGURE_ARGS+=--enable-sse
 CONFIGURE_ARGS+=--enable-altivec
 .  endif
 .elif ${FFTW3_FLAVOR} == "long"
-.  if ${OSVERSION} < 800000
-ONLY_FOR_ARCHS =	i386 sparc64
-LIB_DEPENDS+=	ml:${PORTSDIR}/math/ldouble
-.  endif
 FFTW3_SUFX=	l
 FFTW3_PKGNAMESUFFIX=	-long
 CONFIGURE_ARGS+=--enable-long-double
@@ -103,13 +88,26 @@ USE_GCC=	yes
 .endif
 
 .if ${FFTW3_FLAVOR} == "default"
-PLIST_SUB+=	DEF=""
+PLIST_SUB+=	DEF="" NONDEF="@comment "
 .else
-PLIST_SUB+=	DEF="@comment "
+PLIST_SUB+=	DEF="@comment " NONDEF=""
 .endif
 
 PLIST_SUB+=	FFTW3_SUFX="${FFTW3_SUFX}"
 
+.include <bsd.port.pre.mk>
+
+.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
+CFLAGS+=	-O3 -ffast-math -fstrict-aliasing
+.  if !defined(WITH_DEBUG)
+CFLAGS+=	-fomit-frame-pointer
+.  endif
+.  if ${ARCH} == "i386" && (${COMPILER_TYPE} == "gcc" || !empty(USE_GCC))
+CFLAGS+=	-malign-double
+.  endif
+WITHOUT_NO_STRICT_ALIASING=	yes
+.endif # end OPTIMIZED_CFLAGS
+
 post-patch:
 	@${REINPLACE_CMD} -e 's|/etc/fftw|${PREFIX}/etc/fftw|' \
 		${WRKSRC}/Makefile.in \
@@ -125,10 +123,6 @@ post-patch:
 	-e '/(DIST_COMMON|bin_SCRIPTS|BUILT_SOURCES|EXTRA_DIST) =/,\
 	/[^\]$$/s/[^[:blank:]]*fftw-wisdom-to-conf[^[:blank:]]*//' \
 		${WRKSRC}/tools/Makefile.in
-.  if ${FFTW3_FLAVOR} == "long" && ${OSVERSION} < 800000
-	@${REINPLACE_CMD} -e 's|-lm |-L${LOCALBASE}/lib -lml &|' \
-		${WRKSRC}/configure
-.  endif
 .endif
 
 post-patch-script:
@@ -149,14 +143,14 @@ post-configure:
 
 .if ${FFTW3_FLAVOR} != "default"
 post-install:
-	@${INSTALL_MAN} ${WRKSRC}/tools/fftw${FFTW3_SUFX}-wisdom.1 ${PREFIX}/man/man1
+	@${INSTALL_MAN} ${WRKSRC}/tools/fftw${FFTW3_SUFX}-wisdom.1 ${STAGEDIR}${PREFIX}/man/man1
 .endif
 
 regression-test test: smallcheck
 
 .for t in bigcheck check exhaustive-check paranoid-check smallcheck
 ${t}: build
-	@cd ${WRKSRC}/tests; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
+	@cd ${WRKSRC}/tests; ${SETENV} ${MAKE_ENV} ${MAKE} \
 	${MAKE_ARGS} ${t}
 
 .endfor

Modified: head/math/fftw3/pkg-plist
==============================================================================
--- head/math/fftw3/pkg-plist	Wed Mar  5 02:24:30 2014	(r347092)
+++ head/math/fftw3/pkg-plist	Wed Mar  5 03:17:04 2014	(r347093)
@@ -18,3 +18,6 @@ lib/libfftw3%%FFTW3_SUFX%%_threads.la
 lib/libfftw3%%FFTW3_SUFX%%_threads.so
 lib/libfftw3%%FFTW3_SUFX%%_threads.so.6
 libdata/pkgconfig/fftw3%%FFTW3_SUFX%%.pc
+%%DEF%%man/man1/fftw-wisdom.1.gz
+%%DEF%%man/man1/fftw-wisdom-to-conf.1.gz
+%%NONDEF%%man/man1/fftw%%FFTW3_SUFX%%-wisdom.1.gz
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Brendan Fabeny freebsd_committer freebsd_triage 2014-03-05 05:14:22 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!