'Compile issue in R

I am trying to install xgboost in R. Initially I was getting an issue with c++14, so i created a Makevars file with the following in it:

CXX14=/opt/rh/devtoolset-8/root/usr/bin/g++
CXX14FLAGS=-O3 -Wno-unused-variable -Wno-unused-function

However, am now running into the following issue, does anyone have any suggestions?

/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: ./xgboost_R.o: relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

Here is the install I am trying, from source package:

install.packages('~/xgboost_1.5.2.1.tar.gz', repos = NULL, type="source")
r


Solution 1:[1]

I figured this out. I had a Makevars and just needed to add -fPIC to the end of the CFLAGS line.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak