Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Vorbis and Allegro 5 cross-compiling problem (mingw-w64)

This thread is locked; no one can reply to it. rss feed Print
Vorbis and Allegro 5 cross-compiling problem (mingw-w64)
EliasYFGM
Member #11,096
June 2009

Hello, I want to compile Allegro 5 for Windows (under Linux) with OGG/Vorbis support. However, I am having a problem trying to get it to work because cmake is unable to compile the test code for Vorbis, and refuses to include it. libvorbis and libvorbisfile (already compiled with mingw-w64) were installed in /usr/i686-w64-mingw32. I've already cross-compiled the other libraries: zlib, libpng, libjpeg, freetype, flac and libogg.

Allegro 5 was configured with the following:

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw.cmake -DSHARED=off -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 ..

And this is the cmake output:

-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Guessed MinGW directory: /usr
-- Performing Test HAVE_DM_POSITION
-- Performing Test HAVE_DM_POSITION - Success
-- Allowing GCC to use SSE instructions
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for include file dirent.h
-- Looking for include file dirent.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include files sys/types.h, linux/joystick.h
-- Looking for include files sys/types.h, linux/joystick.h - not found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file sys/io.h
-- Looking for include file sys/io.h - not found
-- Looking for include file sys/stat.h
-- Looking for include file sys/stat.h - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file time.h
-- Looking for include file time.h - found
-- Looking for include file sys/utsname.h
-- Looking for include file sys/utsname.h - not found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for include file soundcard.h
-- Looking for include file soundcard.h - not found
-- Looking for include file sys/soundcard.h
-- Looking for include file sys/soundcard.h - not found
-- Looking for include file machine/soundcard.h
-- Looking for include file machine/soundcard.h - not found
-- Looking for include file linux/soundcard.h
-- Looking for include file linux/soundcard.h - not found
-- Looking for include file libkern/OSAtomic.h
-- Looking for include file libkern/OSAtomic.h - not found
-- Looking for include file sys/inotify.h
-- Looking for include file sys/inotify.h - not found
-- Looking for include file sys/timerfd.h
-- Looking for include file sys/timerfd.h - not found
-- Looking for getexecname
-- Looking for getexecname - not found
-- Looking for mkstemp
-- Looking for mkstemp - not found
-- Looking for mmap
-- Looking for mmap - not found
-- Looking for mprotect
-- Looking for mprotect - found
-- Looking for sched_yield
-- Looking for sched_yield - found
-- Looking for sysconf
-- Looking for sysconf - not found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for ftello
-- Looking for ftello - found
-- Check size of _Bool
-- Check size of _Bool - done
-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV
-- Performing Test ALLEGRO_HAVE_PROCFS_ARGCV - Failed
-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H
-- Performing Test ALLEGRO_HAVE_SV_PROCFS_H - Failed
-- Performing Test ALLEGRO_HAVE_VA_COPY
-- Performing Test ALLEGRO_HAVE_VA_COPY - Success
-- Found OpenGL: opengl32  
-- Found DINPUT: /usr/i686-w64-mingw32/include  
-- Found D3D9: /usr/i686-w64-mingw32/include  
-- Found D3DX9: /usr/i686-w64-mingw32/include  
-- Found GDIPLUS: /usr/i686-w64-mingw32/include  
-- Performing Test SUPPORT_GDIPLUS
-- Performing Test SUPPORT_GDIPLUS - Success
-- Found DSOUND: /usr/i686-w64-mingw32/include  
-- Found OpenAL: /usr/i686-w64-mingw32/lib/libOpenAL32.dll.a  
-- Found FLAC: /usr/i686-w64-mingw32/include  
-- Performing Test FLAC_COMPILES
-- Performing Test FLAC_COMPILES - Success
-- DLL name for /usr/i686-w64-mingw32/lib/libFLAC.dll.a: libFLAC-8.dll
-- Could NOT find DUMB (missing:  DUMB_INCLUDE_DIR DUMB_LIBRARY) 
WARNING: libdumb not found or compile test failed, disabling support. 
-- Found OGG: /usr/include  
-- Found VORBIS: /usr/include  
-- Performing Test VORBIS_COMPILES
-- Performing Test VORBIS_COMPILES - Failed
WARNING: libvorbis not found or compile test failed, disabling support.
-- Found Freetype: /usr/i686-w64-mingw32/lib/libfreetype.a  
-- Found ZLIB: /usr/i686-w64-mingw32/lib/libz.a (found version "1.2.8") 
-- Could NOT find PhysFS (missing:  PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) 
-- Could NOT find PHYSFS (missing:  PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/elias/Librerías/allegro-5.0.11/build_msw

I don't mind about DUMB or PhysFS as I don't plan in using these (yet), but I really want vorbis/ogg support as I don't want to use over 40 MB .wav files just for music.

And out of curiosity, I tried compiling the code that cmake was trying to test, which was this one (located at addons/acodec/CMakeLists.txt):

#include <vorbis/vorbisfile.h>
int main(void)
{
    OggVorbis_File f;
    ov_callbacks callback;
    vorbis_info *v = 0;
    (void)v;
    ov_info(&f, -1);
    callback = OV_CALLBACKS_NOCLOSE;
    return 0;
}

It compiles without errors using i686-w64-mingw32-gcc. I don't know why cmake says it is unable to compile that code... a bug maybe? I'm using Ubuntu 14.04 and CMake 3.1.3.

EDIT: I used the old mingw32 instead (i586-mingw32msvc-gcc) and I recompiled libvorbis and libogg with it. CMAKE now detects Vorbis correctly, but another problem comes out: I made a simple test program for loading and playing .ogg files, but it does not play them at all (.wav files do play correctly).

I don't have problems compiling for Linux, only with mingw32 and mingw-w64.

Any help would be highly appreciated :)

SiegeLord
Member #7,827
October 2006
avatar

For the vorbis compile error, you could check CMakeFiles/CMakeError.log to see what error it reports along with the command line it used. Perhaps it uses the wrong compiler for some reason?

As for the other issue, the acodec addon by default loads the necessary DLLs dynamically (EDIT: only on Windows), so it expects to find the DLL in PATH, next to the executable or the system directories. You can disable this feature by passing -DWANT_ACODEC_DYNAMIC_LOAD=off to cmake.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

EliasYFGM
Member #11,096
June 2009

Yep, -DWANT_ACODEC_DYNAMIC_LOAD=off did it. However, only worked for mingw32 because mingw-w64 gave me lots of undefined references and errors while I was building the library.

I'm probably going to stick with mingw32 for cross-compilation... it even accepted -static as a parameter. It may be an old compiler but works better for what I was trying to do.

Thanks :)

Phrasz
Member #10,091
August 2008

Juan,

I use MSYS (which is a part of the standard MinGW -- NOT -w64 bundle) to build my non-cmake libaries. You can find info here: http://www.mingw.org/wiki/msys.

In there there's a shell to emulate bash (e.g. msys.bat), which at that point you can run the configure script that Autoconfig built.

My only trick is I set the install directory to a local folder (./configure --prefix=/c/;ibvorbis/1.3.5/bins) and then move all the built files to the base MinGW folder.

After building and installing ogg, I was successful at building vorbis and running your trial code. Personally, if I see configure and a Makefile I run away immediately from CMake. I looked at one of my ancient scripts (https://github.com/phrasz/A5_Installer/blob/master/Installer.ps1) and saw at least ogg, vorbis, and flac that use configure.

I hope this helps.
- Phrasz

Go to: