Making a static lib with -MD option

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Making a static lib with -MD option

Steffen
In Windows it is quite common to have a static library which itself depends on dynamic runtime libraries.
For this purpose I configure ffmpeg to be built with -MD option.
In this case I get many linker error of avpriv_sprintf or avpriv_strtod.
libavformat.lib(gopher.o) : error LNK2001: unresolved external symbol __imp__avpriv_snprintf
libavutil.lib(eval.o) : error LNK2001: unresolved external symbol __imp__avpriv_strtod

Did anybody do something like this?
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Hendrik Leppkes
On Mon, May 13, 2013 at 12:37 PM, Steffen <[hidden email]> wrote:

> In Windows it is quite common to have a static library which itself depends
> on dynamic runtime libraries.
> For this purpose I configure ffmpeg to be built with -MD option.
> In this case I get many linker error of avpriv_sprintf or avpriv_strtod.
> libavformat.lib(gopher.o) : error LNK2001: unresolved external symbol
> __imp__avpriv_snprintf
> libavutil.lib(eval.o) : error LNK2001: unresolved external symbol
> __imp__avpriv_strtod
>
> Did anybody do something like this?
>
>
>


This should be fixed in latest git head, please try again with an up
to date version.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Steffen
i'm using FFmpeg 1.2 from March 15, 2013. Which files or changes were applied to remove this failure in git head?
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Carl Eugen Hoyos
Steffen <Steffen.Roeber@...> writes:

> i'm using FFmpeg 1.2 from March 15, 2013.

If you are not a distributor, please always use
current git head.

Carl Eugen

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Steffen
The git head works but gives me something like:

1>     Creating library ..\..\bin\Debug\cio.lib and object ..\..\bin\Debug\cio.exp
1>libavcodec.lib(pamenc.o) : warning LNK4049: locally defined symbol _avpriv_snprintf imported
1>libavcodec.lib(huffyuvenc.o) : warning LNK4217: locally defined symbol _avpriv_snprintf imported in function _encode_init
1>libavcodec.lib(ffv1enc.o) : warning LNK4049: locally defined symbol _avpriv_snprintf imported
1>libavcodec.lib(ratecontrol.o) : warning LNK4049: locally defined symbol _avpriv_snprintf imported
1>libavcodec.lib(assenc.o) : warning LNK4049: locally defined symbol _avpriv_snprintf imported
1>libavcodec.lib(xbmenc.o) : warning LNK4049: locally defined symbol _avpriv_snprintf imported
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Hendrik Leppkes
On Wed, May 22, 2013 at 9:42 AM, Steffen <[hidden email]> wrote:

> The git head works but gives me something like:
>
> 1>     Creating library ..\..\bin\Debug\cio.lib and object
> ..\..\bin\Debug\cio.exp
> 1>libavcodec.lib(pamenc.o) : warning LNK4049: locally defined symbol
> _avpriv_snprintf imported
> 1>libavcodec.lib(huffyuvenc.o) : warning LNK4217: locally defined symbol
> _avpriv_snprintf imported in function _encode_init
> 1>libavcodec.lib(ffv1enc.o) : warning LNK4049: locally defined symbol
> _avpriv_snprintf imported
> 1>libavcodec.lib(ratecontrol.o) : warning LNK4049: locally defined symbol
> _avpriv_snprintf imported
> 1>libavcodec.lib(assenc.o) : warning LNK4049: locally defined symbol
> _avpriv_snprintf imported
> 1>libavcodec.lib(xbmenc.o) : warning LNK4049: locally defined symbol
> _avpriv_snprintf imported
>
>
>

You can safely ignore these warnings, they happen because the build
system was meant to be kept simple, instead of over-complicating
everything and avoiding these warnings.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Steffen
Unfortunately not.
Example:
1. dll (cio.dll) links statically to av.libs
2. dll (crecord.dll) links to both statically to av.libs and dynamically to cio.dll

That gives me:
cio.lib(cio.dll) : error LNK2005: _avpriv_snprintf already defined in libavutil.lib(snprintf.o)
cio.lib(cio.dll) : error LNK2005: _avpriv_vsnprintf already defined in libavutil.lib(snprintf.o)
cio.lib(cio.dll) : error LNK2005: _avpriv_strtod already defined in libavutil.lib(strtod.o)
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Alex Cohn
On Wed, May 22, 2013 at 1:07 PM, Steffen <[hidden email]> wrote:
> Unfortunately not.
> Example:
> 1. dll (cio.dll) links statically to av.libs
> 2. dll (crecord.dll) links to both statically to av.libs and dynamically to cio.dll
>
> That gives me:
> cio.lib(cio.dll) : error LNK2005: _avpriv_snprintf already defined in libavutil.lib(snprintf.o)
> cio.lib(cio.dll) : error LNK2005: _avpriv_vsnprintf already defined in libavutil.lib(snprintf.o)
> cio.lib(cio.dll) : error LNK2005: _avpriv_strtod already defined in libavutil.lib(strtod.o)

I don't think the warnings about "locally defined symbol
_avpriv_snprintf imported" have anything to do with your problem. I am
afraid your procedure is wrong. You have snprintf.o included both in
cio.dll and in crecord.dll. I would suggest that you link crecord.dll
only to cio.dll, without libavutil.lib. You will probably get quite a
few unresolved references this way.

The next step will be to use [/INCLUDE
directive](http://msdn.microsoft.com/en-us/library/2s3hwbhs(v=vs.110).aspx)
for all these unresolved references, and rebuild the cio.dll. Now,
cio.dll will contain all references necessary to resolve the needs of
crecord,dll,

BR,
Alex Cohn
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Making a static lib with -MD option

Steffen
I finally merged cio and crecord. But the warnings are not very nice. Especially there is no way to disable them.