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

Steve Borho steve at borho.org
Thu May 29 23:29:15 CEST 2014


On Thu, May 29, 2014 at 4:08 PM, den c <dncodr at gmail.com> wrote:
> Hi. Recently I faced with trouble when compiling x265 with Clang.
>
> CMakeFiles/cli.dir/input/input.cpp.obj:(.text+0x119): undefined
> reference to `_Unwind_Resume'
> CMakeFiles/cli.dir/input/input.cpp.obj:(.eh_frame+0x13): undefined
> reference to `__gxx_personality_v0'
> /bin/ld.exe: CMakeFiles/cli.dir/input/input.cpp.obj: bad reloc address
> 0x13 in section `.eh_frame'
> collect2.exe: error: ld returned 1 exit status
> clang++.exe: error: linker (via gcc) command failed with exit code 1
> (use -v to see invocation)
> make[2]: *** [x265.exe] Error 1
>
> After some digging it turned out that clang has limited support for
> windows exception handling. As you dont throw it anyway, this simple
> patch fixes that just turning off without any hurt. As side effect
> executable size little smaller.

ok

> OTOH i cant precisely say how will behave std:: functions which throw
> exceptions, i you use any of that, so i didnt include  -fno-exceptions
> in gcc branch.

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.

> # HG changeset patch
> # User Den Scherbin <dncodr at gmail.com>
> # Date 1401396136 -10800
> #      Thu May 29 23:42:16 2014 +0300
> # Node ID c579324661faf76e8f3b78dc10ff7b7e33750c9f
> # Parent  91330e7dddd7ba02028cad7a8d458b79d38362f6
> Disable exceptions. Fixes Clang linker errors.
>
> diff -r 91330e7dddd7 -r c579324661fa source/CMakeLists.txt
> --- a/source/CMakeLists.txt     Sat May 24 00:07:16 2014 +0900
> +++ b/source/CMakeLists.txt     Thu May 29 23:42:16 2014 +0300
> @@ -115,7 +115,7 @@
>  elseif(CLANG)
>      # treat clang roughly like gcc
>      set(GCC 1)
> -    add_definitions(-Wall -Wextra -Wshadow -ffast-math)
> +    add_definitions(-Wall -Wextra -Wshadow -ffast-math -fno-exceptions)
>  elseif(CMAKE_COMPILER_IS_GNUCXX)
>      add_definitions(-Wall -Wextra -Wshadow -ffast-math)
>      check_cxx_compiler_flag(-Wno-narrowing GCC_HAS_NO_NARROWING)
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel



-- 
Steve Borho


More information about the x265-devel mailing list