needed to add -fPIC when compiling with R.