Last active
October 26, 2020 15:45
-
-
Save paleolimbot/51db5e587b5f3e57a637b6a24655fe87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rocker/r-devel:latest | |
RUN apt update && apt install -y git flex | |
RUN git clone git://gcc.gnu.org/git/gcc.git gcc11 | |
RUN cd gcc11 && ./contrib/download_prerequisites | |
RUN mkdir gcc-build && cd gcc-build && ../gcc11/configure -disable-multilib --enable-languages=c,c++,fortran | |
RUN cd gcc-build && make -j4 && make install | |
RUN echo 'LD_LIBRARY_PATH="/usr/local/lib64:${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"' >> /usr/lib/R/etc/ldpaths | |
RUN mkdir ~/.R && echo 'CXX11=/usr/local/bin/g++' > ~/.R/Makevars && echo 'CXX=/usr/local/bin/g++' >> ~/.R/Makevars && echo 'CC=/usr/local/bin/gcc' >> ~/.R/Makevars | |
RUN echo 'CCFLAGS = -Wall -pedantic -O2' >> ~/.R/Makevars && echo 'CXXFLAGS = -Wall -pedantic -O2' >> ~/.R/Makevars && echo 'CXX11FLAGS = -Wall -pedantic -O2' >> ~/.R/Makevars | |
CMD /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "s2/util/gtl/btree_map.h" | |
int main() { | |
gtl::btree_map<int, int> map; | |
map[4] = 4; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build docker image with gcc11 (takes several hours) | |
docker build . --tag r-gcc11 | |
docker run --rm r-gcc11 g++ --version | |
# with r-spatial/s2 | |
curl -L https://github.com/r-spatial/s2/archive/master.zip --output s2-r.zip | |
unzip s2-r.zip | |
docker run --rm -v $(pwd):/test -w /test r-gcc11 g++ -std=gnu++11 -I s2-master/inst/include -O2 -DNDEBUG -Warray-bounds test.cpp -o test | |
# with latest github s2 | |
curl -L https://github.com/google/s2geometry/archive/master.zip --output s2.zip | |
unzip s2.zip | |
docker run --rm -v $(pwd):/test -w /test r-gcc11 g++ -std=c++11 -I s2geometry-master/src -O2 -DNDEBUG -Warray-bounds test.cpp -o test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that all of
map[4] = 4;
(i.e., insertion)-DNDEBUG
and-O2
...are necessary to reproduce.