[x265] [PATCH] Fix Clang build error when linking incompatible ABI (stack unwinding schemes).

den c dncodr at gmail.com
Fri May 30 00:20:53 CEST 2014


On 5/30/14, Steve Borho <steve at borho.org> wrote:

> in libx265, we don't use any std:: functions that would require
> linking to the std++ libraries; we just use a few of the math
> intrinsics (swap, abs, etc).  The cli uses C++ iostreams to read/write
> files, but we're not enabling exceptions for them.  We're certainly
> not relying on exceptions anywhere in the x265 source. It should be
> safe to disable them for GCC as well.

Great! Maybe then we should disable this to all compilers? Sorry for
patch flooding.

# HG changeset patch
# User Den Scherbin <dncodr at gmail.com>
# Date 1401401006 -10800
#      Fri May 30 01:03:26 2014 +0300
# Node ID 1eed3a0e8b2925f196a9b7225f57d66e968cfb69
# Parent  592ef184549ef631c0fe725cb9fe3cbab8de1db4
Disable exceptions for all compilers which support fno-exceptions

diff -r 592ef184549e -r 1eed3a0e8b29 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu May 29 23:42:16 2014 +0300
+++ b/source/CMakeLists.txt	Fri May 30 01:03:26 2014 +0300
@@ -107,6 +107,11 @@
 if(HAVE_INT_TYPES_H)
     add_definitions(-DHAVE_INT_TYPES_H=1)
 endif()
+# Disable exceptions. Reduce executable size, increase compability.
+check_cxx_compiler_flag(-fno-exceptions  COMPILER_HAS_FNO_EXCEPTIONS_FLAG)
+if(COMPILER_HAS_FNO_EXCEPTIONS_FLAG)
+	 add_definitions(-fno-exceptions)
+endif()

 if(INTEL_CXX AND UNIX)
     # treat icpc roughly like gcc
@@ -115,7 +120,7 @@
 elseif(CLANG)
     # treat clang roughly like gcc
     set(GCC 1)
-    add_definitions(-Wall -Wextra -Wshadow -ffast-math -fno-exceptions)
+    add_definitions(-Wall -Wextra -Wshadow -ffast-math)
 elseif(CMAKE_COMPILER_IS_GNUCXX)
     add_definitions(-Wall -Wextra -Wshadow -ffast-math)
     check_cxx_compiler_flag(-Wno-narrowing GCC_HAS_NO_NARROWING)


More information about the x265-devel mailing list