Diego Biurrun
2006-11-05 22:16:39 UTC
Hi,
libdvdcss currently fails to link on Cygwin with the following error
message:
/home/bond/libdvdcss/src/device.c:595: undefined reference to `_lseek64'
The problem is that Cygwin does not have lseek64. In src/common.h
lseek64 is redefined to lseek for most platforms, but not for Cygwin.
Currently we have the following in src/common.h (irrelevant lines left
out):
#if defined( WIN32 )
# if defined( __MINGW32__ )
# define lseek64 _lseeki64
# endif
# if defined( _MSC_VER )
# endif
#else
# define lseek64 lseek
#endif
Unfortunately Cygwin defines WIN32 and thus does not hit the else case
where lseek64 gets redefined.
This block has things backwards. If MinGW and MSC need special-casing,
then it should be confined in the smallest possible space. My solution
is therefore to remove the else case from that block and redefine lseek
for MinGW and MSC:
#if defined( WIN32 )
# if defined( __MINGW32__ )
# define lseek _lseeki64
# endif
# if defined( _MSC_VER )
# define lseek lseek64
# endif
#endif
Of course lseek64 needs to be replaced by lseek in src/device.c.
The attached patch accomplished this, please apply.
Diego
libdvdcss currently fails to link on Cygwin with the following error
message:
/home/bond/libdvdcss/src/device.c:595: undefined reference to `_lseek64'
The problem is that Cygwin does not have lseek64. In src/common.h
lseek64 is redefined to lseek for most platforms, but not for Cygwin.
Currently we have the following in src/common.h (irrelevant lines left
out):
#if defined( WIN32 )
# if defined( __MINGW32__ )
# define lseek64 _lseeki64
# endif
# if defined( _MSC_VER )
# endif
#else
# define lseek64 lseek
#endif
Unfortunately Cygwin defines WIN32 and thus does not hit the else case
where lseek64 gets redefined.
This block has things backwards. If MinGW and MSC need special-casing,
then it should be confined in the smallest possible space. My solution
is therefore to remove the else case from that block and redefine lseek
for MinGW and MSC:
#if defined( WIN32 )
# if defined( __MINGW32__ )
# define lseek _lseeki64
# endif
# if defined( _MSC_VER )
# define lseek lseek64
# endif
#endif
Of course lseek64 needs to be replaced by lseek in src/device.c.
The attached patch accomplished this, please apply.
Diego