gagolews / stringi

Fast and portable character string processing in R (with the Unicode ICU)
https://stringi.gagolewski.com/
Other
304 stars 44 forks source link

Error installing stringi on miniconda3: `libstdc++.so: undefined reference to aligned_alloc@GLIBC_2.16` #460

Closed h4rvey-g closed 3 years ago

h4rvey-g commented 3 years ago

Here is what comes out after install.packages("stringi")

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /home/wangyinan/miniconda3/envs/r/lib/R
checking for R... /home/wangyinan/miniconda3/envs/r/lib/R/bin/R
checking for endianness... little
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /usr/bin/cat
checking for local ICUDT_DIR... icu69/data
checking for x86_64-conda-linux-gnu-gcc... x86_64-conda-linux-gnu-cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-conda-linux-gnu-cc accepts -g... yes
checking for x86_64-conda-linux-gnu-cc option to accept ISO C89... none needed
checking how to run the C preprocessor... /home/wangyinan/miniconda3/envs/r/bin/x86_64-conda-linux-gnu-cpp
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking elf.h usability... yes
checking elf.h presence... yes
checking for elf.h... yes
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-conda-linux-gnu-c++ -std=c++11 accepts -g... yes
checking whether the C++ compiler supports the long long type... no
*** Trying with C++11 compiler disabled.
checking for local ICUDT_DIR... icu55/data
checking for x86_64-conda-linux-gnu-gcc... x86_64-conda-linux-gnu-cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-conda-linux-gnu-cc accepts -g... yes
checking for x86_64-conda-linux-gnu-cc option to accept ISO C89... none needed
checking how to run the C preprocessor... /home/wangyinan/miniconda3/envs/r/bin/x86_64-conda-linux-gnu-cpp
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for strings.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking for elf.h... (cached) yes
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-conda-linux-gnu-c++ -std=c++11 accepts -g... yes
checking whether the C++ compiler supports the long long type... no

I tried configure.args="--with-extra-cxxflags='--std=c++11'" and replacing gnu++11 to c++11 in Makeconf (#452 ) but got basically the same error. The problem seems to be C++ compiler supports the long long type... no but I don't know how to fix it. Here is some information.

R version 4.1.1 (2021-08-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/wangyinan/miniconda3/envs/r/lib/libopenblasp-r0.3.17.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.1.1

gcc version 9.3.0 (crosstool-NG 1.24.0.133_b0863d8_dirty)

gagolews commented 3 years ago

Are you able to build other packages, such as tidyr?

rickbingpan commented 3 years ago

I had a same error, try install.packages("stringi", configure.args="--with-extra-cxxflags='--std=gnu++11'"), is also same error. but install.packages(tidyr) done!

h4rvey-g commented 3 years ago

Are you able to build other packages, such as tidyr?

Yes, tidyr installation seems fine.

e3vela commented 3 years ago

Having the same problem when trying to install it

gagolews commented 3 years ago

Still, most probably there's something wrong with your build chain.

Could you please download the package source, run ./configure manually and paste the generated config.log file?

For example:

cd /tmp
 wget https://cran.r-project.org/src/contrib/stringi_1.7.5.tar.gz
tar -zxf stringi_1.7.5.tar.gz
cd stringi
./configure

and then upload /tmp/stringi/config.log here ?

h4rvey-g commented 3 years ago

config.log

gagolews commented 3 years ago

So we see:

configure:4098: checking whether the C++ compiler supports the long long type
configure:4118: x86_64-conda-linux-gnu-c++ -std=c++11 -o conftest -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/wangyinan/miniconda3/envs/r/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1630154298835/work=/usr/local/src/conda/r-base-4.1.1 -fdebug-prefix-map=/home/wangyinan/miniconda3/envs/r=/usr/local/src/conda-prefix -fpic   -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/wangyinan/miniconda3/envs/r/include -I/home/wangyinan/miniconda3/envs/r/include -Wl,-rpath-link,/home/wangyinan/miniconda3/envs/r/lib   -UDEBUG -DNDEBUG    conftest.cpp    >&5
/home/wangyinan/miniconda3/envs/r/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/wangyinan/miniconda3/envs/r/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'
/home/wangyinan/miniconda3/envs/r/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/wangyinan/miniconda3/envs/r/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
configure:4118: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "stringi"
| #define PACKAGE_TARNAME "stringi"
| #define PACKAGE_VERSION "1.7"
| #define PACKAGE_STRING "stringi 1.7"
| #define PACKAGE_BUGREPORT "https://stringi.gagolewski.com"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| 
|             #include <iostream>
|             using namespace std;
| 
|             int main() {
|                 long long x = 1;
|                 cout << x << endl;
| 
|                 cout << 1LL << 1ULL << endl;
|                 cout << 9223372036854775807LL << 18446744073709551615ULL << endl;
| 
|                 return 0;
|             }
| 
configure:4125: result: no

Especially this part worries me:

/home/wangyinan/miniconda3/envs/r/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/wangyinan/miniconda3/envs/r/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'

This indicates an improperly configured environment – and not a problem with stringi per se. As not only you suffer from this problem, I suggest it be fixed at a more general level – Try filing a bug report to the maintainers of the (mini)conda project

See https://docs.conda.io/en/latest/contributing.html#new-issues

Please keep me in the loop with regards to this.

PS: I would also give conda update --all a try

h4rvey-g commented 3 years ago

I searched the undefined reference above and found that it probably relates to the version of gnu c library. After several trials I found glib<=2.66.0 would be compatible. So for anyone encountering similar problems, you could try conda create -c conda-forge r-base=4.0.2 glib=2.66.0, which works well on my server to successfully install stringi and packages depending on it. I will file an issue to conda when available.

gagolews commented 3 years ago

Thanks for the update! I hope it'll help the others.