[poppler] Poppler 0.61 build failure with MSVC

Albert Astals Cid aacid at kde.org
Sun Nov 12 00:59:55 UTC 2017


El diumenge, 12 de novembre de 2017, a les 1:35:27 CET, Jean Ghali va 
escriure:
> Hi all,
> 
> I've encountered several issues while compiling Poppler 0.61.0 for Scribus.
> I'm currently using Visual Studio 2015.

Please join the discussion at 
https://bugs.freedesktop.org/show_bug.cgi?id=103621

Cheers,
  Albert

> 
> The first round of issues are compiler errors caused by an undeclared
> strtok_r function. The build failure has been introduced by commit
> 555e2ea6b6f80a6f79eeaa44a39c24dc8461e78c which moved the declaration of
> strtok_r from poppler-config.h to goo/glibc.h. Unfortunately while doing
> so, that commit failed to include "goo/glibc.h" in files using the strtok_r
> function. As MSVC C library does not provide that function, this logically
> triggers a compiler error due to the missing function declaration.
> 
> The files missing the "goo/glibc.h" include are:
> - poppler/CharCodeToUnicode.cc
> - poppler/GlobalParams.cc
> - poppler/PDFDoc.cc
> - poppler/UnicodeMap.cc
> 
> You will find in attachments a patch which fixes this issue.
> 
> Secondly, an inconsistency exists between the strtok_r declaration and its
> implementation: goo/glibc.h encloses functions declaration with an extern
> "C" { ... }, however the implementation of strtok_r located in
> glibc_strtok_r.cc, which MSVC compiles as C++, is not enclosed with the
> same extern "C" { ... }. As a consequence the implementation uses the C++
> function name mangling. In the end this triggers a linker error, the linker
> not being able to find a strtok_r implementation with "C" mangling. Note
> that the same issue exists also in goo/glibc.cc file.
> 
> So depending on what you really want to do, I'd suggest one of these three
> solutions: - removing the extern "C" {...} in goo/glibc.h
> - adding the appropriate extern "C" {...} in glibc_strtok_r.cc and
> goo/glibc.cc - renaming glibc_strtok_r.cc and glibc.cc by using a simple .c
> extension. The third solution will force MSVC to use the C compiler by
> default for these two files.
> 
> Jean Ghali




More information about the poppler mailing list