Libor Capak
2011-11-08 17:26:03 UTC
i'm trying to cross-compile openal (git version) for win32 mingw.
openal-soft/build$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt
-DHOST=i586-mingw32msvc -DCMAKE_RC_COMPILER=i586-mingw32msvc-windres
openal-soft/build$ make
...
[ 96%] Building C object CMakeFiles/openal.dir/Alc/backends/wave.obj
/home/el/openal-soft/Alc/backends/wave.c:1: warning: -fPIC ignored for
target (all code is position independent)
Linking C shared library libopenal.so
Hi.openal-soft/build$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt
-DHOST=i586-mingw32msvc -DCMAKE_RC_COMPILER=i586-mingw32msvc-windres
openal-soft/build$ make
...
[ 96%] Building C object CMakeFiles/openal.dir/Alc/backends/wave.obj
/home/el/openal-soft/Alc/backends/wave.c:1: warning: -fPIC ignored for
target (all code is position independent)
Linking C shared library libopenal.so
This is odd. It looks like it's not cross-compiling even though it's using the
cross-compiler. Did you make sure to clean out the build directory before
running cmake with those parameters? Where are the executables (and headers
and libs) for the cross-compiler stored?
files are all in /usr/i586-mingw32msvc/{bin, include, lib} -- it's
mingw32 debian package (wheezy) as i said in first mail. Using this
debian package i've cross-compiled some other libraries without any
problems. It's not possible that "Linking C shared library
libopenal.so" (not .dll) is problem of cmake?
Please help. I'd like to compile static library too - I don't have
experience with cmake - so don't know how to change XCompile.txt in
good way.
To build a static library, add -DLIBTYPE=STATIC when running cmake. Note,experience with cmake - so don't know how to change XCompile.txt in
good way.
though, that the static lib is not very well tested, and may not work. Also,
the lib is LGPL, so the user would need to be able to rebuild the app with
their own version of the lib. If your app is open source, then it should be
fine, but using a DLL would generally be a better idea since users could just
replace that and not bother your app.
using simple SConstruct (config.h was taken from linux
cross-compilation experiment):
env = Environment(tools = ['mingw'])
env.Append(CPPDEFINES=['_DEBUG', 'AL_ALEXT_PROTOTYPES', 'AL_LIBTYPE_STATIC'])
env.Append(CFLAGS='-g -O2 -Wall -Winline -Wextra')
env.Append(CPPPATH=['include', '.', 'OpenAL32/Include'])
env.StaticLibrary(target='openal', source=Glob('Alc/*.c') + Glob('Alc/backends/winmm.c') + Glob('Alc/backends/null.c') + Glob('Alc/backends/loopback.c') + Glob('Alc/backends/wave.c') + Glob('OpenAL32/*.c'))
and this small patch:
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 399c3ee..e483975 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -415,8 +415,8 @@ static void alc_init(void);
static void alc_deinit(void);
static void alc_deinit_safe(void);
-#ifndef AL_LIBTYPE_STATIC
UIntMap TlsDestructor;
+#ifndef AL_LIBTYPE_STATIC
it seems to work fine
L.