Bug 28587 - poppler 0.14 will not compile on Solaris.
Summary: poppler 0.14 will not compile on Solaris.
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Solaris
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-17 11:47 UTC by Brian Cameron
Modified: 2010-06-21 17:29 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch fixing issues. (1.01 KB, patch)
2010-06-17 11:47 UTC, Brian Cameron
Details | Splinter Review

Description Brian Cameron 2010-06-17 11:47:53 UTC
Created attachment 36344 [details] [review]
patch fixing issues.

When I try to compile poppler 0.14 on Solaris, I get the following errors that are fixed in the patch:

Error #1:

 /opt/sunstudio12.1/bin/CC -norunpath -DHAVE_CONFIG_H -I. -I.. -I../poppler -I.. -I/usr/include/libpng12 -i -xO3 -xspace -pentium -mr -norunpath -xregs=no%frameptr -compat=5 -c JpegWriter.cc  -KPIC -DPIC -o .libs/JpegWriter.o
"ImgWriter.h", line 23: Error: FILE is not defined.
"ImgWriter.h", line 23: Error: A member cannot be initialized except in a constructor.
"ImgWriter.h", line 25: Error: Use ";" to terminate declarations.
"/usr/include/jpeglib.h", line 715: Error: Type name expected instead of "size_t".
"/usr/include/jpeglib.h", line 727: Error: Type name expected instead of "size_t".
"/usr/include/jpeglib.h", line 759: Error: size_t is not defined.
"/usr/include/jpeglib.h", line 761: Error: size_t is not defined.
"/usr/include/jpeglib.h", line 901: Error: size_t is not defined.
"/usr/include/jpeglib.h", line 903: Error: size_t is not defined.
"/usr/include/jpeglib.h", line 910: Error: FILE is not defined.
"/usr/include/jpeglib.h", line 911: Error: FILE is not defined.
"JpegWriter.h", line 35: Error: FILE is not defined.
"JpegWriter.cc", line 27: Warning: String literal converted to char* in formal argument msg in call to error(int, char*, ...).
"JpegWriter.cc", line 46: Error: init is not a member of JpegWriter.
"JpegWriter.cc", line 46: Error: FILE is not defined.
"JpegWriter.cc", line 46: Error: f is not defined.
"JpegWriter.cc", line 46: Error: Badly formed expression.
"JpegWriter.cc", line 46: Error: Use ";" to terminate declarations.
"JpegWriter.cc", line 46: Error: Use ";" to terminate declarations.
"JpegWriter.cc", line 46: Error: "," expected instead of ")".
"JpegWriter.cc", line 50: Error: "," expected instead of ".".
"JpegWriter.cc", line 53: Error: Multiple declaration for jpeg_CreateCompress.
"JpegWriter.cc", line 53: Error: cinfo is not defined.
"JpegWriter.cc", line 53: Error: size_t is not defined.
"JpegWriter.cc", line 53: Error: Badly formed expression.
"JpegWriter.cc", line 56: Error: Multiple declaration for jpeg_stdio_dest.

The "size_t" errors are fixed by adding "#include <sys/types.h>" to JpegWriter.h.

Error #2:

 /opt/sunstudio12.1/bin/CC -norunpath -DHAVE_CONFIG_H -I. -I.. -I../poppler -I.. -I/usr/include/libpng12 -i -xO3 -xspace -pentium -mr -norunpath -xregs=no%frameptr -compat=5 -c JpegWriter.cc  -KPIC -DPIC -o .libs/JpegWriter.o
