fails to build with libmpg123 1.7.3

Support for running, installing or compiling OpenMW
Locked
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

fails to build with libmpg123 1.7.3

Post by lgromanowski »

heilkitty wrote:

Code: Select all

[ 70%] Building CXX object apps/openmw/CMakeFiles/openmw.dir/__/__/libs/mangle/sound/sources/mpg123_source.cpp.o
In file included from /home/heilkitty/soft/openmw/openmw/libs/mangle/sound/sources/mpg123_source.cpp:5:
/usr/include/mpg123.h:37:2: error: #error "Mismatch in large file setup! Enable/disable large file support appropriately to use libmpg123."
mpg123 FAQ says about this:
This is due to libmpg123 being compiled with large file support and your app is trying to compile without... or the other way round. Usually, it is the case that you upgraded to mpg123 1.6, which enabled large file support as default and your app build fails to use the switch for enabling large support.

The usual case is resolved by this:

1. Make sure you use off_t properly for all file offsets (mpg123 API, but also other file I/O).
2. Add -D_FILE_OFFSET_BITS=64 to your compiler flags -- for the whole build.

Note that just disabling large file support in libmpg123 may be an option, but not a smart move. Everyone should use large file support nowadays and GNU/Linux distributions use it as default.
nicolay wrote: Thanks for the report. I've never seen this error before, but could you try adding:

Code: Select all

add_definitions(-D_FILE_OFFSET_BITS=64)
anywhere to CMakeLists.txt (somewhere near the top i ok) and see if that makes any difference?
heilkitty wrote: It builds now. Additionally, it should be checked if the build against libmpg123 <1.6 is not broken with this change.
nicolay wrote: I tried it on my system and it seems to work there at least. I haven't added it to the repo yet though, I'd like to know if anyone knows what other consequences this could have.
Chris wrote:
nicolay wrote:I tried it on my system and it seems to work there at least. I haven't added it to the repo yet though, I'd like to know if anyone knows what other consequences this could have.
In 32-bit non-Windows, setting _FILE_OFFSET_BITS to 64 essentially changes the off_t type to a 64-bit type, and transparently replaces calls to the related low-level C I/O functions (open/close/read/write/etc) with their 64-bit-aware counterparts.

libmpg123 really has a horribly unstable ABI, which isn't helped by usage of off_t types and reluctance to change the lib's ABI version. But unfortunately it is one of the more accessible MP3 decoder libs around.

EDIT:
FWIW, I have a CMake script which checks to see if setting _FILE_OFFSET_BITS to 64 does anything, and gives the values you can then set on the command line.
EmbraceUnity wrote: Chris,

Could you please provide this Cmake script to me, I think I'm having this problem, and I'm not getting any sound.
Chris wrote: Sure. The attached zip contains two files which should go into the cmake/ subdir, and the appropriate CMakeLists.txt would do something like:

Code: Select all

INCLUDE(CheckFileOffsetBits)
...
CHECK_FILE_OFFSET_BITS()
IF(_FILE_OFFSET_BITS)
    ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
    SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
ENDIF(_FILE_OFFSET_BITS)
Should be done as soon as it can be, so header checks will have the definition set.
EmbraceUnity wrote: Worked!

Though I used INCLUDE(./cmake/CheckFileOffsetBits.cmake) instead

At first, it produced some "could not find file" errors which were resolved by renaming my directories so that they aren't lowercase. Would be nice if I didn't have to.

The only thing is that it seems like torch sounds aren't playing. Is this normal?
Locked