Bug 3361

Summary: Build Failed on armhfp for x265 - recompile with -fPIC
Product: Fedora Reporter: Nicolas Chauvet <kwizart>
Component: x265Assignee: Dominik 'Rathann' Mierzejewski <dominik>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P5    
Version: unspecified   
Hardware: All   
OS: GNU/Linux   
namespace:
Bug Depends on:    
Bug Blocks: 2407    
Attachments: Fix FTBFS on armhfp

Description Nicolas Chauvet 2014-09-16 15:23:53 CEST
/usr/bin/cmake -E cmake_link_script CMakeFiles/x265-static.dir/link.txt --verbose=1
/usr/bin/ld: encoder/CMakeFiles/encoder.dir/__/Lib/TLibEncoder/TEncBinCoderCABAC.cpp.o: relocation R_ARM_MOVW_ABS_NC against `_ZN4x26511g_nextStateE' can not be used when making a shared object; recompile with -fPIC
encoder/CMakeFiles/encoder.dir/__/Lib/TLibEncoder/TEncBinCoderCABAC.cpp.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libx265.so.25] Error 1
Comment 1 Nicolas Chauvet 2014-09-28 18:33:05 CEST
Created attachment 1328 [details]
Fix FTBFS on armhfp

This patch fix the detection on armv7l ARM architecture.
A quick look at where the ARM definitions occurs in the code seems to suggest most hardware capabilities are tested at runtime.

The only remaining issue is test binaries aren't built at all on arm for some reason. Even when trying to build with static linking (like i686) 

Unfortunately the runtime tests failed:
(gdb) run --input-res 352x288 --fps 25 /home/builder/*.yuv -o test.x265
Starting program: /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/x265 --input-res 352x288 --fps 25 /home/builder/*.yuv -o test.x265
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
yuv  [info]: 352x288 fps 25000/1000 i420p8 frames 0 - 299 of 300
[New Thread 0xb6b6d450 (LWP 6481)]
x265 [info]: HEVC encoder version 1.2
x265 [info]: build info [Linux][GCC 4.8.3][32 bit] 8bpp
x265 [warning]: Assembly not supported in this binary
x265 [info]: using cpu capabilities: none!
[New Thread 0xb636d450 (LWP 6482)]
[New Thread 0xb5b6d450 (LWP 6483)]
[New Thread 0xb536d450 (LWP 6484)]
[New Thread 0xb4b6d450 (LWP 6485)]
x265 [info]: WPP streams / pool / frames         : 5 / 4 / 2
x265 [info]: Main profile, Level-2 (Main tier)
x265 [info]: CU size                             : 64
x265 [info]: Max RQT depth inter / intra         : 1 / 1
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb / refs: 1 / 1 / 0 / 3
x265 [info]: Rate Control / AQ-Strength / CUTree : CRF-28.0 / 1.0 / 1
x265 [info]: tools: rd=3 lft sao-lcu signhide 
[New Thread 0xb3c54450 (LWP 6486)]
[New Thread 0xb32f9450 (LWP 6487)]
[0.3%] 1/300 frames, 0.46 fps, 1145.60 kb/s, eta 0:10:49  
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb5b6d450 (LWP 6483)]
x265::TComDataCU::xAddMVPCandOrder (this=this@entry=0x5ce2c8, outMV=..., picList=picList@entry=0, refIdx=refIdx@entry=0, partUnitIdx=245, 
    dir=dir@entry=x265::MD_ABOVE) at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/Lib/TLibCommon/TComDataCU.cpp:2581
2581	        if (bIsCurrRefLongTerm == bIsNeibRefLongTerm)
(gdb) bt
#0  x265::TComDataCU::xAddMVPCandOrder (this=this@entry=0x5ce2c8, outMV=..., picList=picList@entry=0, refIdx=refIdx@entry=0, 
    partUnitIdx=245, dir=dir@entry=x265::MD_ABOVE)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/Lib/TLibCommon/TComDataCU.cpp:2581
#1  0xb6f716a0 in x265::TComDataCU::fillMvpCand (this=this@entry=0x5ce2c8, partIdx=3048649968, partIdx@entry=0, partAddr=<optimized out>, 
    picList=picList@entry=0, refIdx=refIdx@entry=0, info=info@entry=0xb5b6c7b4, mvc=mvc@entry=0xb5b6c6a4)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/Lib/TLibCommon/TComDataCU.cpp:2298
#2  0xb6f42f48 in x265::TEncSearch::predInterSearch (this=0x1baec0, cu=cu@entry=0x5ce2c8, predYuv=predYuv@entry=0x5cad08, 
    bMergeOnly=bMergeOnly@entry=false, bChroma=bChroma@entry=false)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/Lib/TLibEncoder/TEncSearch.cpp:2140
#3  0xb6f63a1c in x265::TEncCu::xComputeCostInter (this=this@entry=0x1bb060, outTempCU=0x5ce2c8, outPredYuv=0x5cad08, 
    partSize=partSize@entry=x265::SIZE_2Nx2N, bUseMRG=bUseMRG@entry=false)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/encoder/compress.cpp:223
#4  0xb6f64e88 in x265::TEncCu::xCompressInterCU (this=this@entry=0x1bb060, outBestCU=@0xb6fd3000: 0xb9ee0, 
    outTempCU=@0x0: <error reading variable>, cu=<optimized out>, depth=depth@entry=2, bInsidePicture=142, bInsidePicture@entry=206, 
    PartitionIndex=PartitionIndex@entry=3, minDepth=minDepth@entry=2 '\002')
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/encoder/compress.cpp:462
#5  0xb6f654e4 in x265::TEncCu::xCompressInterCU (this=this@entry=0x1bb060, outBestCU=@0xb6fd3000: 0xb9ee0, 
    outTempCU=@0x0: <error reading variable>, cu=<optimized out>, depth=depth@entry=1, bInsidePicture=206, bInsidePicture@entry=172, 
    PartitionIndex=PartitionIndex@entry=3, minDepth=<optimized out>, minDepth@entry=2 '\002')
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/encoder/compress.cpp:759
#6  0xb6f654e4 in x265::TEncCu::xCompressInterCU (this=this@entry=0x1bb060, outBestCU=@0xb6fd3000: 0xb9ee0, 
    outTempCU=@0x0: <error reading variable>, cu=cu@entry=0x1953620, depth=depth@entry=0, bInsidePicture=172, bInsidePicture@entry=false, 
    PartitionIndex=PartitionIndex@entry=0, minDepth=<optimized out>, minDepth@entry=4 '\004')
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/encoder/compress.cpp:759
#7  0xb6f31984 in x265::TEncCu::compressCU (this=this@entry=0x1bb060, cu=cu@entry=0x1953620)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/Lib/TLibEncoder/TEncCu.cpp:372
#8  0xb6f5d40c in x265::CTURow::processCU (this=0x6d4460, this@entry=0x0, cu=cu@entry=0x1953620, slice=0x19517f8, 
    bufferSbac=bufferSbac@entry=0x0, tld=..., bSaveSBac=false)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/encoder/cturow.cpp:116
#9  0xb6f5a508 in x265::FrameEncoder::processRowEncoder (this=0xb431c010, row=-1406642644, tld=...)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/encoder/frameencoder.cpp:955
#10 0xb6fbb270 in x265::WaveFront::findJob (this=0xb431c010, threadId=168312)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/common/wavefront.cpp:133
#11 0xb6fba9ac in x265::PoolThread::threadMain (this=0x29148)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/common/threadpool.cpp:159
#12 0xb6fba5ac in stackAlignMain (instance=<optimized out>)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/common/threading.cpp:34
#13 x265::ThreadShim (opaque=<optimized out>)
    at /home/builder/rpmbuild/BUILD/multicoreware-x265-d6257335c537/source/common/threading.cpp:79
#14 0xb6ef4d10 in start_thread () from /lib/libpthread.so.0
#15 0xb6d0bfb0 in ?? () from /lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Comment 2 Dominik 'Rathann' Mierzejewski 2014-12-18 16:49:13 CET
Thanks for the patch, applied and built (with a workaround not to run tests on ARM).

Hopefully I'll have some time to debug this over the holiday period.
Comment 3 Nicolas Chauvet 2015-01-16 23:15:04 CET
closing as you have applied the patch