Bug 34011 - headers-standalone target is incorrect for some non-gcc compilers
Summary: headers-standalone target is incorrect for some non-gcc compilers
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.10.2
Hardware: Other Solaris
: medium minor
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-07 16:25 UTC by Tim Mooney
Modified: 2011-02-20 15:16 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
augment headers-standalone to work with additional compilers (809 bytes, patch)
2011-02-07 16:25 UTC, Tim Mooney
Details | Splinter Review
updated patch that uses a different tmp filename and doesn't use -I $(srcdir) for includes (832 bytes, patch)
2011-02-11 13:16 UTC, Tim Mooney
Details | Splinter Review

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.