atheriel / longears

The RabbitMQ client for R
https://atheriel.github.io/longears/
36 stars 9 forks source link

cannot demonstrate minimal usage; please advise #15

Closed chaixdev closed 3 years ago

chaixdev commented 3 years ago

Hello, Apologies if this is not the right place to request support. I must preface with the disclaimer that I am primarily a java developer crossing over. I have limited experience with R and none with C++, so the probability that i'm doing something wrong is quite high.

using the readme.md as a guideline, I am trying to get started with using longears to implement a rabbitmq consumer in R. installing the package longears from github fails. These are the last lines on the terminal:

** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I.  -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c basic.c -o basic.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I.  -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c bind.c -o bind.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I.  -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c connection.c -o connection.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I.  -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c consume.c -o consume.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I.  -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/later/include' -I'/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/Rcpp/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-tRgc13/r-base-4.0.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c consume_later.cpp -o consume_later.o
consume_later.cpp: In function ‘void later_callback(void*)’:
consume_later.cpp:81:17: error: ‘strncmp’ was not declared in this scope
   81 |   while (elt && strncmp((const char *) elt->tag.bytes,
      |                 ^~~~~~~
consume_later.cpp:10:1: note: ‘strncmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
    9 | #include "utils.h"
  +++ |+#include <cstring>
   10 | 
consume_later.cpp:109:3: error: ‘memcpy’ was not declared in this scope
  109 |   memcpy((void *) RAW(body), cdata->env->message.body.bytes, body_len);
      |   ^~~~~~
consume_later.cpp:109:3: note: ‘memcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
consume_later.cpp: In function ‘void later_warn_callback(void*)’:
consume_later.cpp:163:7: error: ‘strncpy’ was not declared in this scope
  163 |       strncpy(tag, (const char *) err->payload.tag.bytes, err->payload.tag.len);
      |       ^~~~~~~
consume_later.cpp:163:7: note: ‘strncpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
consume_later.cpp: In function ‘void* consume_run(void*)’:
consume_later.cpp:245:25: error: ‘strncmp’ was not declared in this scope
  245 |           while (elt && strncmp((const char *) elt->tag.bytes,
      |                         ^~~~~~~
consume_later.cpp:245:25: note: ‘strncmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
make: *** [/usr/lib/R/etc/Makeconf:181: consume_later.o] Error 1
ERROR: compilation failed for package ‘longears’
* removing ‘/home/bhagwat_chaitanya/R/x86_64-pc-linux-gnu-library/4.0/longears’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpJ07CEI/file414679868170/longears_0.2.4.tar.gz’ had non-zero exit status

To reproduce:

setup os:

  1. fresh install of ubuntu 20.04LTS,
  2. apt-get update && apt-get upgrade
  3. sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

    add CRAN repo

  4. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  5. sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/

    install R and dependencies

  6. sudo apt install r-base #(this is version 4.0.5)
  7. sudo apt install librabbitmq-dev

    inside R:

    install.packages("remotes") remotes::install_github("longears")

the last step results in the error printed above

jrausch12 commented 3 years ago

+1. @atheriel Please advise.

atheriel commented 3 years ago

R has recently changed its headers, it seems. The master branch has a fix now.