mingw-cross-env-list
[Top][All Lists]
Advanced

[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: Wed, 25 Mar 2015 10:26:12 +0100

On Tue, Mar 24, 2015 at 7:22 PM, Nikos Chantziaras wrote:
> On 24/03/15 19:53, Matthias Geier wrote:
>> On Tue, Mar 24, 2015 at 6:33 PM, Nikos Chantziaras wrote:

[...]

>> I tried it again with TARGET=i686-w64-mingw32.static, which led to the
>> same warnings/errors.
>>
>> You say this should work?
>
> Yes. It works for me without issues when using a 32-bit MXE.

OK, that's good to know. I'll keep trying.

> Try making a clean environment with a i686-w64-mingw32.static MXE build, and
> be careful not to mix i686 and x86_64. The best way to test that, is to not
> build an x86_64 MXE to begin with.
>
> In other words, wipe everything and start from scratch, making sure to only
> use i686 and see if that works.

I did that before, I always started from scratch.
I just tried it again and the same warnings/errors as before occur.
See below for the exact commands and some output.

> Note: the
>
>   export
> PKG_CONFIG_PATH_i686_w64_mingw32_static="mxe_dir/usr/i686-w64-mingw32.static/lib/pkgconfig"
>
> is actually crucial. If you don't correctly export that, building with MXE
> will result in Linux header files getting used instead of the MXE ones. This
> might be what's causing you trouble, since you didn't seem to have that set
> originally. Set the env variables correctly *before* you try to build
> something with MXE.

I set the environment variables after the static build but before the
shared build.
Is that OK?

> And always check that the path you set is actually correct.

The $PATH definitely works, since all the right executables (with
$TARGET prefixed) are mentioned in the ./configure output and I can
call them directly from the shell.
How can I check if the pkgconfig stuff works?

I'm wondering why I don't get a -L argument when running this:

$ i686-w64-mingw32.static-pkg-config --libs vorbis ogg
-lvorbis -logg -lm

These are the exact commands I'm calling (some line breaks may be messed up):

# install the required Debian packages
# plus libtool-bin (only libtool is mentioned in the docs)

#TARGET=x86_64-w64-mingw32.static
TARGET=i686-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
# from mxe/src/libsndfile.mk:
autoreconf -fi -IM4

./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

Does any of this look suspicious?

There are 2 warnings during ./configure, I don't know if they are relevant:

...
checking for sysroot... no
checking for i686-w64-mingw32.static-mt... no
checking for mt... mt
configure: WARNING: using cross tools not prefixed with host triplet
checking if mt is a manifest tool... no
...
checking for i686-w64-mingw32.static-pkg-config...
/home/mg/git/PySoundFile/crosscompile/mxe/usr/bin/i686-w64-mingw32.static-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for flac >= 1.2.1 ... yes
checking for ogg >= 1.1.3 ... yes
checking for vorbis >= 1.2.3 ... yes
checking for vorbisenc >= 1.2.3 ... yes
checking processor clipping capabilities... none
checking sndio.h usability... no
checking sndio.h presence... no
checking for sndio.h... no
configure: WARNING:
******************************************************************
configure: WARNING: *** We are cross-compiling, so have to assume
sizeof (short) == 2
configure: WARNING: *** and sizeof (int) == 4. If this is not the case
there is no
configure: WARNING: *** chance of this working. Please contact the
mantainer.
configure: WARNING:
******************************************************************
checking if i686-w64-mingw32.static-gcc accepts -std=gnu99... yes
checking for version of i686-w64-mingw32.static-gcc... 4.9.2
...

Finally, here's some selected output from "make":

...
  CC       sndfile.lo
  CC       aiff.lo
  CC       au.lo
  CC       avr.lo
  CC       caf.lo
  CC       dwd.lo
  CC       flac.lo
...
  CC       chunk.lo
  CC       ogg.lo
  CC       chanmap.lo
  CC       windows.lo
  CC       id3.lo
/bin/bash ../libtool   --tag=RC --mode=compile
i686-w64-mingw32.static-windres  version-metadata.rc -o
version-metadata.lo
libtool: compile:  i686-w64-mingw32.static-windres version-metadata.rc
 -o .libs/version-metadata.o
  CCLD     libcommon.la

*** Warning: This system can not link to static lib archive
[...]/mxe/usr/i686-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.

*** Warning: This system can not link to static lib archive
[...]/mxe/usr/i686-w64-mingw32.static/lib/libogg.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.
  CC       GSM610/add.lo
  CC       GSM610/code.lo
...
.libs/flac.o: In function `flac_seek':
[...]/libsndfile-1.0.25/src/flac.c:1301: undefined reference to
`FLAC__stream_decoder_seek_absolute'
[...]/libsndfile-1.0.25/src/flac.c:1302: undefined reference to
`FLAC__stream_decoder_get_decode_position'
.libs/flac.o: In function `flac_close':
[...]/libsndfile-1.0.25/src/flac.c:693: undefined reference to
`FLAC__metadata_object_delete'
...
collect2: error: ld returned 1 exit status
Makefile:653: recipe for target 'libsndfile.la' failed
...

cheers,
Matthias



reply via email to

[Prev in Thread] Current Thread [Next in Thread]