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

compilation error #203

Closed
nvpatin opened this issue Oct 11, 2023 · 4 comments · Fixed by #206
Closed

compilation error #203

nvpatin opened this issue Oct 11, 2023 · 4 comments · Fixed by #206

Comments

@nvpatin
Copy link

nvpatin commented Oct 11, 2023

Hi,

I'm trying to install wk on a Linux HPC system and am running into a compilation error. I have tried specifying different C compilers with no luck. I tried using both install.packages("wk") and remotes::install_github("paleolimbot/wk") and both produce the same error. It seems to be specific to the 'orient-filter' function but I suspect it has to do with the C compiler; can you tell me which compiler should be used and any edits to the .R/Makevars file that might help? The full output of the installation command is below.

Thanks,
Nastassia

remotes::install_github("paleolimbot/wk")
Downloading GitHub repo paleolimbot/wk@HEAD
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/tmp/RtmpWRYXtu/remotesbfca58d27712/paleolimbot-wk-279dffa/DESCRIPTION’ ...
─ preparing ‘wk’:
✔ checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Removed empty directory ‘wk/vignettes’
─ building ‘wk_0.8.0.9000.tar.gz’

Installing package into ‘/home/nvp29/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)

  • installing source package ‘wk’ ...
    ** using staged installation
    ** libs
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c bbox-handler.c -o bbox-handler.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c count-handler.c -o count-handler.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c debug-filter.c -o debug-filter.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c flatten-filter.c -o flatten-filter.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c handle-crc.c -o handle-crc.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c handle-rct.c -o handle-rct.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c handle-sfc.c -o handle-sfc.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c handle-wkb.c -o handle-wkb.o
    g++ -std=gnu++11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c handle-wkt.cpp -o handle-wkt.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c handle-xy.c -o handle-xy.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c identity-filter.c -o identity-filter.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c init.c -o init.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c make-collection-filter.c -o make-collection-filter.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c make-linestring-filter.c -o make-linestring-filter.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c make-polygon-filter.c -o make-polygon-filter.o
    gcc -std=c11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c meta-handler.c -o meta-handler.o
    g++ -std=gnu++11 -I"/apps/R-4.2.0/lib64/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c orient-filter.cpp -o orient-filter.o
    orient-filter.cpp: In member function ‘virtual int OrientFilter::coord(const wk_meta_t, const double, uint32_t)’:
    orient-filter.cpp:58:54: error: no matching function for call to ‘std::vector::insert(std::vector::const_iterator, const double*&, const double*)’
    coords.insert(coords.cend(), coord, coord + n_dim);**
    ^
    orient-filter.cpp:58:54: note: candidates are:
    In file included from /usr/include/c++/4.8.2/vector:69:0,
    from orient-filter.cpp:1:
    /usr/include/c++/4.8.2/bits/vector.tcc:107:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, const value_type&) [with _Tp = double; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<double*, std::vector >; typename std::_Vector_base<_Tp, _Alloc>::pointer = double*; std::vector<_Tp, _Alloc>::value_type = double]
    vector<_Tp, _Alloc>::
    ^
    /usr/include/c++/4.8.2/bits/vector.tcc:107:5: note: candidate expects 2 arguments, 3 provided
    In file included from /usr/include/c++/4.8.2/vector:64:0,
    from orient-filter.cpp:1:
    /usr/include/c++/4.8.2/bits/stl_vector.h:988:7: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = double; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<double*, std::vector >; typename std::_Vector_base<_Tp, _Alloc>::pointer = double*; std::vector<_Tp, _Alloc>::value_type = double]
    insert(iterator __position, value_type&& __x)
    ^
    /usr/include/c++/4.8.2/bits/stl_vector.h:988:7: note: candidate expects 2 arguments, 3 provided
    /usr/include/c++/4.8.2/bits/stl_vector.h:1005:7: note: void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::initializer_list<_Tp>) [with _Tp = double; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<double*, std::vector >; typename std::_Vector_base<_Tp, _Alloc>::pointer = double*]
    insert(iterator __position, initializer_list<value_type> __l)
    ^
    /usr/include/c++/4.8.2/bits/stl_vector.h:1005:7: note: candidate expects 2 arguments, 3 provided
    /usr/include/c++/4.8.2/bits/stl_vector.h:1023:7: note: void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = double; _Alloc = std::allocator; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<double*, std::vector >; typename std::_Vector_base<_Tp, _Alloc>::pointer = double*; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = double]
    insert(iterator __position, size_type __n, const value_type& __x)
    ^
    /usr/include/c++/4.8.2/bits/stl_vector.h:1023:7: note: no known conversion for argument 1 from ‘std::vector::const_iterator {aka __gnu_cxx::__normal_iterator<const double*, std::vector >}’ to ‘std::vector::iterator {aka __gnu_cxx::__normal_iterator<double*, std::vector >}’
    /usr/include/c++/4.8.2/bits/stl_vector.h:1044:9: note: template<class _InputIterator, class> void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; = ; _Tp = double; _Alloc = std::allocator]
    insert(iterator __position, _InputIterator __first,
    ^
    /usr/include/c++/4.8.2/bits/stl_vector.h:1044:9: note: template argument deduction/substitution failed:
    orient-filter.cpp:58:54: note: cannot convert ‘((OrientFilter*)this)->OrientFilter::coords.std::vector<_Tp, _Alloc>::cend<double, std::allocator >()’ (type ‘std::vector::const_iterator {aka __gnu_cxx::__normal_iterator<const double*, std::vector >}’) to type ‘std::vector::iterator {aka __gnu_cxx::__normal_iterator<double*, std::vector >}’
    coords.insert(coords.cend(), coord, coord + n_dim);
    ^
    make: *** [orient-filter.o] Error 1
    ERROR: compilation failed for package ‘wk’
  • removing ‘/home/nvp29/R/x86_64-pc-linux-gnu-library/4.2/wk’
    Warning message:
    In i.p(...) :
    installation of package ‘/tmp/RtmpWRYXtu/filebfca3a2550f4/wk_0.8.0.9000.tar.gz’ had non-zero exit status
@paleolimbot
Copy link
Owner

Thanks for opening! It looks like we didn't test properly on gcc4.8 before releasing the last version. As a workaround, you should be able to install a previous version using remotes::install_github("cran/wk@0.7.2") until we fix + release the next version.

@nvpatin
Copy link
Author

nvpatin commented Oct 11, 2023

Thanks so much for the quick response! That worked, glad it was an easy fix.

@anthonynorth
Copy link
Contributor

anthonynorth commented Oct 13, 2023

Appears that std::vector<>.cend isn't defined for gcc 4.8

'class std::vector' has no member named 'cend'

Problem here

coords.insert(coords.cend(), coord, coord + n_dim);

Looks like it could a 1-liner to fix? https://godbolt.org/z/eeq3MfbY1

Edit: context

@paleolimbot
Copy link
Owner

Thanks for tracking that down! I'll put up a PR shortly + add R 3.6/Windows back on CI (which uses gcc 4.8).

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 a pull request may close this issue.

3 participants