Bug 34011

Summary: headers-standalone target is incorrect for some non-gcc compilers
Product: cairo Reporter: Tim Mooney <Tim.Mooney>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: minor    
Priority: medium CC: freedesktop
Version: 1.10.2   
Hardware: Other   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:
Attachments: augment headers-standalone to work with additional compilers
updated patch that uses a different tmp filename and doesn't use -I $(srcdir) for includes

Description Tim Mooney 2011-02-07 16:25:43 UTC
Created attachment 43059 [details] [review]
augment headers-standalone to work with additional compilers

x86_64-sun-solaris2.10, Solaris 10u6 (not OpenSolaris) with the commercial, no-cost Sun Workshop compilers.

When executing "gmake check" against cairo-1.10.2, the headers-standalone target fails in the src directory, with messages like the following:

  CHECK cairo-svg.h
ld: fatal: file ./cairo-svg.h: unknown file type
ld: fatal: File processing errors. No output written to /dev/null
  CHECK cairoint.h
ld: fatal: file ./cairoint.h: unknown file type
ld: fatal: File processing errors. No output written to /dev/null

I'm presuming that gcc permits you to specify a header file as your source file AND link and generate an executable from just that file. The Solaris compiler, however, will not.

Luckily, it's pretty easy to make the target more portable.  The fix involves
generating a tiny C source file that includes the header file.

I'm attaching a patch that does that.  With that patch, headers-standalone completes successfully for me.
Comment 1 Behdad Esfahbod 2011-02-10 22:27:20 UTC
Looks good.  How about this minor variation:

-		$(COMPILE) -o /dev/null $(srcdir)/$$f || status=false; \
+		echo "#include \"$(srcdir)/$$f\"" > conftest-headers.c; \
+		echo "int main(int argc, char * argv[]) {}" >> conftest-headers.c; \
+		$(COMPILE) -o /dev/null headers-standalone-tmp.c || status=false; \
+		$(RM) headers-standalone-tmp.c; \
Comment 2 Tim Mooney 2011-02-11 13:15:29 UTC
Lines 1 & 2 of your patch still uses conftest-headers.c for the filename, but lines 3 & 4 use headers-standalone-tmp.c.  I didn't understand how that could work, so I changed all the lines to headers-standalone-tmp.c and made your suggested change for how the include is handled, and those changes appears to work well.

Updated patch will be added momentarily.
Comment 3 Tim Mooney 2011-02-11 13:16:49 UTC
Created attachment 43273 [details] [review]
updated patch that uses a different tmp filename and doesn't use -I $(srcdir) for includes
Comment 4 Behdad Esfahbod 2011-02-20 15:14:34 UTC
(In reply to comment #3)
> Created an attachment (id=43273) [details]
> updated patch that uses a different tmp filename and doesn't use -I $(srcdir)
> for includes

Looks good.  Thanks.
Comment 5 Behdad Esfahbod 2011-02-20 15:16:45 UTC
Committed to master.

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.