Bug 171119 - multimedia/libxine fails to build with clang as cc
Summary: multimedia/libxine fails to build with clang as cc
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Juergen Lock
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-27 17:10 UTC by Dan McGregor
Modified: 2012-08-27 23:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan McGregor 2012-08-27 17:10:04 UTC
libxine fails with the following error when build with clang:


ifs.c:534:2: error: clobbers must be last on the x87 stack
        emms();/*__asm__ __volatile__ ("emms");*/
        ^
./mmx.h:733:38: note: expanded from macro 'emms'
#define emms() __asm__ __volatile__ ("emms"::: \
                                     ^
cc: warning: argument unused during compilation: '-fexpensive-optimizations'
cc: warning: argument unused during compilation: '-fno-force-addr'
1 error generated.


The offending part of mmx.h is:

#define emms() __asm__ __volatile__ ("emms"::: \
                      "st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)")

Fix: 

The easiest solution for me was to add USE_GCC=4.4+ to the Makefile, which brought in gcc as a dependency.

The other solution is to remove the clobber list from the emms asm directive.  I don't know what that does to building with gcc, though.
How-To-Repeat: Build libxine with CC=clang CXX=clang++ or build world with WITH_CLANG_IS_CC and WITHOUT_GCC then build libxine.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-27 17:10:18 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nox

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-08-27 23:19:05 UTC
Author: nox
Date: Mon Aug 27 22:18:55 2012
New Revision: 303264
URL: http://svn.freebsd.org/changeset/ports/303264

Log:
  (Attempt to) fix build with clang by assuming clang doesn't need a
  clobber list with __asm__ __volatile__ ("emms").
  
  PR:		ports/171119
  Submitted by:	Dan McGregor <dan.mcgregor@usask.ca>

Added:
  head/multimedia/libxine/files/patch-src-post-goom-mmx.h   (contents, props changed)

Added: head/multimedia/libxine/files/patch-src-post-goom-mmx.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libxine/files/patch-src-post-goom-mmx.h	Mon Aug 27 22:18:55 2012	(r303264)
@@ -0,0 +1,32 @@
+--- src/post/goom/mmx.h.orig
++++ src/post/goom/mmx.h
+@@ -721,17 +721,29 @@ void zoom_filter_xmmx (int prevX, int pr
+ */
+ #ifdef	MMX_TRACE
+ 
++#ifdef __clang__
++#define	emms() \
++	{ \
++		printf("emms()\n"); \
++		__asm__ __volatile__ ("emms"); \
++	}
++#else
+ #define	emms() \
+ 	{ \
+ 		printf("emms()\n"); \
+ 		__asm__ __volatile__ ("emms" \
+                         "st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)"); \
+ 	}
++#endif
+ 
+ #else
+ 
++#ifdef __clang__
++#define	emms() __asm__ __volatile__ ("emms")
++#else
+ #define	emms() __asm__ __volatile__ ("emms"::: \
+                       "st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)")
++#endif
+ 
+ #endif
+ 
_______________________________________________
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 3 Juergen Lock freebsd_committer freebsd_triage 2012-08-27 23:20:23 UTC
State Changed
From-To: open->closed

Fix (attempt) committed. Thanks!