Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Nov 2012 03:20:01 GMT
From:      Shane Ambler <FreeBSD@ShaneWare.Biz>
To:        freebsd-multimedia@FreeBSD.org
Subject:   Re: ports/173741: multimedia/dirac fails to compile with clang
Message-ID:  <201211210320.qAL3K1Za060140@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/173741; it has been noted by GNATS.

From: Shane Ambler <FreeBSD@ShaneWare.Biz>
To: bug-followup@FreeBSD.org, jeremyhu@freedesktop.org
Cc:  
Subject: Re: ports/173741: multimedia/dirac fails to compile with clang
Date: Wed, 21 Nov 2012 13:37:02 +1030

 This is a multi-part message in MIME format.
 --------------080703060205030707090608
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Personally I found the following changes fixed dirac building for me.
 It then compiles in my tinderbox with 8.3 gcc and 9.0 gcc and clang
 
 --------------080703060205030707090608
 Content-Type: text/plain; charset=UTF-8;
  name="dirac.patch.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="dirac.patch.txt"
 
 diff -Nru dirac.orig/Makefile dirac/Makefile
 --- dirac.orig/Makefile	2012-11-21 13:30:28.535192806 +1030
 +++ dirac/Makefile	2012-11-21 13:27:40.939023155 +1030
 @@ -7,7 +7,7 @@
  
  PORTNAME=	dirac
  PORTVERSION=	1.0.2
 -PORTREVISION?=	0
 +PORTREVISION?=	1
  CATEGORIES=	multimedia
  MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}-codec/Dirac-${PORTVERSION}
  
 @@ -25,4 +25,11 @@
  		HAVE_DOXYGEN=${FALSE} HAVE_DOT=${FALSE}
  CPPFLAGS+=	-I${LOCALBASE}/include
  
 -.include <bsd.port.mk>
 +.include <bsd.port.pre.mk>
 +
 +.if ${CC:T} == "clang" && ${ARCH} == "i386" && ${OSVERSION} < 901000
 +# workaround for pr/165968 -- fixed in 9-stable before 9.1
 +CFLAGS+= -march=pentium2
 +.endif
 +
 +.include <bsd.port.post.mk>
 diff -Nru dirac.orig/files/patch-configure dirac/files/patch-configure
 --- dirac.orig/files/patch-configure	1970-01-01 09:30:00.000000000 +0930
 +++ dirac/files/patch-configure	2012-09-09 16:38:33.926421341 +0930
 @@ -0,0 +1,102 @@
 +--- configure.orig	2012-06-08 20:47:50.897828593 +0930
 ++++ configure	2012-06-08 20:52:37.349826765 +0930
 +@@ -3497,7 +3497,7 @@
 + case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 + 
 + 
 +-enable_win32_dll=yes
 ++enable_win32_dll=no
 + 
 + case $host in
 + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
 +@@ -15902,24 +15902,10 @@
 + 
 + use_msvc=no
 + 
 ++LIBEXT=".lib";
 ++LIBFLAGS="-lib"
 ++RANLIB="echo"
 + 
 +-case "$CXX" in
 +-		cl*|CL*)
 +-		CXXFLAGS="-nologo -W1 -EHsc -DWIN32"
 +-		if test x"$enable_shared" = "xyes"; then
 +-		    LIBEXT=".dll";
 +-		    LIBFLAGS="-DLL -INCREMENTAL:NO"
 +-			CXXFLAGS="$CXXFLAGS -D_WINDLL"
 +-		else
 +-		    LIBEXT=".lib";
 +-		    LIBFLAGS="-lib"
 +-		fi
 +-		RANLIB="echo"
 +-		use_msvc=yes
 +-		;;
 +-	*)
 +-		;;
 +-esac
 +  if test x"$use_msvc" = "xyes"; then
 +   USE_MSVC_TRUE=
 +   USE_MSVC_FALSE='#'
 +@@ -19855,61 +19841,6 @@
 +     else
 + 	:
 +     fi
 +-		TRY_CFLAGS="$OPT_CFLAGS -Wall"
 +-		{ $as_echo "$as_me:$LINENO: checking if $CXX supports $TRY_CFLAGS $CXXFLAGS flags" >&5
 +-$as_echo_n "checking if $CXX supports $TRY_CFLAGS $CXXFLAGS flags... " >&6; }
 +-	SAVE_CXXFLAGS="$CXXFLAGS"
 +-	CXXFLAGS="$TRY_CFLAGS $CXXFLAGS"
 +-	cat >conftest.$ac_ext <<_ACEOF
 +-/* confdefs.h.  */
 +-_ACEOF
 +-cat confdefs.h >>conftest.$ac_ext
 +-cat >>conftest.$ac_ext <<_ACEOF
 +-/* end confdefs.h.  */
 +-
 +-int
 +-main ()
 +-{
 +-
 +-  ;
 +-  return 0;
 +-}
 +-_ACEOF
 +-rm -f conftest.$ac_objext
 +-if { (ac_try="$ac_compile"
 +-case "(($ac_try" in
 +-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 +-  *) ac_try_echo=$ac_try;;
 +-esac
 +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
 +-$as_echo "$ac_try_echo") >&5
 +-  (eval "$ac_compile") 2>conftest.er1
 +-  ac_status=$?
 +-  grep -v '^ *+' conftest.er1 >conftest.err
 +-  rm -f conftest.er1
 +-  cat conftest.err >&5
 +-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
 +-  (exit $ac_status); } && {
 +-	 test -z "$ac_cxx_werror_flag" ||
 +-	 test ! -s conftest.err
 +-       } && test -s conftest.$ac_objext; then
 +-  ac_cv_try_cxxflags_ok=yes
 +-else
 +-  $as_echo "$as_me: failed program was:" >&5
 +-sed 's/^/| /' conftest.$ac_ext >&5
 +-
 +-	ac_cv_try_cxxflags_ok=no
 +-fi
 +-
 +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 +-	CXXFLAGS="$SAVE_CXXFLAGS"
 +-	{ $as_echo "$as_me:$LINENO: result: $ac_cv_try_cxxflags_ok" >&5
 +-$as_echo "$ac_cv_try_cxxflags_ok" >&6; }
 +-	if test x"$ac_cv_try_cxxflags_ok" = x"yes"; then
 +-	OPT_CFLAGS="$TRY_CFLAGS"
 +-    else
 +-	:
 +-    fi
 + 		TRY_CFLAGS="$OPT_CFLAGS -Werror"
 + 		{ $as_echo "$as_me:$LINENO: checking if $CXX supports $TRY_CFLAGS $CXXFLAGS flags" >&5
 + $as_echo_n "checking if $CXX supports $TRY_CFLAGS $CXXFLAGS flags... " >&6; }
 +
 diff -Nru dirac.orig/files/patch-configure.ac dirac/files/patch-configure.ac
 --- dirac.orig/files/patch-configure.ac	1970-01-01 09:30:00.000000000 +0930
 +++ dirac/files/patch-configure.ac	2012-09-09 16:38:33.926421341 +0930
 @@ -0,0 +1,48 @@
 +--- configure.ac.orig	2009-02-10 10:46:37.000000000 +1030
 ++++ configure.ac	2012-06-08 20:16:10.196828586 +0930
 +@@ -53,7 +53,6 @@
 + dnl -----------------------------------------------
 + AC_PROG_CXX
 + AM_SANITY_CHECK
 +-AC_LIBTOOL_WIN32_DLL
 + AM_PROG_LIBTOOL
 + AC_SYS_LARGEFILE
 + 
 +@@ -67,23 +66,11 @@
 + use_msvc=no
 + AC_SUBST([LIBFLAGS],[])
 + AC_SUBST([LIBEXT],[])
 +-case "$CXX" in
 +-		cl*|CL*)
 +-		CXXFLAGS="-nologo -W1 -EHsc -DWIN32"
 +-		if test x"$enable_shared" = "xyes"; then
 +-		    LIBEXT=".dll";
 +-		    LIBFLAGS="-DLL -INCREMENTAL:NO"
 +-			CXXFLAGS="$CXXFLAGS -D_WINDLL"
 +-		else
 +-		    LIBEXT=".lib";
 +-		    LIBFLAGS="-lib"
 +-		fi
 +-		RANLIB="echo"
 +-		use_msvc=yes
 +-		;;
 +-	*)
 +-		;;
 +-esac
 ++
 ++LIBEXT=".lib";
 ++LIBFLAGS="-lib"
 ++RANLIB="echo"
 ++
 + AM_CONDITIONAL(USE_MSVC, test x"$use_msvc" = "xyes")
 + 
 + dnl -----------------------------------------------
 +@@ -181,8 +168,6 @@
 + 		AC_TRY_CXXFLAGS([],[], [$TRY_CFLAGS $CXXFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
 + 		TRY_CFLAGS="$OPT_CFLAGS -pedantic"
 + 		AC_TRY_CXXFLAGS([],[], [$TRY_CFLAGS $CXXFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
 +-		TRY_CFLAGS="$OPT_CFLAGS -Wall"
 +-		AC_TRY_CXXFLAGS([],[], [$TRY_CFLAGS $CXXFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
 + 		TRY_CFLAGS="$OPT_CFLAGS -Werror"
 + 		AC_TRY_CXXFLAGS([],[], [$TRY_CFLAGS $CXXFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
 + 		TRY_CFLAGS="$OPT_CFLAGS -W"
 diff -Nru dirac.orig/files/patch-doc_Makefile.in dirac/files/patch-doc_Makefile.in
 --- dirac.orig/files/patch-doc_Makefile.in	1970-01-01 09:30:00.000000000 +0930
 +++ dirac/files/patch-doc_Makefile.in	2012-09-09 16:38:33.926421341 +0930
 @@ -0,0 +1,11 @@
 +--- ./doc/Makefile.in.orig	2012-03-07 07:11:51.000000000 +1030
 ++++ ./doc/Makefile.in	2012-03-07 07:11:55.793045000 +1030
 +@@ -390,7 +390,7 @@
 + 	doxygen $(srcdir)/dirac_api.doxygen
 + 
 + install-data-hook:
 +-	cp -dR html/* $(DESTDIR)$(htmldir)
 ++	cp -R html/* $(DESTDIR)$(htmldir)
 + # Tell versions [3.59,3.63) of GNU make to not export all variables.
 + # Otherwise a system limit (for SysV at least) may be exceeded.
 + .NOEXPORT:
 diff -Nru dirac.orig/files/patch-libdirac_encoder-quant_chooser.cpp dirac/files/patch-libdirac_encoder-quant_chooser.cpp
 --- dirac.orig/files/patch-libdirac_encoder-quant_chooser.cpp	1970-01-01 09:30:00.000000000 +0930
 +++ dirac/files/patch-libdirac_encoder-quant_chooser.cpp	2012-09-09 16:38:33.926421341 +0930
 @@ -0,0 +1,20 @@
 +--- libdirac_encoder/quant_chooser.cpp.orig
 ++++ libdirac_encoder/quant_chooser.cpp
 +@@ -340,7 +340,7 @@
 +     {
 +         for (int i=cblock.Xstart(); i<cblock.Xend(); ++i )
 +         {
 +-            if ( (std::abs(m_coeff_data[j][i])<<2) >= u_threshold )
 ++            if ( (int(std::abs(m_coeff_data[j][i]))<<2) >= u_threshold )
 +                 can_skip = false;
 +         }   
 +     }
 +@@ -355,7 +355,7 @@
 +     {
 +         for (int i=node.Xp() ; i<node.Xp()+node.Xl(); ++i)
 +         {    
 +-            val = std::max( val , std::abs(m_coeff_data[j][i]) );
 ++            val = std::max( val , int(std::abs(m_coeff_data[j][i])) );
 +         }// i
 +     }// j
 + 
 
 --------------080703060205030707090608--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211210320.qAL3K1Za060140>