[x264-devel] [PATCH] disable PIC in C code on Darwin

Gregor Riepl onitake at sunrise.ch
Fri Oct 3 18:29:21 CEST 2008


>>> It appears to me that it does affect the build of shared libs:
>>>
>>> common/mc.c:0: warning: -mdynamic-no-pic overrides -fpic or -fPIC
>>> common/predict.c:0: warning: -mdynamic-no-pic overrides -fpic or - 
>>> fPIC
>>> common/pixel.c:0: warning: -mdynamic-no-pic overrides -fpic or -fPIC
>>> common/macroblock.c:0: warning: -mdynamic-no-pic overrides -fpic  
>>> or -fPIC
>>> common/frame.c:0: warning: -mdynamic-no-pic overrides -fpic or -fPIC
>>> common/dct.c:0: warning: -mdynamic-no-pic overrides -fpic or -fPIC
>>> [...]
>>
>> Sorry, I'd forgotten it overrides other flags.
>> Could someone test this one on OS X 10.4+i386?
>
> Has anyone tested this? superdump?

i did. but i didn't build it shared.
-mdynamic-no-pic works just fine for static libs.
test conditions:
- applied patch and built libx264.a
- built mencoder with x264 support, linked against the libx264.a
- encoded a video file with the following options: in.avi -oac copy - 
ovc x264 -of lavf -x264encopts threads=2:bitrate=1200 -lavfopts  
format=mp4 -ofps 30 -o out.mp4
no compiler/linker warning or error, no crash, and out.mp4 plays fine  
in mplayer and vlc.

>> I know it works on 10.5, but I think shared libraries with dynamic- 
>> no-pic
>> are a feature of the new ld.
>
> I can confirm that everything works alright here on 10.5.5 too, with
> standard Xcode tools (not the iPhone one).


using xcode 3.1.1 from the iphone sdk here.

the man page says:
        -mdynamic-no-pic
            On Darwin and Mac OS X systems, compile code so that it is  
not relocatable, but
            that its external references are relocatable.  The  
resulting code is suitable
            for applications, but not shared libraries.

doesn't look like it's a good idea to add this option when building  
shared...



More information about the x264-devel mailing list