mpg123 1.25.7 doesn't work on WinXP
Brought to you by:
sobukus
Hello.
I noticed that mpg123 v1.25.7 doesn't work on Windows XP, verified on two machines. Apparently mpg123 imports a function _time32
from MSVCRT, which onvisouly is not avaialble in the Windows XP version of MSVCRT.DLL. For comparision, mpg123 v1.24.0 was still working fine on Windows XP. It was importing time
rather than _time32
, which I think is why.
Please see attached Dependency Walker for details! (new version on the right side)
Is there any way to compile latest mpg123 so that it will work on Windows XP? And yeah, I'm well aware that Windows XP is hopelessly outdated. But some of my usesrs insist on XP... sigh
Thanks and best regards,
MuldeR
Small update:
As it turns out, the only place in mpg123 where the
time()
function is actually called is in "playlist.c", where the random number generator is seeded. If I replace thistime()
call with an explicit_time64()
call in the code, then I will get a binary that imports_time64
rather than_time32
from MSVCRT.DLL. And, indeed,_time64
does exist in the Windows XP version of MSVCRT.DLL.Still I have no idea how a call to
time()
in the code can result in_time32
being imported. If we look at the "time.h" include file, we will see thattime()
is defined as a wrapper function around either_time32()
or_time64()
. And the latter is the default! The_time32()
function would only be used if the macro_USE_32BIT_TIME_T
was defined. But it isn't defined. I checked that.So, yeah, replacing
time()
with_time64()
in the code appears to be the solution for now...Last edit: MuldeR 2017-10-25
Can you try recompiling with -D__MINGW_USE_VC2005_COMPAT=1
The macro is defined in _mingw.h, this change affects ABI.
Thanks! I see the location in
_mingw.h
now:That surely explains why we get 32-Bit version of
time()
, even though_USE_32BIT_TIME_T
was never defined in application code. But it makes absoloutely no sense to me! According to MSDN,time()
is an alias fortime64()
, andtime_t
is an alias fortime64_t
– unless we explicitely define_USE_32BIT_TIME_T
in application code before including<time.h>
. Mabye this was different in very old MSVC versions. But then their#if
statement is wrong! Should be the other way around, i.e.#if defined(__MINGW_USE_VC2005_COMPAT)
, not#if !defined(...)
.Furthermore, it makes no sense either that the 32-Bit version of
time()
links against symbol_time32
, which is not available in MSVCRT.DLL in older Windows versions. The symboltime
, which is the very same function, has been available in MSVCRT.DLL since the beginning, and still is available in Windows 10. Ther's no advantage in using_time32
, it's just more incompatible...Last edit: MuldeR 2017-10-28
Indeed, and as expected, I can confirm that adding
-D__MINGW_USE_VC2005_COMPAT=1
to my CFLAGS will cause mpg123 to link against_time64
rather than_time32
.Still doesn't make any sense, as the expected (correct) behavior of "VC2005 COMPAT" would be the exact oppsosite: Use 32-Bit
time_t
by default (like VC2005 and earlier did) instead of 64-Bittime_t
(like VC2008 and later does). The real problem, though, is that linking against_time32
does not make any sense whatsoever, since we can just usetime
and thus avoid breaking Windoes XP.Last edit: MuldeR 2017-10-29
As the macro name implies, behavior changed in MSVC2005.
Take the discussion to the mingw-w64 mailing list.
Yeah, I think starting with MSVC2008 they made
time()
andtime_t
aliases for_time64()
andtime64_t
, respectively – unless_USE_32BIT_TIME_T
is defined before including<time.h>
.Before, e.g. MSVC2005, or when
_USE_32BIT_TIME_T
is defined,time()
would just call a function of exactly that name and return a 32-Bit value. Accordingly,time_t
used to be a 32-Bit type.Consequently, if
__MINGW_USE_VC2005_COMPAT
is supposed to restore MSVC2005 compatibility, then_USE_32BIT_TIME_T
shall be defined if and only if__MINGW_USE_VC2005_COMPAT
has been defined – not when__MINGW_USE_VC2005_COMPAT
has not been defined.Last edit: MuldeR 2017-10-28
Can we close this? Can we help it?
Hello,
I think on the Windows/MINGW platform, the define
__MINGW_USE_VC2005_COMPAT
should be added to the CFLAGS automatically by mpg123 Makefile, so that (by default) we get a binary that can work on Windows XP. The current default is to create a binary that does not work on Windows XP.Last edit: MuldeR 2018-01-01
Windows XP is further troubled now, with the dynamic module loading. It's simply an untested and rather unsupported platform now. You are still able to get a working build on it, but you have to tweak the toolchain and have to disable modules. And there's always old mpg123 for the old system.