Bug 31133 - libpciaccess v0.12.0 build error on Solaris 10 x86
Summary: libpciaccess v0.12.0 build error on Solaris 10 x86
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/pciaccess (show other bugs)
Version: unspecified
Hardware: All Solaris
: medium normal
Assignee: Alan Coopersmith
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-26 08:15 UTC by Rajesh
Modified: 2011-10-09 03:54 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Rajesh 2010-10-26 08:15:03 UTC
[I am building using Sun Studio cc v12.1]

While building libpciaccess v0.12.0 on Solaris 10 x86, I get the below error:

<<<<>>>>
"scanpci.c", line 38: cannot find include file: <err.h>
"scanpci.c", line 216: warning: implicit function declaration: err
cc: acomp failed for scanpci.c
<<<<>>>>

The below patch to src/scanpci.c fixes the issue:

<<<<>>>
--- libpciaccess-0.12.0/src/scanpci.c~ 2009-02-13 05:17:58
+++ libpciaccess-0.12.0/src/scanpci.c  2010-10-26 20:41:43
@@ -24,7 +24,19 @@

 #include <stdlib.h>
 #include <stdio.h>
-#include <err.h>
+#ifdef sun
+# include <errno.h>
+# define err(exitcode, format, args...) \
+   errx(exitcode, format ": %s", ## args, strerror(errno))
+# define errx(exitcode, format, args...) \
+   { warnx(format, ## args); exit(exitcode); }
+# define warn(format, args...) \
+   warnx(format ": %s", ## args, strerror(errno))
+# define warnx(format, args...) \
+   fprintf(stderr, format "\n", ## args)
+#else
+# include <err.h>
+#endif
 #include <unistd.h>
<<<<>>>

Thanks.  Rajesh
Comment 1 Alan Coopersmith 2010-10-26 08:27:17 UTC
#ifdef sun is incorrect since Solaris 11 & OpenSolaris have those
functions (which is why I didn't notice this).

It needs to be a configure.ac check for the err() functions/err.h header.
Comment 2 Jeremy Huddleston Sequoia 2011-10-09 03:54:14 UTC
commit b9c5ce8083be53ea017bd15a63b173b4476fff23
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Sun Oct 9 03:53:05 2011 -0700

    scanpci: Build fix for systems without <err.h>
    
    https://bugs.freedesktop.org/show_bug.cgi?id=31133
    
    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>


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.