Bug 698782 - fz_fopen_utf8() not declared when compiling under MinGW
Summary: fz_fopen_utf8() not declared when compiling under MinGW
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: fitz (show other bugs)
Version: master
Hardware: PC Windows 7
: P4 normal
Assignee: MuPDF bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-26 08:18 UTC by Tamir Evan
Modified: 2018-11-09 17:05 UTC (History)
2 users (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tamir Evan 2017-11-26 08:18:54 UTC
When I extract the source from mupdf-1.12-rc1-source.tar.gz (which happens to represent the tip of master, at the moment), and run, under MinGW (of mingw.org):

     make HAVE_GLUT=no

I get:

    [...]
    source/fitz/output.c: In function 'fz_new_output_with_path':
    source/fitz/output.c:196:7: warning: implicit declaration of function 'fz_remove_utf8' [-Wimplicit-function-declaration]
       if (fz_remove_utf8(filename) < 0)
           ^~~~~~~~~~~~~~
    source/fitz/output.c:200:9: warning: implicit declaration of function 'fz_fopen_utf8' [-Wimplicit-function-declaration]
      file = fz_fopen_utf8(filename, append ? "ab" : "wb");
             ^~~~~~~~~~~~~
    source/fitz/output.c:200:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      file = fz_fopen_utf8(filename, append ? "ab" : "wb");
           ^
    [...]
        CC build/release/source/fitz/stream-open.o
    source/fitz/stream-open.c: In function 'fz_file_exists':
    source/fitz/stream-open.c:18:9: warning: implicit declaration of function 'fz_fopen_utf8' [-Wimplicit-function-declaration]
      file = fz_fopen_utf8(path, "rb");
             ^~~~~~~~~~~~~
    source/fitz/stream-open.c:18:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      file = fz_fopen_utf8(path, "rb");
           ^
    [...]
    source/fitz/stream-open.c: In function 'fz_open_file':
    source/fitz/stream-open.c:152:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      file = fz_fopen_utf8(name, "rb");
           ^
        CC build/release/source/fitz/stream-prog.o
    source/fitz/stream-prog.c: In function 'fz_open_file_progressive':
    source/fitz/stream-prog.c:141:6: warning: implicit declaration of function 'fz_fopen_utf8' [-Wimplicit-function-declaration]
      f = fz_fopen_utf8(name, "rb");
          ^~~~~~~~~~~~~
    source/fitz/stream-prog.c:141:4: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      f = fz_fopen_utf8(name, "rb");
        ^
    [...]
    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)
           ^~~~~~~~~~~~~~
    scripts/../source/fitz/output.c:200:9: warning: implicit declaration of function 'fz_fopen_utf8' [-Wimplicit-function-declaration]
      file = fz_fopen_utf8(filename, append ? "ab" : "wb");
             ^~~~~~~~~~~~~
    scripts/../source/fitz/output.c:200:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      file = fz_fopen_utf8(filename, append ? "ab" : "wb");
           ^
    In file included from scripts/cmapdump.c:26:0:
    scripts/../source/fitz/stream-open.c: In function 'fz_file_exists':
    scripts/../source/fitz/stream-open.c:18:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      file = fz_fopen_utf8(path, "rb");
           ^
    scripts/../source/fitz/stream-open.c: In function 'fz_open_file':
    scripts/../source/fitz/stream-open.c:152:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      file = fz_fopen_utf8(name, "rb");
           ^
    In file included from scripts/cmapdump.c:32:0:
    scripts/../source/fitz/time.c: At top level:
    scripts/../source/fitz/time.c:85:1: error: conflicting types for 'fz_fopen_utf8'
     fz_fopen_utf8(const char *name, const char *mode)
     ^~~~~~~~~~~~~
    In file included from scripts/cmapdump.c:22:0:
    scripts/../source/fitz/output.c:200:9: note: previous implicit declaration of 'fz_fopen_utf8' was here
      file = fz_fopen_utf8(filename, append ? "ab" : "wb");
             ^~~~~~~~~~~~~
    make: *** [build/release/scripts/cmapdump.o] Error 1

and the build stops.

The problem seems to be, that although fz_fopen_utf8() is implemented (in source/fitz/time.c) for all Win32 targets, it is only declared (in include/mupdf/fitz/system.h) for MSVC targets.

A solution would be to move fz_fopen_utf8() from the '#ifdef _MSC_VER' block to an '#ifdef _WIN32' (like it's implementation is in source/fitz/time.c). Maybe while we're at it, also move the declarations for the other functions implemented for Win32 in source/fitz/time.c, as well.
Comment 1 Tamir Evan 2018-03-22 11:27:02 UTC
This bug got resolved with commit 81c77a6b6464f5af66f851837f85ed6f9724f19e ("Clean up windows ifdefs"), so it can be closed, as far as I'm concerned.

Now, compilation under MinGW stops at the place I reported in Bug 698783.