[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that
From: |
Matthias Geier |
Subject: |
Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries? |
Date: |
Tue, 24 Mar 2015 18:53:34 +0100 |
Hi Nikos.
On Tue, Mar 24, 2015 at 6:33 PM, Nikos Chantziaras wrote:
> (I re-added the list in CC.)
Thanks, I seem to have removed the list by accident ...
> Wait, you're building 64-bit Windows DLLs?
Yes.
> I thought you wanted 32-bit DLLs.
Well, I would like to have both, I just started with 64-bit.
> I guess all bets are off then. I don't how well that works.
I tried it again with TARGET=i686-w64-mingw32.static, which led to the
same warnings/errors.
You say this should work?
I also tried TARGET=i686-pc-mingw32.static, but this immediately gave me:
Makefile:334: *** Deprecated target specified:
"i686-pc-mingw32.static". Please use i686-w64-mingw32.[static|shared]
instead. Stop.
> Sorry. I should have paid more attention to the "x86_64" part in your
> original post.
No problem, thanks for you help anyway!
cheers,
Matthias
>
>
>
> On 24/03/15 19:22, Matthias Geier wrote:
>>
>> Hi Nikos.
>>
>> Thanks to your help, I'm getting closer ...
>>
>> On Tue, Mar 24, 2015 at 4:34 PM, Nikos Chantziaras wrote:
>>>
>>> Is your environment set correctly? I have a text file with this in it
>>> (~/bin/mxe-env):
>>>
>>> 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"
>>
>>
>> I didn't set the PATH before, this definitely helps!
>> I'm not quite sure if the second line has any effect, but I used it
>> anyway (changing i686 to x86_64).
>>
>> Now I get a bit further, but then I get the old warning again (and
>> then a bunch of linker errors):
>>
>> *** Warning: This system can not link to static lib archive
>> [...]/usr/x86_64-w64-mingw32.static/lib/libvorbis.la.
>> *** I have the capability to make that library automatically link in when
>> *** you link to this library. But I can only do this if you have a
>> *** shared version of the library, which you do not appear to have.
>>
>> These were the exact steps I did:
>>
>> # install the required Debian packages
>>
>> TARGET=x86_64-w64-mingw32.static
>>
>> git clone https://github.com/mxe/mxe.git
>>
>> cd mxe/
>>
>> make libsndfile -j8 JOBS=8 MXE_TARGETS=$TARGET
>>
>> cd ..
>>
>> export PATH=$(pwd)"/mxe/usr/bin:$PATH"
>> export
>> PKG_CONFIG_PATH_i686_w64_mingw32_static=$(pwd)"/mxe/usr/i686-w64-mingw32.static/lib/pkgconfig"
>> export
>> PKG_CONFIG_PATH_x86_64_w64_mingw32_static=$(pwd)"/mxe/usr/x86_64-w64-mingw32.static/lib/pkgconfig"
>>
>> tar xvzf mxe/pkg/libsndfile-1.0.25.tar.gz
>> cd libsndfile-1.0.25/
>> patch -p1 < ../mxe/src/libsndfile-1-fixes.patch
>>
>> ./configure --host=$TARGET --enable-shared --disable-static
>> --disable-sqlite --enable-external-libs --disable-octave
>> --disable-alsa LIBS="$($TARGET-pkg-config --libs vorbis ogg)"
>>
>> make -j8
>>
>>
>> Did I make a mistake somewhere?
>>
>>
>> I also tried your suggestion with checking out 0b5be38d, but this led
>> to the exact same errors.
>>
>> What else could I try?
>>
>> cheers,
>> Matthias
>>
>>>
>>> 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.
>
>
- [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/24
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Nikos Chantziaras, 2015/03/24
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/24
- Message not available
- Message not available
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Nikos Chantziaras, 2015/03/24
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?,
Matthias Geier <=
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Nikos Chantziaras, 2015/03/24
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/25
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Nikos Chantziaras, 2015/03/25
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/25
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/25
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/27
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Volker Grabsch, 2015/03/27
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, John Donoghue, 2015/03/27
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, Matthias Geier, 2015/03/30
- Re: [Mingw-cross-env-list] MXE: How to build a self-sufficient DLL that statically includes other libraries?, JohnD, 2015/03/30