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

Rmodular cannot be built #3460

Closed
rekado opened this issue Oct 12, 2016 · 12 comments
Closed

Rmodular cannot be built #3460

rekado opened this issue Oct 12, 2016 · 12 comments
Assignees
Milestone

Comments

@rekado
Copy link

rekado commented Oct 12, 2016

I'm trying to build shogun with the Rmodular interface with GCC 4.9.3 and R 3.3.0 but I get this error:

error: conflicting declaration of C function ‘long long int std::abs(long long int)’
in gcc-4.9.3/include/c++/cstdlib

In file included from
/gnu/store/pbz6h59l4c4y77j5ik45krlvp4xq79qq-r-3.3.0/lib/R/include/R.h:40:0,
from
/tmp/guix-build-shogun-4.1.0.drv-0/shogun-4.1.0/src/interfaces/r_modular/sg_print_functions.cpp:2:

What then follows is a long stream of errors like "error: template with C linkage" in various files. I can provide the full build log in a few hours.

@rekado
Copy link
Author

rekado commented Oct 12, 2016

What follows are the cmake flags and the logs starting from the first error:
https://gist.github.com/rekado/01fcfd74e3defe4288ae3bab86078f3e

@karlnapf
Copy link
Member

Can you please remove the long log here and paste a link to a gist instead? Otherwise chances that somebody reads it go to zero.
Next, could you post your system specs?

@rekado
Copy link
Author

rekado commented Oct 17, 2016

I moved the error log from the previous comment to a gist.
My system is an x86_64 machine with 8GB RAM but this doesn't seem to be related to the error which is about conflicting declarations in included files.

I'm building shogun in a chroot where only declared packages are available (that's a feature of GNU Guix). There were no problems with the modular R interface in version 4.0.0.

@karlnapf
Copy link
Member

Sorry about the delay. This unfortunately is a bug. Will look into it and adding to 5.1 milestone

@karlnapf
Copy link
Member

karlnapf commented Nov 14, 2016

I locally have the same errors on ubuntu 16.04 with latest develop and standard packages, R version 3.3.1

https://gist.github.com/karlnapf/69946d524a9773b6cb4d9479ce93097e

@rekado
Copy link
Author

rekado commented Nov 14, 2016

It might be sufficient to #define NO_C_HEADERS before including R.h. The R NEWS file says that R.h should not be included from within extern C blocks, but that's what swig appears to do. With R 3.3.0 C headers are included when R.h is included. This can be avoided by defining NO_C_HEADERS.

I haven't tested this with Shogun yet, but it worked for SPAMS, which also includes bindings that were created with swig.

@karlnapf karlnapf reopened this Nov 14, 2016
@karlnapf
Copy link
Member

karlnapf commented Nov 14, 2016

Thanks for the hint! This is since R 3.3.0

Just for the record, adding define NO_C_HEADERS in the sg_print_functions.cpp (manually, after it was generated by SWIG), results in different compilation errors

https://gist.github.com/karlnapf/9538ea56ead65bc1c470543ff6c3bd95

@karlnapf
Copy link
Member

karlnapf commented Nov 14, 2016

So the NEWS entry for 3.3.0 you refer to says:
https://cran.r-project.org/doc/manuals/r-release/NEWS.html

When R headers such as ‘R.h’ and ‘Rmath.h’ are called from C++ code in packages they include the C++ versions of system headers such as ‘<cmath>’ rather than the legacy headers such as ‘<math.h>’. (Headers ‘Rinternals.h’ and ‘Rinterface.h’ already did, and inclusion of system headers can still be circumvented by defining NO_C_HEADERS, including as from this version for those two headers.)

There is also this in the NEWS for 3.3.2

Use of the C/C++ macro NO_C_HEADERS is deprecated (no C headers are included by R headers from C++ as from R 3.3.0, so it should no longer be needed).

@karlnapf
Copy link
Member

Same error with R 3.3.2

karlnapf added a commit to karlnapf/shogun that referenced this issue Nov 14, 2016
karlnapf added a commit to karlnapf/shogun that referenced this issue Nov 24, 2016
according to the R manual, no R headers should be included from `extern C` blocks
karlnapf added a commit to karlnapf/shogun that referenced this issue Nov 24, 2016
according to the R manual, no R headers should be included from `extern C` blocks
@karlnapf
Copy link
Member

Fixed via #3538

@rekado
Copy link
Author

rekado commented Nov 25, 2016

Nice, thank you!

@karlnapf
Copy link
Member

Let me know if it worked :)

abhinavrai44 pushed a commit to abhinavrai44/shogun that referenced this issue Jan 24, 2017
according to the R manual, no R headers should be included from `extern C` blocks
karasikov pushed a commit to karasikov/shogun that referenced this issue Apr 15, 2017
according to the R manual, no R headers should be included from `extern C` blocks
karasikov pushed a commit to karasikov/shogun that referenced this issue Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants