[x265] [BUG] Mac 10.6.x - Fails to build 32-bit shared library
Steve Borho
steve at borho.org
Thu May 29 20:09:32 CEST 2014
On Thu, May 29, 2014 at 11:56 AM, Terri Kwon <tkwon at sorensonmedia.com> wrote:
> I am trying to build 32-bit shared library on Mac 10.6.x, and the build
> fails.
>
>
> The two things I've noticed are:
>
> 1. I set "CMAKE_OSX_ARCHITECTURES:STRING=i386", but compile commands have
> "-arch x86_64".
> In source/CMakeLists.txt, if I comment out the lines 38-41, then
> compile commands are with "-arch i386".
>
> # Comment out
> # if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
> # set(X64 1)
> # add_definitions(-DX86_64=1)
> # endif()
Hmm, you're in a lot of trouble if cmake thinks pointers are 8-bytes
with the compiler it's selected. Even though you are specifying i386
arch, it is still using a 64bit compile configuration. This email
seems relevant:
http://www.cmake.org/pipermail/cmake/2010-May/036705.html
> 2. i386 build generates the function names without leading underscore "_",
> but the linker looks for the functions with a leading underscore, and this
> makes the i386 build fail.
> (x86_64 build generates the function names with leading "_", so x86_64
> build does not have this problem)
This is source/cmake/CMakeASM_YASMInformation.cmake. The 32-bit ARGS
set for APPLE needs -DPREFIX. I've queued a fix for this. I can build
a 32bit Mac binary with this patch, if I follow these steps:
export CXX="g++-4.7 -m32"
export CC="gcc-4.7 -m32"
cmake -DENABLE_SHARED=OFF ../../source/
make
I get a link warning:
Linking CXX executable x265
ld: warning: PIE disabled. Absolute addressing (perhaps
-mdynamic-no-pic) not allowed in code signed PIE, but used in
_x265_pixel_sad_12x16_sse2 from libx265.a(sad-a.asm.o). To fix this
warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
but:
% file x265
x265: Mach-O executable i386
and:
% ./x265 -V
x265 [info]: HEVC encoder version 1.0+131-e9776dfd1471
x265 [info]: build info [Mac OS X][GCC 4.7.3][32 bit] 8bpp
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
AVX2 FMA3 LZCNT BMI2
If I try to build a shared library, I get this error:
Linking CXX shared library libx265.dylib
ld: illegal text-relocation to '_x265_pw_1' in
common/CMakeFiles/common.dir/x86/const-a.asm.o from
'_x265_pixel_sa8d_8x8_sse2' in
common/CMakeFiles/common.dir/x86/pixel-a.asm.o for architecture i386
collect2: error: ld returned 1 exit status
And I have no idea how to resolve it
--
Steve Borho
More information about the x265-devel
mailing list