fstpackage / fst

Lightning Fast Serialization of Data Frames for R
http://www.fstpackage.org/fst/
GNU Affero General Public License v3.0
619 stars 42 forks source link

compilation fails with `unknown option : -platform_version` #238

Open cwdjankoski opened 4 years ago

cwdjankoski commented 4 years ago

Hi @MarcusKlik , thank you for this wonderful package and all your work - much appreciated!

I am having similar troubles like in issue #226 - searching for the error actually brought me here. At first i was getting the same error

Error: package or namespace load failed for ‘fst’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/3.6/site-library/00LOCK-fst/00new/fst/libs/fst.so':
  dlopen(/usr/local/lib/R/3.6/site-library/00LOCK-fst/00new/fst/libs/fst.so, 6): Symbol not found: _XXH32
  Referenced from: /usr/local/lib/R/3.6/site-library/00LOCK-fst/00new/fst/libs/fst.so
  Expected in: flat namespace
 in /usr/local/lib/R/3.6/site-library/00LOCK-fst/00new/fst/libs/fst.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.6/site-library/fst’

But after brew install llvm + exporting the compiler flags LD/CPP - it seemed to go smooth until it hit a new problem :-\

clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -L/usr/local/Cellar/r/3.6.3_1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o fst.so RcppExports.o flex_store.o fst_blockrunner_char.o fst_compress.o fst_error.o fst_table.o init.o openmp.o -L. -lFRAME -lCOMPRESSION -lLZ4 -lZSTD -L/usr/local/Cellar/r/3.6.3_1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: unknown option: -platform_version
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [fst.so] Error 1
ERROR: compilation failed for package ‘fst’
* removing ‘/usr/local/lib/R/3.6/site-library/fst’

I am wondering if this is a clang problem as you mention in the other issue ? Searching around bring up some results https://github.com/ncbi/SKESA/issues/6 but none that i really understand enough to twiddle with the compilation flags unfortunately.

Would you perhaps have any idea how to overcome this - or have you had similar issues with fst before ?

# R
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin18.7.0 (64-bit)

# llvm from homebrew
==> Summary
🍺  /usr/local/Cellar/llvm/10.0.0_1: 7,019 files, 1GB

# gcc
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

~ » brew info gcc
gcc: stable 9.3.0 (bottled), HEAD
GNU compiler collection
https://gcc.gnu.org/
/usr/local/Cellar/gcc/9.3.0 (1,463 files, 292MB) *
  Poured from bottle on 2020-03-17 at 21:33:26

Thanks again for this wonderful pkg and keep up the great work !

MarcusKlik commented 4 years ago

Hi @cwdjankoski, thanks for your kind words!

The error is a bit puzzling, --platform_version doesn't seem to be a valid linking option for both gcc and clang, do you know were the option is coming from?

Did you try using the steps defined on the data.table wiki to install llvm? Unfortunately, I don't have OSX at hand to test the installation locally, but the Travis CI machine (usually) works using:

brew install llvm
export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include

Also, do you have a custom .R/Makevars defined in your home directory?

Perhaps, if the error is similar, we should take a look at the solution that fixed the conda forge build...