[mythtv] Strange distribution-dependent build error
Paul Gardiner
lists at glidos.net
Wed Aug 13 21:46:26 UTC 2025
On 13/08/2025 01:25, Scott Theisen wrote:
> On 2025/08/12 08:38, Paul Gardiner wrote:
>> On 06/08/2025 20:44, Scott Theisen wrote:
>>> On 2025/08/06 06:17, Paul Gardiner wrote:
>>>> I have a .spec file that builds mythtv packages for opensuse leap.
>>>> I've been using it for several years, needing to make only small
>>>> changes from time to time as leap has moved through various
>>>> versions. Surprisingly to me, I get this error when I try to use the
>>>> same .spec file for opensuse tumbleweed:
>>>>
>>>> [ 238s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-
>>>> suse- linux/bin/ld: /tmp/ccf31tRw.ltrans115.ltrans.o: warning:
>>>> relocation against `pd_1' in read-only section `.text'
>>>> [ 238s] /usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-
>>>> suse- linux/bin/ld: /tmp/ccf31tRw.ltrans115.ltrans.o: relocation
>>>> R_X86_64_PC32 against undefined symbol `pd_1' can not be used when
>>>> making a shared object; recompile with -fPIC
>>>>
>>>> This seems to relate to a piece of inline assembly code in mythtv/
>>>> mythtv/external/FFmpeg/libavcodec/x86/lpc_init.c. I thought -fPIC
>>>> didn't affect inline assemble, and in any case, I'd imagine that the
>>>> flags are consistent between leap and tumbleweed.
>>>>
>>>> I'm struggling to find a way forward. Any thoughts?
>>>>
>>>> Cheers,
>>>> Paul.
>>>
>>> Both configure and CMake run FFmpeg/configure with --enable-pic, so
>>> that is strange since it should already compile with -fPIC.
>>>
>>> How do FFmpeg/config.h and FFmpeg/ffbuild/config.mak differ between
>>> the two builds? In particular, what are the values of
>>> FFMPEG_CONFIGURATION, CPPFLAGS, and CFLAGS?
>>
>> There were differences, which surprised me - perhaps it shouldn't. The
>> failing case included -flto=auto. I added -fno-lto and that avoided
>> the error. Possibly adding -fno-lto isn't the best fix. I wonder if
>> somehow -fPIC is added to the compiler flags, but not the link flags.
>> Still, I have something that works.
>>
>> Thanks for your help.
>
> Adding -fno-lto will disable LTO, but where is -flto=auto coming from?
> CMake doesn't compile FFmpeg with LTO and `configure --enable-lto` adds
> -flto not -flto=auto.
The opensuse build service suggests adding
CFLAGS="%{optflags}";export CFLAGS;
CXXFLAGS="%{optflags}";export CXXFLAGS;
to the .spec file. I just followed their instructions, my having little
knowledge of which flags I should add. The strategy had seemingly been
working up to now.
More information about the mythtv-dev
mailing list