Closed offbynull closed 3 years ago
The test here is very simple: either what follows can be compiled or not:
#include <iostream>
using namespace std;
int main() {
long long x = 1;
cout << x << endl;
cout << 1LL << 1ULL << endl;
cout << 9223372036854775807LL << 18446744073709551615ULL << endl;
return 0;
}
This is not the case with your configuration.
I suggest you update your configuration in <R_inst_dir>/etc/Makeconf
see also https://cran.r-project.org/doc/manuals/r-release/R-admin.html
Below is the output of the test C++ code you posted above, the C++ compiler being referenced by Makeconf, and Makeconf itself. I'm not seeing anything out of the ordinary here?
(base) root@d7f466414776:/source# conda run -n netrias x86_64-conda-linux-gnu-c++ -c ~/test.cpp
(base) root@d7f466414776:/source# ls -al
total 16
drwxr-xr-x 3 root root 4096 Jun 21 16:03 .
drwxr-xr-x 1 root root 4096 Jun 21 15:01 ..
drwxr-xr-x 2 root root 4096 Jun 21 15:03 .empty
-rw-r--r-- 1 root root 3096 Jun 21 16:03 test.o
(base) root@d7f466414776:/source# conda run -n netrias x86_64-conda-linux-gnu-c++ --version
x86_64-conda-linux-gnu-c++ (crosstool-NG 1.24.0.133_b0863d8_dirty) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(base) root@d7f466414776:/source# cat /opt/conda/envs/netrias/lib/R/etc/Makeconf
R_HOME=/opt/conda/envs/netrias/lib/R
# etc/Makeconf. Generated from Makeconf.in by configure.
#
# ${R_HOME}/etc/Makeconf
#
# R was configured using the following call
# (not including env. vars and site configuration)
# configure '--prefix=/opt/conda/envs/netrias' '--host=x86_64-conda-linux-gnu' '--build=x86_64-conda-linux-gnu' '--enable-shared' '--enable-R-shlib' '--with-blas=-lblas' '--with-lapack=-llapack' '--disable-prebuilt-html' '--enable-memory-profiling' '--with-tk-config=/opt/conda/envs/netrias/lib/tkConfig.sh' '--with-tcl-config=/opt/conda/envs/netrias/lib/tclConfig.sh' '--with-x' '--with-pic' '--with-cairo' '--with-readline' '--with-recommended-packages=no' '--without-libintl-prefix' 'LIBnn=lib' 'build_alias=x86_64-conda-linux-gnu' 'host_alias=x86_64-conda-linux-gnu' 'PKG_CONFIG_PATH=/opt/conda/envs/netrias/lib/pkgconfig' 'CC=x86_64-conda-linux-gnu-cc' 'CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix' 'LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/opt/conda/envs/netrias/lib -Wl,-rpath-link,/opt/conda/envs/netrias/lib -L/opt/conda/envs/netrias/lib -Wl,-rpath-link,/opt/conda/envs/netrias/lib' 'CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/envs/netrias/include -I/opt/conda/envs/netrias/include -Wl,-rpath-link,/opt/conda/envs/netrias/lib' 'CPP=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env/bin/x86_64-conda-linux-gnu-cpp' 'FC=x86_64-conda-linux-gnu-gfortran' 'CXX=x86_64-conda-linux-gnu-c++' 'CXXFLAGS=-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix' 'OBJC=x86_64-conda-linux-gnu-cc'
## This fails if it contains spaces, or if it is quoted
include $(R_SHARE_DIR)/make/vars.mk
AR = x86_64-conda-linux-gnu-ar
BLAS_LIBS = -lblas
C_VISIBILITY = -fvisibility=hidden
CC = x86_64-conda-linux-gnu-cc
CFLAGS = -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO)
CPICFLAGS = -fpic
CPPFLAGS = -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/envs/netrias/include -I/opt/conda/envs/netrias/include -Wl,-rpath-link,/opt/conda/envs/netrias/lib
CXX = x86_64-conda-linux-gnu-c++ -std=gnu++11
## Not used by anything in R, in particular not for the .cc.d rule
## but used via R CMD config by several packages
CXXCPP = $(CXX) -E
CXXFLAGS = -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO)
CXXPICFLAGS = -fpic
CXX11 = x86_64-conda-linux-gnu-c++
CXX11FLAGS = -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO)
CXX11PICFLAGS = -fpic
CXX11STD = -std=gnu++11
CXX14 = x86_64-conda-linux-gnu-c++
CXX14FLAGS = -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO)
CXX14PICFLAGS = -fpic
CXX14STD = -std=gnu++14
CXX17 = x86_64-conda-linux-gnu-c++
CXX17FLAGS = -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO)
CXX17PICFLAGS = -fpic
CXX17STD = -std=gnu++17
CXX20 = x86_64-conda-linux-gnu-c++
CXX20FLAGS = -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO)
CXX20PICFLAGS = -fpic
CXX20STD = -std=gnu++2a
CXX_VISIBILITY = -fvisibility=hidden
DYLIB_EXT = .so
DYLIB_LD = $(CC)
DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
## should be used by packges for dylibs, but at the time of writing was not
DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS)
ECHO = echo
ECHO_C =
ECHO_N = -n
ECHO_T =
F_VISIBILITY = -fvisibility=hidden
## FC is the compiler used for all Fortran as from R 3.6.0
FC = x86_64-conda-linux-gnu-gfortran
FCFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO_FC)
## additional libs needed when linking with $(FC), e.g. on some Oracle compilers
FCLIBS_XTRA =
FFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix $(LTO_FC)
FLIBS = -lgfortran -lm -lgomp -lquadmath -lpthread
FPICFLAGS = -fpic
FOUNDATION_CPPFLAGS =
FOUNDATION_LIBS =
JAR = /home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env/bin/jar
JAVA = /home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env/bin/java
JAVAC = /home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env/bin/javac
JAVAH =
## JAVA_HOME might be used in the next three.
## They are for packages 'JavaGD' and 'rJava'
JAVA_HOME = /home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env
JAVA_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JAVA_LIBS = -L$(JAVA_HOME)/lib/server -ljvm
JAVA_LD_LIBRARY_PATH = /home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env/lib/server
LAPACK_LIBS = -llapack
LDFLAGS = -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/opt/conda/envs/netrias/lib -Wl,-rpath-link,/opt/conda/envs/netrias/lib -L/opt/conda/envs/netrias/lib -Wl,-rpath-link,/opt/conda/envs/netrias/lib
## we only need this is if it is external, as otherwise link to R
LIBINTL=
LIBM = -lm
LIBR0 = -L"$(R_HOME)/lib$(R_ARCH)"
LIBR1 = -lR
LIBR = -L"$(R_HOME)/lib$(R_ARCH)" -lR
LIBS = -L/opt/conda/envs/netrias/lib -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -liconv -licuuc -licui18n
## needed by R CMD config
LIBnn = lib
LIBTOOL = $(SHELL) "$(R_HOME)/bin/libtool"
## set for --enable-lto, --enable-lto=check
LTO =
LTO_FC =
LTO_LD =
## needed to build applications linking to static libR
MAIN_LD = $(CC)
MAIN_LDFLAGS = -Wl,--export-dynamic -fopenmp
RPATH_LDFLAGS = -Wl,-rpath,$(abs_top_builddir)/lib -Wl,-rpath,/opt/conda/envs/netrias/lib
MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS) $(RPATH_LDFLAGS)
MKINSTALLDIRS = "$(R_HOME)/bin/mkinstalldirs"
NM = /home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/_build_env/bin/x86_64-conda-linux-gnu-nm
OBJC = x86_64-conda-linux-gnu-cc
OBJCFLAGS = -g -O2 -fobjc-exceptions $(LTO)
OBJC_LIBS =
OBJCXX =
R_ARCH =
RANLIB = x86_64-conda-linux-gnu-ranlib
SAFE_FFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/envs/netrias/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda/envs/netrias=/usr/local/src/conda-prefix -msse2 -mfpmath=sse
SED = /opt/conda/envs/netrias/bin/sed
SHELL = /bin/sh
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = $(CXX)
SHLIB_CXXLDFLAGS = -shared# $(CXXFLAGS) $(CXXPICFLAGS) $(LTO_LD)
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared# $(CXX11FLAGS) $(CXX11PICFLAGS) $(LTO_LD)
SHLIB_CXX14LD = $(CXX14) $(CXX14STD)
SHLIB_CXX14LDFLAGS = -shared# $(CXX14FLAGS) $(CXX14PICFLAGS) $(LTO_LD)
SHLIB_CXX17LD = $(CXX17) $(CXX17STD)
SHLIB_CXX17LDFLAGS = -shared# $(CXX17FLAGS) $(CXX17PICFLAGS) $(LTO_LD)
SHLIB_CXX20LD = $(CXX20) $(CXX20STD)
SHLIB_CXX20LDFLAGS = -shared# $(CXX20FLAGS) $(CXX20PICFLAGS) $(LTO_LD)
SHLIB_EXT = .so
SHLIB_FCLD = $(FC)
SHLIB_FCLDFLAGS = -shared# $(FCFLAGS) $(FPICFLAGS)
SHLIB_FFLAGS =
SHLIB_LD = $(CC)
## used for add-on packages linked by C
SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS) $(LTO_LD)
## used for standard packages
SHLIB_LDFLAGS_R = -shared# $(CFLAGS) $(CPICFLAGS) $(LTO_LD)
SHLIB_LIBADD =
## We want to ensure libR is picked up from $(R_HOME)/lib
## before e.g. /usr/local/lib if a version is already installed.
SHLIB_LINK = $(SHLIB_LD) $(SHLIB_LDFLAGS) $(LIBR0) $(LDFLAGS)
SHLIB_OPENMP_CFLAGS = -fopenmp
SHLIB_OPENMP_CXXFLAGS = -fopenmp
SHLIB_OPENMP_FFLAGS =
STRIP_STATIC_LIB = x86_64-conda-linux-gnu-strip --strip-debug
STRIP_SHARED_LIB = x86_64-conda-linux-gnu-strip --strip-unneeded
TCLTK_CPPFLAGS = -I/opt/conda/envs/netrias/include -I/opt/conda/envs/netrias/include
TCLTK_LIBS = -L/opt/conda/envs/netrias/lib -ltcl8.6 -L/opt/conda/envs/netrias/lib -ltk8.6 -lX11
YACC = yacc
## for linking to libR.a
STATIC_LIBR = # -Wl,--whole-archive "$(R_HOME)/lib$(R_ARCH)/libR.a" -Wl,--no-whole-archive $(BLAS_LIBS) $(FLIBS) $(LIBINTL) -lreadline $(LIBS)
## These are recorded as macros for legacy use in packages
## set on AIX, formerly for old glibc (-D__NO_MATH_INLINES)
R_XTRA_CFLAGS =
## was formerly set on HP-UX
R_XTRA_CPPFLAGS = -I"$(R_INCLUDE_DIR)" -DNDEBUG
## currently unset
R_XTRA_CXXFLAGS =
## used for gfortran in R > 3.6.0
R_XTRA_FFLAGS = -fno-optimize-sibling-calls
## CXX98 is no longer supported, but packages may use it.
SHLIB_CXX98LD = @SHLIB_CXX98LD@
SHLIB_CXX98LDFLAGS = @SHLIB_CXX98LDFLAGS@
## SHLIB_CFLAGS SHLIB_CXXFLAGS SHLIB_FFLAGS are apparently currently unused
## SHLIB_CXXFLAGS is undocumented, there is no SHLIB_FCFLAGS
ALL_CFLAGS = $(PKG_CFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(CFLAGS)
ALL_CPPFLAGS = -I"$(R_INCLUDE_DIR)" -DNDEBUG $(PKG_CPPFLAGS) $(CLINK_CPPFLAGS) $(CPPFLAGS)
ALL_CXXFLAGS = $(PKG_CXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(CXXFLAGS)
ALL_OBJCFLAGS = $(PKG_OBJCFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(OBJCFLAGS)
ALL_OBJCXXFLAGS = $(PKG_OBJCXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(OBJCXXFLAGS)
ALL_FFLAGS = -fno-optimize-sibling-calls $(PKG_FFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FFLAGS)
## can be overridden by R CMD SHLIB
P_FCFLAGS = $(PKG_FFLAGS)
ALL_FCFLAGS = -fno-optimize-sibling-calls $(P_FCFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FCFLAGS)
## LIBR here as a couple of packages use this without SHLIB_LINK
ALL_LIBS = $(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR)# $(LIBINTL)
.SUFFIXES:
.SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o
.c.o:
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
.c.d:
@echo "making $@ from $<"
@$(CC) -MM $(ALL_CPPFLAGS) $< > $@
.cc.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
.cpp.o:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
.cc.d:
@echo "making $@ from $<"
@$(CXX) -M $(ALL_CPPFLAGS) $< > $@
.cpp.d:
@echo "making $@ from $<"
@$(CXX) -M $(ALL_CPPFLAGS) $< > $@
.m.o:
$(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $@
.m.d:
@echo "making $@ from $<"
@$(OBJC) -MM $(ALL_CPPFLAGS) $< > $@
.mm.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
.M.o:
$(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
.f.o:
$(FC) $(ALL_FFLAGS) -c $< -o $@
## @FCFLAGS_f9x@ are flags needed to recognise the extensions
.f95.o:
$(FC) $(ALL_FCFLAGS) -c $< -o $@
.f90.o:
$(FC) $(ALL_FCFLAGS) -c $< -o $@
Here's what I see in the INSTALL file:
Overall, your build chain may be misconfigured, check out,
amongst others, `<R_inst_dir>/etc/Makeconf`
(e.g., are you using `--std=gnu++11` instead of `--std=c++11`?). Refer to
https://cran.r-project.org/doc/manuals/r-release/R-admin.html for more details.
It looks like Makeconf is using gnu++11. Is the workaround here to use install.packages("stringi", configure.args = "--with-extra-cxxflags='--std=c++11'")
as suggested by the document? It doesn't seem to do anything.
EDIT: Changing all gnu++ references to c++ in Makeconf doesn't produce different results.
It looks like it's the linking that might be causing the check to crap out. It looks like some library / library configs might be misconfigured on my end.
(base) root@d7f466414776:/source# conda run -n netrias x86_64-conda-linux-gnu-c++ ~/test.cpp
ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['x86_64-conda-linux-gnu-c++', '/root/test.cpp']' command failed. (See above for error)
/opt/conda/envs/netrias/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /opt/conda/envs/netrias/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/lib/../lib/libstdc++.so: undefined reference to `aligned_alloc@GLIBC_2.16'
/opt/conda/envs/netrias/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /opt/conda/envs/netrias/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/lib/../lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'
collect2: error: ld returned 1 exit status
I got it sorted out. I'll leave an answer here for anyone else having problems: If you're installing R through conda and referencing against multiple channels, there's a chance that dependencies will get mixed up across channels.
Here's what I was originally doing: conda install -n netrias -c defaults -c r -c conda-forge r-base==4.0.3
Here's what I ended up changing that to: conda install -n netrias -c conda-forge r-base==4.0.3
Thanks for posting the solution.
I'm getting an error during installation. I'm assuming it's complaining about a missing feature in my C++ compiler (long long support), but AFAIK my compiler isn't missing that feature. Any tips on how I can debug this further?
Here's my C++ compiler:
Here's the error that keeps displaying: