How to compile libwebm with MINGW-W64?

145 views
Skip to first unread message

timb...@gmail.com

unread,
Feb 6, 2018, 2:39:24 PM2/6/18
to WebM Discussion
Hello all...

I have a project where I need to create a Windows DLL of libwebm.  The instructions for compilation include use of cmake to generate files for Visual Studio, or using the Makefile.unix for other systems.

I was able to get the library compiled using Cygwin and cmake under Windows, after adding the MINGW-W64 compiler to my path; however, I get an AR-format file containing some .o files instead of a windows DLL.

Is there any way to compile this library with MINGW-W64 to generate a Windows DLL on Windows itself?  I found no instructions for doing this.  When I try to compile directly under the MINGW-W64 environment with cmake from Cygwin, I get a message stating it doesn't recognize my environment.

- Tim

Tom Finegan

unread,
Feb 6, 2018, 5:56:49 PM2/6/18
to WebM Discussion
On Mon, Feb 5, 2018 at 3:28 PM, <timb...@gmail.com> wrote:
Hello all...

I have a project where I need to create a Windows DLL of libwebm.  The instructions for compilation include use of cmake to generate files for Visual Studio, or using the Makefile.unix for other systems.

CMake is the tool to use for all targets. Makefile.unix is for legacy systems that don't have CMake packages. 

I was able to get the library compiled using Cygwin and cmake under Windows, after adding the MINGW-W64 compiler to my path; however, I get an AR-format file containing some .o files instead of a windows DLL.

A patch[1] that just landed removes the hard coded creation of static libraries from the CMake build.  

Is there any way to compile this library with MINGW-W64 to generate a Windows DLL on Windows itself?  I found no instructions for doing this.  When I try to compile directly under the MINGW-W64 environment with cmake from Cygwin, I get a message stating it doesn't recognize my environment.

Try using the standard CMake for windows. You (probably) don't want the Cygwin variant. 

Libwebm has not supported dylib targets in the past-- users that have needed a DLL have been on their own historically. The CMake build now allows for you to do so, but the windows support is incomplete. You're likely better off cross compiling-- that might actually work. As things are now a native windows DLL build requires additional work. Anyway, to enable the partial support for DLL builds your CMake command line looks like this:

$ cmake path/to/libwebm -DBUILD_SHARED_LIBS=1 && cmake --build .

Note: fwiw the above works perfectly well on macosx and linux, but the windows support needs work. Feel free to file a bug[2] if making your own wrapper around the static lib isn't feasible. 

To attempt a cross compile of a windows dylib using mingw-w64 this command line would be a good starting point:

$ cmake path/to/libwebm -DCMAKE_TOOLCHAIN_FILE=path/to/libwebm/build/x86_64-mingw-gcc.cmake -DBUILD_SHARED_LIBS=1 && cmake --build .

The above works on my linux box, but I haven't had a chance to actually run anything through the resulting tools and libwebm.dll. 

 

- Tim

--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webm-discuss+unsubscribe@webmproject.org.
To post to this group, send email to webm-d...@webmproject.org.
Visit this group at https://groups.google.com/a/webmproject.org/group/webm-discuss/.
For more options, visit https://groups.google.com/a/webmproject.org/d/optout.

Tim Bessie

unread,
Feb 6, 2018, 6:11:09 PM2/6/18
to webm-d...@webmproject.org
Thanks for all your suggestions!  I managed to use the unix Makefile and then using g++ manually to create the DLL.  I *think* it'll work.  If not, I'll try some of your ideas - thanks again!

- Tim

Reply all
Reply to author
Forward
0 new messages