Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix caddr_t error on icc #19

Merged
merged 1 commit into from
Feb 2, 2017
Merged

Fix caddr_t error on icc #19

merged 1 commit into from
Feb 2, 2017

Conversation

dtrudg
Copy link
Contributor

@dtrudg dtrudg commented Sep 6, 2016

On an RHEL6.8 environment where the Intel 2015 icc compiler is used to build R, installation of the Cairo R package fails as the caddr_t type is not defined.

The Xlib docs specify that the calls using caddr_t temp actually take an XPointer. Replacing caddr_t with XPointer fixes compilation with the intel compiler.

caddr_t is a kernel typedef - believe that XPointer should be preferred here.

@gifi
Copy link

gifi commented Dec 4, 2016

Same issue with

$ cat /usr/lib/os-release
NAME=Fedora
VERSION="24 (Workstation Edition)"
ID=fedora
VERSION_ID=24
PRETTY_NAME="Fedora 24 (Workstation Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:24"
HOME_URL="https://fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=24
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=24
PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy
VARIANT="Workstation Edition"
VARIANT_ID=workstation
$ gcc --version
gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-2)
> sessionInfo()
R Under development (unstable) (2016-11-25 r71694)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Fedora 24 (Workstation Edition)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0

> install.packages("Cairo_1.5-9.tar.gz", repos = NULL)
# Or alternatively, with
#> install.packages("Cairo",,"http://rforge.net/",type="source")
xlib-backend.c: In functionRcairo_new_xlib_backend’:
xlib-backend.c:366:57: error: ‘caddr_tundeclared (first use in this function)
   XSaveContext(xd->display, xd->window, devPtrContext, (caddr_t) xd);
                                                         ^~~~~~~
xlib-backend.c:366:57: note: each undeclared identifier is reported only once for each function it appears in
xlib-backend.c:366:66: error: expected ‘)’ beforexdXSaveContext(xd->display, xd->window, devPtrContext, (caddr_t) xd);

This PR fixes the issue:

$ git clone --recursive https://github.com/s-u/Cairo.git Cairo
# Edit src/xlib-backend.c accordingly to the PR.
$ grep -n 'caddr_t' src/xlib-backend.c
95:	XPointer temp; /* caddr_t temp; */
182:	XPointer temp; /* caddr_t temp; */
366:		XSaveContext(xd->display, xd->window, devPtrContext, (XPointer) xd); /* XSaveContext(xd->display, xd->window, devPtrContext, (caddr_t) xd); */

$ ./mkdist
$ cd ..
$ R CMD INSTALL Cairo_1.5-9.tar.gz
…
** testing if installed package can be loaded
* DONE (Cairo)

@gifi
Copy link

gifi commented Feb 2, 2017

Actually, the issue is reproducible only with C 11, that is CFLAGS += -std=c11 or any other compatible flag.

@s-u s-u merged commit 5fd6a58 into s-u:master Feb 2, 2017
@s-u
Copy link
Owner

s-u commented Feb 2, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants