|
From: | Nikos Chantziaras |
Subject: | Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries? |
Date: | Tue, 24 Mar 2015 17:36:37 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
export PATH="/home/realnc/opt/mxe/usr/bin:$PATH"export PKG_CONFIG_PATH_i686_w64_mingw32_static="/home/realnc/opt/mxe/usr/i686-w64-mingw32.static/lib/pkgconfig"
Before using MXE, I do: . ~/bin/mxe-env (Note the dot at the start of the command.) You must NOT set anything else in there. On 24/03/15 17:28, Matthias Geier wrote:
Hi Nikos. Thanks a lot, this looks promising! Everything works fine including "./configure", but I get an error during "make": make[2]: Entering directory '[...]/libsndfile-1.0.25/src' CC sndfile.lo CC aiff.lo CC au.lo CC avr.lo CC caf.lo CC dwd.lo CC flac.lo CC g72x.lo In file included from au.c:26:0: sndfile.h:318:9: error: unknown type name '__int64' typedef __int64 sf_count_t ; ^ In file included from dwd.c:26:0: sndfile.h:318:9: error: unknown type name '__int64' typedef __int64 sf_count_t ; ... and many similar errors. What did I do wrong? As far as I can tell, the ./configure output looks OK: Configuration summary : libsndfile version : .................. 1.0.25 Host CPU : ............................ i686 Host Vendor : ......................... w64 Host OS : ............................. mingw32.static Experimental code : ................... no Using ALSA in example programs : ...... no External FLAC/Ogg/Vorbis : ............ yes Tools : Compiler is GCC : ..................... yes GCC version : ......................... 4.9.2 Installation directories : Library directory : ................... /usr/local/lib Program directory : ................... /usr/local/bin Pkgconfig directory : ................. /usr/local/lib/pkgconfig HTML docs directory : ................. /usr/local/share/doc/libsndfile1-dev/html cheers, Matthias On Tue, Mar 24, 2015 at 3:28 PM, Nikos Chantziaras wrote:On 24/03/15 12:51, Matthias Geier wrote:[...] This makes a lot of sense in general, but I have a specific case where I would like to mix static and shared libraries. I would like to create a DLL for libsndfile, which should statically include all dependencies (libFLAC, libogg, libvorbis, ...).Build against a static MXE, but outside of MXE. That's how I create my self-containted :-) That means, build everything libsndfile needs in MXE. Statically. But *don't* build libsndfile itself. Then, build it outside of MXE with something like the below. It also applies the MXE-specific patch and rebuilds the configure script for that patch to take effect. (I assume here that you installed MXE in ~/opt/mxe; adjust the path below according to your MXE directory.) cd /tmp tar xf libsndfile-1.0.25.tar.gz cd libsndfile-1.0.25 patch -p1 < ~/opt/mxe/src/libsndfile-1-fixes.patch autoreconf -fi -IM4 ./configure --host=i686-w64-mingw32.static --enable-shared --disable-static --disable-sqlite --disable-octave --disable-alsa make -j4 This will produce a dll somewhere. Find it with: find . -iname "*.dll" That dll should contain everything it needs to run on its own. The above assumes you're on latest git master of MXE. For the old "stable" MXE, you need to adjust the --host accordingly. Note though: this method can be problematic with C++ exception handling, since each DLL you produce contains a static copy of libgcc. If you have several DLLs that are built that way, then each one contains its own libgcc. The result of that is that exceptions might not propagate correctly. I think this only applies when the DLL is used by an *.exe or another dll that is written in C++, but I'm not sure.
[Prev in Thread] | Current Thread | [Next in Thread] |