Discussion:
[gs-bugs] [Bug 698783] - MuPDF - MinGW doesn't provide _ftelli64()/_fseeki64()
b***@artifex.com
2017-11-26 17:12:35 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698783

Bug ID: 698783
Summary: MinGW doesn't provide _ftelli64()/_fseeki64()
Product: MuPDF
Version: master
Hardware: PC
OS: Windows 7
Status: UNCONFIRMED
Severity: normal
Priority: P4
Component: fitz
Assignee: mupdf-***@artifex.com
Reporter: ***@gmail.com
QA Contact: gs-***@ghostscript.com
Word Size: ---

When I extract the source from mupdf-1.12-rc1-source.tar.gz , apply the fix I
suggested in Bug 698782, and run, under MinGW (of mingw.org):

make HAVE_GLUT=no

I get:

[...]
CC build/release/source/fitz/output.o
source/fitz/output.c: In function 'file_seek':
source/fitz/output.c:130:10: warning: implicit declaration of function
'_fseeki64' [-Wimplicit-function-declaration]
int n = _fseeki64(file, off, whence);
^~~~~~~~~
source/fitz/output.c: In function 'file_tell':
source/fitz/output.c:143:16: warning: implicit declaration of function
'_ftelli64' [-Wimplicit-function-declaration]
int64_t off = _ftelli64(file);
^~~~~~~~~
[...]
CC build/release/source/fitz/stream-open.o
source/fitz/stream-open.c: In function 'seek_file':
source/fitz/stream-open.c:110:14: warning: implicit declaration of function
'_fseeki64' [-Wimplicit-function-declaration]
int64_t n = _fseeki64(state->file, offset, whence);
^~~~~~~~~
source/fitz/stream-open.c:117:13: warning: implicit declaration of function
'_ftelli64' [-Wimplicit-function-declaration]
stm->pos = _ftelli64(state->file);
^~~~~~~~~
[...]
In file included from scripts/cmapdump.c:22:0:
scripts/../source/fitz/output.c: In function 'file_seek':
scripts/../source/fitz/output.c:130:10: warning: implicit declaration of
function '_fseeki64' [-Wimplicit-function-declaration]
int n = _fseeki64(file, off, whence);
^~~~~~~~~
scripts/../source/fitz/output.c: In function 'file_tell':
scripts/../source/fitz/output.c:143:16: warning: implicit declaration of
function '_ftelli64' [-Wimplicit-function-declaration]
int64_t off = _ftelli64(file);
^~~~~~~~~
scripts/../source/fitz/output.c: In function 'fz_new_output_with_path':
scripts/../source/fitz/output.c:196:7: warning: implicit declaration of
function 'fz_remove_utf8' [-Wimplicit-function-declaration]
if (fz_remove_utf8(filename) < 0)
^~~~~~~~~~~~~~
LINK build/release/scripts/cmapdump.exe
build/release/scripts/cmapdump.o:cmapdump.c:(.text$file_tell+0xb):
undefined reference to `_ftelli64'
build/release/scripts/cmapdump.o:cmapdump.c:(.text$seek_file+0x3b):
undefined reference to `_ftelli64'
collect2.exe: error: ld returned 1 exit status
make: *** [build/release/scripts/cmapdump.exe] Error 1

and the build stops.

Looking into it, it turns out that MinGW (of mingw.org) doesn't provide
_ftelli64()/_fseeki64() (although Mingw-w64 does), nor ftello()/fseeko().
Instead, it provides ftello64()/fseeko64(), which seems to do the same thing.

A solution would be to do, in source/fitz/output.c, for _ftelli64:

#ifdef __MINGW32__
int64_t off = ftello64(file);
#elif defined(_WIN32) || defined(_WIN64)
int64_t off = _ftelli64(file);

and for _fseeki64:

#ifdef __MINGW32__
int n = fseeko64(file, off, whence);
#elif defined(_WIN32) || defined(_WIN64)
int n = _fseeki64(file, off, whence);

and do something equivalent in source/fitz/stream-open.c.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-11-26 17:14:40 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698783

Tamir Evan <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@gmail.com
--
You are receiving this mail because:
You are the QA Contact for the bug.
Loading...