"ImgWriter.h", line 23: Error: FILE is not defined.
"ImgWriter.h", line 23: Error: A member cannot be initialized except in a constructor.
"ImgWriter.h", line 25: Error: Use ";" to terminate declarations.
"/usr/include/jpeglib.h", line 910: Error: FILE is not defined.
"/usr/include/jpeglib.h", line 911: Error: FILE is not defined.
"JpegWriter.h", line 36: Error: FILE is not defined.
"JpegWriter.cc", line 27: Warning: String literal converted to char* in formal argument msg in call to error(int, char*, ...).
"JpegWriter.cc", line 46: Error: init is not a member of JpegWriter.
"JpegWriter.cc", line 46: Error: FILE is not defined.
"JpegWriter.cc", line 46: Error: f is not defined.
"JpegWriter.cc", line 46: Error: Badly formed expression.
"JpegWriter.cc", line 46: Error: Use ";" to terminate declarations.
"JpegWriter.cc", line 46: Error: Use ";" to terminate declarations.
"JpegWriter.cc", line 46: Error: "," expected instead of ")".
"JpegWriter.cc", line 50: Error: "," expected instead of ".".
"JpegWriter.cc", line 53: Error: Multiple declaration for jpeg_CreateCompress.
"JpegWriter.cc", line 53: Error: cinfo is not defined.
"JpegWriter.cc", line 56: Error: Multiple declaration for jpeg_stdio_dest.
"JpegWriter.cc", line 56: Error: cinfo is not defined.
"JpegWriter.cc", line 56: Error: f is not defined.
"JpegWriter.cc", line 59: Error: "," expected instead of ".".
"JpegWriter.cc", line 60: Error: Multiple declaration for cinfo.
"JpegWriter.cc", line 60: Error: "," expected instead of ".".
"JpegWriter.cc", line 61: Error: Multiple declaration for cinfo.
"JpegWriter.cc", line 61: Error: "," expected instead of ".".
"JpegWriter.cc", line 62: Error: Multiple declaration for cinfo.
Compilation aborted, too many Error messages.
/usr/ccs/bin/mcs: .libs/JpegWriter.o: cannot open file.

This error is fixed by adding "#include <stdio.h>" to ImgWriter.h.

Error #3:

When compiling SplashOutputDev.cc, it complains that isfinite() is not defined.
This is fixed by defining isfinite() to just call finite().

Can these changes go upstream?
Comment 1 Albert Astals Cid 2010-06-17 13:58:40 UTC
Hmm, i can understand the JpegWriter.h and SplashOutputDev.cc patches, but is your compiler that bad that 
#include <cstdio>
is different from 
#include <stdio.h>
?

does changing
		virtual bool init(FILE *f, int width, int height, int hDPI, int vDPI) = 0;
to
		virtual bool init(::FILE *f, int width, int height, int hDPI, int vDPI) = 0;

help?
Comment 2 Brian Cameron 2010-06-17 23:47:36 UTC
I am using the Sun Studio compiler.  Perhaps it is that bad, since changing it to "::FILE" doesn't fix the problem, but adding stdio.h does.
Comment 3 Brian Cameron 2010-06-17 23:48:02 UTC
If that hunk isn't acceptable to go upstream, then if you could accept the other hunks, that would be great.  If you have any other suggestions to try, let me know.
Comment 4 Albert Astals Cid 2010-06-18 01:30:26 UTC
I understand that adding stdio.h and removing cstdio makes it still compile, right?
Comment 5 Brian Cameron 2010-06-18 02:21:35 UTC
Yes, that works for me.  Adding stdio.h and removing cstdio from ImgWriter.h also resolves the compile issue.
Comment 6 Albert Astals Cid 2010-06-18 11:22:50 UTC
Pushed, thanks for the patch.
Comment 7 Tim Mooney 2010-06-21 15:48:04 UTC
Sorry to reply to a closed bug, but:

- As an alternate to the stdio.h/cstdio switch, just inserting a

  using namespace std;

  before the inclusion of <cstdio> fixes the issue for ImgWriter.h.  I'm
  not certain what the thinking is these days on "using namespace std",
  so maybe that's less palatable than just switching back to the C headers.

- Brian's patch doesn't completely fix things for me, as goo/gstrtod.cc
  fails because of missing prototypes for a few functions:

"gstrtod.cc", line 53: Error, badfunccp: The function "localeconv" must have a prototype.
"gstrtod.cc", line 54: Error, incomplete: The type "lconv" is incomplete.
"gstrtod.cc", line 55: Error, badfunccp: The function "strlen" must have a prototype.
"gstrtod.cc", line 96: Error, badfunccp: The function "malloc" must have a prototype.
"gstrtod.cc", line 99: Error, badfunccp: The function "memcpy" must have a prototype.
"gstrtod.cc", line 101: Error, badfunccp: The function "memcpy" must have a prototype.

etc.

  If I add a "using namespace std;" before the inclusion of <clocale> in 
  gstrtod.c, that resolves that issue.
Comment 8 Brian Cameron 2010-06-21 17:27:46 UTC
Yes, I can also verify that with the following three lines the code also compiles fine on Solaris:

#include <config.h>
using namespace std;
#include <cstdio>
Comment 9 Brian Cameron 2010-06-21 17:29:06 UTC
I should have said that those 3 lines fixes the ImgWriter.h issue on Solaris just fine, so if you want to use that technique, that is okay.


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.