I've found that current master branch (commit 183dbf3249e8db2398b63a749eb010bc0a89dc35) cannot be compiled by g++ 5.4.0. ``` CXX libgoo_la-gfile.lo ../../poppler/goo/gfile.cc: In function 'GBool openTempFile(GooString**, FILE**, const char*)': ../../poppler/goo/gfile.cc:408:37: error: 'mkstemp' was not declared in this scope fd = mkstemp((*name)->getCString()); ^ ../../poppler/goo/gfile.cc:416:39: error: 'fdopen' was not declared in this scope if (fd < 0 || !(*f = fdopen(fd, mode))) { ^ ../../poppler/goo/gfile.cc: In function 'int Gfseek(FILE*, Goffset, int)': ../../poppler/goo/gfile.cc:557:34: error: 'fseeko' was not declared in this scope return fseeko(f, offset, whence); ^ ../../poppler/goo/gfile.cc: In function 'Goffset Gftell(FILE*)': ../../poppler/goo/gfile.cc:571:18: error: 'ftello' was not declared in this scope return ftello(f); ^ make[2]: *** [Makefile:584: libgoo_la-gfile.lo] Error 1 ```
Created attachment 126763 [details] [review] 0001-Fix-g-C-11-option.patch This patch uses `-std=gnu++11` since `-std=c++11` cannot use some feature.
I tried gcc 6.1.1 and it builds successfully.
I've tried some environments. It seems that only Cygwin environment cannot compile. Cygwin 64 bit + g++ 5.4.0: Failed. If the patch is applied, succeeded. Ubuntu 14.04 LTS 64 bit + g++ 4.8.4: Succeeded. Ubuntu 16.04 LTS 64 bit + g++ 5.4.0: Succeeded. FreeBSD 10.1-RELEASE 64 bit + clang 3.4.1: Succeeded. FreeBSD 10.1-RELEASE 64 bit * g++ 4.8.5: Succeeded.
I got gfile.cc to compile on cygwin by adding #define _BSD_SOURCE to the file. Although I read somewhere that _BSD_SOURCE has been replaced by _DEFAULT_SOURCE. We may need to add something to configure.ac and cmake to set the feature macro based on the compiler version. The problem with using -std-gnu++11 is we don't want to allow gnu features that are incompatible with Visual C++.
(In reply to Adrian Johnson from comment #4) > I got gfile.cc to compile on cygwin by adding #define _BSD_SOURCE to the > file. Although I read somewhere that _BSD_SOURCE has been replaced by > _DEFAULT_SOURCE. We may need to add something to configure.ac and cmake to > set the feature macro based on the compiler version. > > The problem with using -std-gnu++11 is we don't want to allow gnu features > that are incompatible with Visual C++. I've found the description of _BSD_SOURCE and _DEFAULT_VERSION. http://man7.org/linux/man-pages/man7/feature_test_macros.7.html It says: To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE.
Created attachment 126777 [details] [review] v2-0001-Fix-g-C-11-option.patch This patch uses both _BSD_SOURCE and _DEFAULT_SOURCE instead of -std=gnu++11. I've succeeded compile on Cygwin 64 bit environment with the patch.
do you still need this patch with newer versions?
(In reply to Albert Astals Cid from comment #7) > do you still need this patch with newer versions? Current master branch can compiled on Cygwin 64 bit environment without the patch. Thank you.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.