[FFmpeg-devel] [PATCH] Fix linking on OS/2

Måns Rullgård mans
Fri Jun 4 19:01:54 CEST 2010


Dave Yeo <daveryeo at telus.net> writes:

> On 06/04/10 05:13 am, M?ns Rullg?rd wrote:
>> Dave Yeo<daveryeo at telus.net>  writes:
>>
>>> libavformat now has a dependency on libavutil causing this error on a
>>
>> libavformat has depended on libavutil for as long as libavutil has
>> existed.  Nothing has changed there.
>
> r23422 added the av_get_codec_tag_string dependency, not sure about
> the ff_toupper4.

Those are defined in libavcodec, which has also always been a
dependency of libavformat.  Nothing new.

>>> static build (similar error building a shared libavformat)
>>> [...]
>>> R:\tmp\ldconv_libavformat_s_a_74454c088fcb1ebd70.lib(utils.obj) :
>>> error LNK2029: "_ff_toupper4" : unresolved external
>>> R:\tmp\ldconv_libavformat_s_a_74454c088fcb1ebd70.lib(utils.obj) :
>>> error LNK2029: "_av_get_codec_tag_string" : unresolved external
>>>
>>> There were 2 errors detected
>>> make: *** [ffmpeg_g.exe] Error 1
>>
>> What is the exact command that fails?  Run "make V=1" and paste the
>> last command along with the full output from it.
>
> gcc -L"/usr/src/ffmpeg"/libavcodec -L"/usr/src/ffmpeg"/libavdevice
> -L"/usr/src/ffmpeg"/libavfilter -L"/usr/src/ffmpeg"/libavformat
> -L"/usr/src/ffmpeg"/libavutil -L"/usr/src/ffmpeg"/libpostproc
> -L"/usr/src/ffmpeg"/libswscale -Zomf -Zbin-files -Zargs-wild -Zmap  -o
> ffmpeg_g.exe ffmpeg.o cmdutils.o -lavdevice -lavfilter -lavformat
> -lavcodec -lswscale -lavutil -lz -lbz2 -lm
> weakld: error: Unresolved symbol (UNDEF) '_ff_toupper4'.
> weakld: info: The symbol is referenced by:
>     R:\tmp\ldconv_libavformat_s_a_74454c088fcb1ebd70.lib(utils.obj)
> weakld: error: Unresolved symbol (UNDEF) '_av_get_codec_tag_string'.
> weakld: info: The symbol is referenced by:
>     R:\tmp\ldconv_libavformat_s_a_74454c088fcb1ebd70.lib(utils.obj)
> Ignoring unresolved externals reported from weak prelinker.
>
> R:\tmp\ldconv_libavformat_s_a_74454c088fcb1ebd70.lib(utils.obj) :
> error LNK2029: "_ff_toupper4" : unresolved external
> R:\tmp\ldconv_libavformat_s_a_74454c088fcb1ebd70.lib(utils.obj) :
> error LNK2029: "_av_get_codec_tag_string" : unresolved external
>
> There were 2 errors detected
> make: *** [ffmpeg_g.exe] Error 1

Your linker is clearly fucked up.  The symbols in question are
referenced in libavformat and defined in libavcodec.  -lavcodec occurs
after -lavformat in the link command, so there is no reason for this
to fail.

Maybe I should take this opportunity to declare OS/2 unsupported and
remove all the related hacks...

>>> Fix is to rearrange the build order and linking as in the attached
>>> patch or any other order where libavutil comes before libavformat. For
>>> shared builds we'd still need to pass something like LDFLAGS=-Lavutil
>>> -lavutil.
>>> Dave
>>>
>>> Index: common.mak
>>> ===================================================================
>>> --- common.mak	(revision 23463)
>>> +++ common.mak	(working copy)
>>> @@ -31,7 +31,7 @@
>>>   $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
>>>   endif
>>>
>>> -ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
>>> +ALLFFLIBS = avutil avcodec avdevice avfilter avformat postproc swscale
>>>
>>>   CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
>>>   CFLAGS   += $(ECFLAGS)
>>
>> That patch has no effect at all.  You must be confused.
>
> It changes the link order so that the missing symbols come before the
> dependency, though perhaps
> +ALLFFLIBS = avcodec avdevice avfilter avutil avformat postproc swscale
> would be simpler.

I repeat, that variable does not in any way affect link order.
Besides, the link order is correct already, so no change is needed.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list