which libs shoud I link on windows

Questions that occur when trying to compile FFmpeg.
Post Reply
vincent1941
Posts: 1
Joined: Wed Jun 06, 2012 10:50 pm

which libs shoud I link on windows

Post by vincent1941 » Wed Jun 06, 2012 10:59 pm

I have successfully cross compile x264 for windows on centos5.8:

./configure --enable-static --enable-win32thread --host=i686-w64-mingw32 --prefix=/home/bxg/opensdk --cross-prefix=i686-w64-mingw32-

I copy the compiled libx264.a to visual studio 2008 env and build a sample. But I don't know which mingw libs (and where to find them) to link:

The link error below:

1>------ Build started: Project: h264_enc_test, Configuration: Release Win32 ------
1>Linking...
1>libx264.a(analyse.o) : warning LNK4229: invalid directive '/aligncomm:_x264_cabac_size_unary,5' encountered; ignored
1>libx264.a(analyse.o) : warning LNK4229: invalid directive '/aligncomm:_x264_cabac_transition_unary,5' encountered; ignored
1>libx264.a(cabac.o) : warning LNK4229: invalid directive '/aligncomm:_x264_cabac_contexts,5' encountered; ignored
1>libx264.a(vlc.o) : warning LNK4229: invalid directive '/aligncomm:_x264_run_before,5' encountered; ignored
1>libx264.a(vlc.o) : warning LNK4229: invalid directive '/aligncomm:_x264_level_token,5' encountered; ignored
1>libx264.a(analyse.o) : error LNK2001: unresolved external symbol ___udivdi3
1>libx264.a(set.o) : error LNK2001: unresolved external symbol ___udivdi3
1>libx264.a(encoder.o) : error LNK2001: unresolved external symbol ___udivdi3
1>libx264.a(common.o) : error LNK2001: unresolved external symbol ___udivdi3
1>libx264.a(ratecontrol.o) : error LNK2001: unresolved external symbol ___udivdi3
1>libx264.a(macroblock.o) : error LNK2001: unresolved external symbol ___udivdi3
1>libx264.a(encoder.o) : error LNK2001: unresolved external symbol ___ms_vsnprintf
1>libx264.a(encoder.o) : error LNK2001: unresolved external symbol _log2f
1>libx264.a(set.o) : error LNK2001: unresolved external symbol _log2f
1>libx264.a(ratecontrol.o) : error LNK2001: unresolved external symbol _log2f
1>libx264.a(analyse.o) : error LNK2001: unresolved external symbol _log2f
1>libx264.a(encoder.o) : error LNK2001: unresolved external symbol _fseeko64
1>libx264.a(common.o) : error LNK2001: unresolved external symbol _fseeko64
1>libx264.a(common.o) : error LNK2001: unresolved external symbol ___umoddi3
1>libx264.a(common.o) : error LNK2001: unresolved external symbol ___strtod
1>libx264.a(common.o) : error LNK2001: unresolved external symbol _ftello64
1>libx264.a(set.o) : error LNK2001: unresolved external symbol ___divdi3
1>libx264.a(ratecontrol.o) : error LNK2001: unresolved external symbol ___divdi3
1>libx264.a(analyse.o) : error LNK2001: unresolved external symbol ___divdi3
1>libx264.a(ratecontrol.o) : error LNK2001: unresolved external symbol ___mingw_vfprintf
1>libx264.a(ratecontrol.o) : error LNK2001: unresolved external symbol ___mingw_vsprintf
1>libx264.a(ratecontrol.o) : error LNK2001: unresolved external symbol ___mingw_vsscanf
1>libx264.a(set.o) : error LNK2001: unresolved external symbol ___mingw_vsscanf
1>libx264.a(analyse.o) : error LNK2001: unresolved external symbol ___chkstk_ms
1>libx264.a(set.o) : error LNK2001: unresolved external symbol ___chkstk_ms
1>libx264.a(me.o) : error LNK2001: unresolved external symbol ___chkstk_ms

rogerdpack
Posts: 1875
Joined: Fri Aug 05, 2011 9:56 pm

Re: which libs shoud I link on windows

Post by rogerdpack » Mon Jun 11, 2012 2:33 pm

I don't think anybody has done it but it's "several"...

MtnViewJohn
Posts: 1
Joined: Mon Jun 11, 2012 6:43 am

Re: which libs shoud I link on windows

Post by MtnViewJohn » Tue Jun 12, 2012 4:51 am

You can get rid of the ___chkstk_ms invocations by putting this in your configure options:

Code: Select all

--extra-cflags="-fno-stack-check -fno-stack-protector -mno-stack-arg-probe"
You probably want --enable-runtime-cpudetect if you want to run your program on other systems. The rest are dependencies from libm, libc, and libgcc.

I successfully linked static FFmpeg libraries against my code base without linking any of the mingw libraries. Instead I added a C file with functions for the missing symbols. I can't seem to attach the C file to this post, but you can find it at http://code.google.com/p/context-free/s ... mpegshim.c. It contains functions for many of the symbols that you require, but not all. Once you see it you will know what to add to get you program to link.

njahnke
Posts: 1
Joined: Sun Mar 24, 2013 1:22 am

Re: which libs shoud I link on windows

Post by njahnke » Sun Mar 24, 2013 3:21 am

i had to link in:
libmingwex.a
libmingw32.a

JanJansen
Posts: 1
Joined: Tue Apr 07, 2015 9:05 am

Re: which libs shoud I link on windows

Post by JanJansen » Tue Apr 07, 2015 9:25 am

Dear all,

Can someone tell me how to add ffmpegshim.c? I added that file to the libavutil source tree but then I get a lot of (no previous prototype ...) errors.

Code: Select all

/usr/share/mingw-w64/include/time.h:260:8: note: originally defined here
 struct timezone {
        ^
libavutil/ffmpegshim.c:67:8: error: redefinition of ‘struct timeval’
 struct timeval {
        ^
In file included from /usr/share/mingw-w64/include/time.h:256:0,
                 from libavutil/ffmpegshim.c:33:
/usr/share/mingw-w64/include/_timeval.h:10:8: note: originally defined here
 struct timeval
        ^
libavutil/ffmpegshim.c:72:13: error: no previous prototype for ‘gettimeofday’ [-Werror=missing-prototypes]
 int __cdecl gettimeofday(
             ^
libavutil/ffmpegshim.c:111:13: error: no previous prototype for ‘usleep’ [-Werror=missing-prototypes]
 int __cdecl usleep(
             ^
libavutil/ffmpegshim.c:162:26: error: no previous prototype for ‘udivmodsi4’ [-Werror=missing-prototypes]
 unsigned __int64 __cdecl udivmodsi4(
                          ^
libavutil/ffmpegshim.c:186:17: error: no previous prototype for ‘__divdi3’ [-Werror=missing-prototypes]
 __int64 __cdecl __divdi3(
                 ^
libavutil/ffmpegshim.c:212:17: error: no previous prototype for ‘__moddi3’ [-Werror=missing-prototypes]
 __int64 __cdecl __moddi3(
                 ^
libavutil/ffmpegshim.c:236:26: error: no previous prototype for ‘__udivdi3’ [-Werror=missing-prototypes]
 unsigned __int64 __cdecl __udivdi3(
                          ^
libavutil/ffmpegshim.c:244:26: error: no previous prototype for ‘__umoddi3’ [-Werror=missing-prototypes]
 unsigned __int64 __cdecl __umoddi3(
I don't prefer to link mingw files also in VS2013 but only ffmpeg.

Post Reply