I use Windows 10 with R version 4.1.0. I wanted to create a package with Rcpp and RcppArmadillo codes in it. Now the Rcpp codes are compiling without errors and providing answers. But while compiling the package it starts weird problems.
I tried editing the NAMESPACE
useDynLib(sagnik, .registration = TRUE)
exportPattern("^[[:alpha:]]+")
importFrom(Rcpp,sourceCpp,evalCpp))
Tried editing the Makevars.win
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(shell $(R_HOME)/bin${R_ARCH_BIN}/Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
and the Makevars
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(shell $(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
But the following errors are still showing while using CLEAN & REBUILD
==> Rcpp::compileAttributes()
* Updated src/RcppExports.cpp
* Updated R/RcppExports.R
==> Rcmd.exe INSTALL --preclean --no-multiarch --with-keep.source hijibijibij
* installing to library 'C:/Users/sagni/Documents/R/win-library/4.1'
* installing *source* package 'SBHSdemo' ...
** using staged installation
** libs
/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.1.0/include" -DNDEBUG -I'C:/Users/sagni/Documents/R/win-library/4.1/Rcpp/include' -I'C:/Users/sagni/Documents/R/win-library/4.1/RcppArmadillo/include' -fopenmp -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c FHSagnik.cpp -o FHSagnik.o
/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.1.0/include" -DNDEBUG -I'C:/Users/sagni/Documents/R/win-library/4.1/Rcpp/include' -I'C:/Users/sagni/Documents/R/win-library/4.1/RcppArmadillo/include' -fopenmp -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
/mingw64/bin/g++ -shared -s -static-libgcc -o SBHSdemo.dll tmp.def FHSagnik.o RcppExports.o -LC:/PROGRA~1/R/R-4.1.0/bin/x64 -lRlapack -LC:/PROGRA~1/R/R-4.1.0/bin/x64 -lRblas -lgfortran -lm -lquadmath -LC:/PROGRA~1/R/R-4.1.0/bin/x64 -lR
C:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: FHSagnik.o:FHSagnik.cpp:(.text+0x2ff): undefined reference to `omp_get_num_threads'
C:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: FHSagnik.o:FHSagnik.cpp:(.text+0x306): undefined reference to `omp_get_thread_num'
C:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: FHSagnik.o:FHSagnik.cpp:(.text+0xd43): undefined reference to `omp_in_parallel'
C:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: FHSagnik.o:FHSagnik.cpp:(.text+0xd58): undefined reference to `omp_get_max_threads'
C:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: FHSagnik.o:FHSagnik.cpp:(.text+0xfa1): undefined reference to `GOMP_parallel'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'SBHSdemo'
Can anyone give me any idea of what to do?
According to Writing R Extensions you should include SHLIB_OPENMP_CXXFLAGS not only in PKG_CXXFLAGS but also in PKG_LIBS:
Include the appropriate macro in PKG_CFLAGS, PKG_CXXFLAGS and so on, and also in PKG_LIBS (but see below for Fortran).
BTW, current Rcpp no longer requires adding Rcpp:::LdFlags() to these variables.See section 2.7 in https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-package.pdf.
Related
I'm trying to compile a program called DAOSPEC written in Fortran. It gives me the following error (among similar others):
/usr/bin/ld: /home/osboxes/iraf/bin.linux64//libimfort.a(imakwc.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
See the full log here.
How do I fix it?
My Makefile
FCOMP = gfortran
FFLAGS = -Wall -Wextra -fPIC -fmax-errors=1 -O3 -march=native -ffast-math -funroll-loops
.SUFFIXES: .o .f
.f.o:
$(FCOMP) -c $(FFLAGS) $<
default : daospec
daospec: daospec.o lnxsubs.o iosubs.o mathsubs.o bothsubs.o
$(FCOMP) -o daospec daospec.o lnxsubs.o iosubs.o mathsubs.o bothsubs.o -L/usr/local/lib/ -lcfitsio -lplotsub -ldevices -lutils -L/usr/lib/x86_64-linux-gnu/ -lX11 -L/home/YOUR_USERNAME/iraf/bin.linux64/ -limfort -lsys -lvops -L/home/YOUR_USERNAME/iraf/unix/bin.linux64/ -los -lf2c -lcurl
clean:
rm -rf daospec *.o
The same Makefile works on a different PC with Ubuntu 16.04 gfortran 5.4, but breaks on Ubuntu 18.04 gfortran 7.3. In both cases the IRAF library files are the same.
I have managed to solve the problem, with help from Vladimir F. Ubuntu 18.04 uses PIE, position independent executables (source), and thus it requires libraries to be built with -fPIC option. The libraries in the official IRAF distribution that I used were not build with -fPIC, and that's what caused my errors.
Fortunately, one can now install IRAF libraries from the iraf-dev package on Ubuntu 18.04:
sudo apt-get install iraf-dev
Alternatively, one can compile IRAF from Github's iraf-community/iraf repository with -fPIC option.
Lastly, I modified the Makefile to use the new locations of IRAF library files: /usr/lib/iraf/bin/ and /usr/lib/iraf/unix/bin/.
FCOMP = gfortran
FFLAGS = -Wall -Wextra -fPIC -fmax-errors=1 -O3 -march=native -ffast-math -funroll-loops
.SUFFIXES: .o .f
.f.o:
$(FCOMP) -c $(FFLAGS) $<
default : daospec
daospec: daospec.o lnxsubs.o iosubs.o mathsubs.o bothsubs.o
$(FCOMP) -o daospec daospec.o lnxsubs.o iosubs.o mathsubs.o bothsubs.o -L/usr/local/lib/ -lcfitsio -lplotsub -ldevices -lutils -L/usr/lib/x86_64-linux-gnu/ -lX11 -L/usr/lib/iraf/bin/ -limfort -lsys -lvops -L/usr/lib/iraf/unix/bin/ -los -lf2c -lcurl
clean:
rm -rf daospec *.o
I'm currently working on an R package which uses C++ code and includes external libraries (dlib, boost and an optimization library developed in the group). We're using Rcpp to integrate R and C++, but the problem is the package always fails to compile, and none of the similar questions I've found out there have worked for me.
The report generated by R CMD check is:
* installing *source* package 'IRTppExperimental' ...
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/g++ -std=c++0x -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Users/Camilo/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -I../src/include -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/g++ -std=c++0x -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Users/Camilo/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -I../src/include -O2 -Wall -mtune=core2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o
c:/Rtools/mingw_32/bin/g++ -std=c++0x -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Users/Camilo/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -I../src/include -O2 -Wall -mtune=core2 -c test_multi.cpp -o test_multi.o
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o IRTppExperimental.dll tmp.def RcppExports.o rcpp_hello_world.o test_multi.o -LC:/PROGRA~1/R/R-33~1.1/bin/i386 -lRlapack -LC:/PROGRA~1/R/R-33~1.1/bin/i386 -lRblas IRTppExperimental.dll -L../src/include -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-33~1.1/bin/i386 -lR
g++.exe: error: IRTppExperimental.dll: No such file or directory
no DLL was created
ERROR: compilation failed for package 'IRTppExperimental'
* removing 'C:/Users/Camilo/Documents/UNAL/MIRT/Tests/Temps/IRTppExperimental.Rcheck/IRTppExperimental'
And the Makevars/Makevars.win files are as follows:
INCFOLDER = ../src/include
PKG_LIBS += $(LAPACK_LIBS) $(BLAS_LIBS) $(FPICFLAGS) $(SHLIB)
PKG_LIBS += -L$(INCFOLDER)
PKG_CXXFLAGS+=-I$(INCFOLDER)
CXXFLAGS+="-fno-stack-protector"
CXX_STD = CXX11
Lastly, the NAMESPACE file reads:
exportPattern("^[[:alpha:]]+")
importFrom(Rcpp,sourceCpp)
useDynLib(IRTppExperimental)
All the c++ source files are inside the src folder, including the external libraries. The package was created using the Rcpp.package.skeleton function, and used the compileAtributes function to create the RcppExports source files.
EDIT: As pointed out by Coatless, here is github link of the project: https://github.com/SICSresearch/IRTpp/tree/Uni-Multi-Merging
I got following error while compiling library that computes some stuff with molecules. It is mostly academic project.
/usr/bin/ld: trajectory_manager.o: undefined reference to symbol '_ZSt24__throw_out_of_range_fmtPKcz##GLIBCXX_3.4.20'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
It occurs to me that linker is trying to use some specific version of GLIBC but fails to find it or something but I am unable to find any solution to this at all.
The code was compiled using g++ (gcc version 5.3). Linker I have in version ldd (Ubuntu EGLIBC 2.19-0ubuntu6.7) 2.19. If necessary please tell me in comment section and I will provide any further information.
Edit:
Each src is compiled using:
mpiCC -pthread -ansi -Wno-long-long -g -D_DEBUG -I /home/asd/tunnel_analyzer/boost_lib/include -I ../../../src/lib -o main.o -c ../../../src/main/main.cpp
mpiCC -pthread -ansi -Wno-long-long -g -D_DEBUG -I /home/asd/tunnel_analyzer/boost_lib/include -o cache.o -c ../../../src/lib/cache.cpp
etc. and linked
mpiCC -pthread -ansi -Wno-long-long -g -D_DEBUG -I /home/asd/tunnel_analyzer/boost_lib/include -L/home/asd/tunnel_analyzer/boost_lib/lib -L. -o caverdock main.o cache.o coords.o current_weights.o everything.o grid.o szv_grid.o manifold.o model.o monte_carlo.o mutate.o my_pid.o naive_non_cache.o non_cache.o parallel_mc.o parse_pdbqt.o pdb.o quasi_newton.o quaternion.o random.o ssd.o terms.o weighted_terms.o constraint.o scheduler.o trajectory_manager.o -l boost_system -l boost_thread -l boost_serialization -l boost_filesystem -l boost_program_options
Note that mpiCC is just alias for g++.
it seems to be a G++ bug; installing libstdc++6 (4.9) apparently helps solve this.
I have downloaded the following code:
CVPR 2014 intersection over union optimization code
cvpr2014-iou-code-1.0.zip
http://research.microsoft.com/en-us/downloads/e164fe21-ef2b-4e34-98c1-4868968abb06/
What I get is an archive with two folders, one called src/ and another one called matlab/. I am running Linux Fedora 19 and I can compile the code in src/ just fine. The problem arises when I try to compile the code in matlab/.
The README says:
Matlab compilation
------------------
From within Matlab, configure the compiler using "mex -setup", then adjust the
paths in matlab\compile_windows.m or matlab/compile_linux.m scripts and run
either "compile_linux.m" or "compile_windows.m" in the "matlab" directory.
More specifically for Linux:
Linux
=====
From within Matlab run "mex -setup", then edit the mexopts.sh file and modify
the settings
CXXFLAGS='-std=c++11 -fopenmp -march=native -D_GNU_SOURCE'
CXXLIBS="$RPATH $MLIBS -lm -lgomp"
CXXOPTIMFLAGS='-Ofast -DNDEBUG'
This will enable OpenMP and C++11 and should work from G++ 4.7 onwards.
From the matlab/ directory, call compile_linux to build all mex files.
So I open matlab and run mex -setup. I answer yes to the question:
>> mex -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mex -setup' command selects an options file that is
placed in /user/wok/home/.matlab/R2012b and used by default for 'mex'. An options
file in the current working directory or specified on the command line
overrides the default options file in /user/wok/home/.matlab/R2012b.
To override the default options file, use the 'mex -f' command
(see 'mex -help' for more information).
The options files available for mex are:
1: /opt/matlab2012b/bin/mexopts.sh :
Template Options file for building gcc MEX-files
0: Exit with no changes
Enter the number of the compiler (0-1):
1
Overwrite /user/wok/home/.matlab/R2012b/mexopts.sh ([y]/n)?
y
/opt/matlab2012b/bin/mexopts.sh is being copied to
/user/wok/home/.matlab/R2012b/mexopts.sh
**************************************************************************
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. In the near future
you will be required to update your code to utilize the new
API. You can find more information about this at:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
Building with the -largeArrayDims option enables the new API.
**************************************************************************
Then I edit the file /user/wok/home/.matlab/R2012b/mexopts.sh and I follow the instructions from the README:
CXX='g++'
CXXFLAGS='-ansi -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
CXXFLAGS="$CXXFLAGS -fPIC -pthread"
CXXLIBS="$RPATH $MLIBS -lm"
CXXOPTIMFLAGS='-O -DNDEBUG'
CXXDEBUGFLAGS='-g'
becomes:
CXX='g++'
CXXFLAGS='-std=c++11 -fopenmp -march=native -D_GNU_SOURCE'
CXXLIBS="$RPATH $MLIBS -lm -lgomp"
CXXOPTIMFLAGS='-Ofast -DNDEBUG'
CXXDEBUGFLAGS='-g'
After this step, I open matlab and edit compile_linux.m to add the path to Boost:
% You need to have boost 1.49 or higher installed (package libboost-dev on
% most distributions)
%
% Tested on Ubuntu 13.10, Matlab R2012b, gcc 4.8.1
% TODO: this assumes that boost headers are available in /usr/include, as on
% most systems. If you manually installed boost, please add -I/path/to/boost
mex -v -O ...
-output mex_voc_optimize -I../src ...
-I/user/wok/home/Softwares/Boost_1.54/include/boost ...
mex_voc_optimize.cpp matlab_helpers.cpp ...
-largeArrayDims
Edit: Following the first comment from Praetorian, I have added the -v flag.
Finally I run compile_linux, only to get a long list of errors, which I have shortened and pasted below:
>> compile_linux
-> mexopts.sh sourced from directory (DIR = $PREF_DIR)
FILE = /user/wok/home/.matlab/R2012b/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /opt/matlab2012b
-> CC = gcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/opt/matlab2012b/bin/glnxa64 -L/opt/matlab2012b/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments =
-> CXX = g++
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/opt/matlab2012b/bin/glnxa64 -L/opt/matlab2012b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments =
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/opt/matlab2012b/bin/glnxa64 -L/opt/matlab2012b/bin/glnxa64 -lmx -lmex -lmat -lm
arguments =
-> LD = g++
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/opt/matlab2012b/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
Warning: You are using gcc version "4.8.2". The version
currently supported with MEX is "4.4.6".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/
-> g++ -c -I../src -I/user/wok/home/Softwares/Boost_1.54/include/boost -I/opt/matlab2012b/extern/include -I/opt/matlab2012b/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -O -DNDEBUG "mex_voc_optimize.cpp"
In file included from /usr/include/c++/4.8.2/cstdint:35:0,
from mex_voc_optimize.cpp:8:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from ../src/lfp.h:18:0,
from ../src/voc.h:15,
from mex_voc_optimize.cpp:19:
../src/timing.h:15:2: error: ‘chrono’ in namespace ‘std’ does not name a type
std::chrono::time_point<std::chrono::high_resolution_clock> start_time;
^
../src/timing.h: In member function ‘double timer::elapsed_this_period() const’:
../src/timing.h:20:8: error: ‘std::chrono’ has not been declared
std::chrono::time_point<std::chrono::high_resolution_clock> end_time
^
../src/timing.h:20:32: error: ‘std::chrono’ has not been declared
std::chrono::time_point<std::chrono::high_resolution_clock> end_time
until
../src/voc.h:418:31: note: ‘P’ declared here, later in the translation unit
alpha[k_best] += P(j,k_best);
^
../src/voc.h: In instantiation of ‘std::pair<double, double> voc::prediction_function<TFloat>::compute_objective_c(int) const [with TFloat = double]’:
../src/voc.h:328:56: required from ‘double voc::prediction_function<TFloat>::compute_objective() const [with TFloat = double]’
mex_voc_optimize.cpp:250:39: required from here
../src/voc.h:315:17: error: ‘P’ was not declared in this scope
A_c += P(i,c);
^
../src/voc.h:318:17: error: ‘P’ was not declared in this scope
D_c += P(i,c);
^
mex: compile of ' "mex_voc_optimize.cpp"' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in compile_linux (line 9)
mex -O ...
>>
I have tried editing the code to remove every call to chrono (for timers), then to replace unordered_map with map, etc., but it is a pain. I would like to be able to compile the mex file in matlab/ just like I can compile the c++ code in src/
Thanks to Praetorian's comment, I could pinpoint the problem. I had edited the wrong lines in mexopts.sh. Indeed, the CXXFLAGS appears at 3 different places, I had edited the flags at the first place, but it was necessary and sufficient to edit it at the second place (the first place was a decoy).
See for instance:
$ grep -n CXXLIBS /user/wok/home/.matlab/R2012b/mexopts.sh
74: CXXLIBS="$RPATH $MLIBS -lm"
129: CXXLIBS="$RPATH $MLIBS -lm"
199: CXXLIBS="$MLIBS -lstdc++"
So I edited the lines around line 129. The following lines
CXX='g++'
CXXFLAGS='-ansi -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -fPIC -fno-omit-frame-pointer -pthread"
CXXLIBS="$RPATH $MLIBS -lm"
CXXOPTIMFLAGS='-O -DNDEBUG'
CXXDEBUGFLAGS='-g'
become
CXX='g++'
CXXFLAGS='-std=c++11 -fopenmp -march=native -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -fPIC -fno-omit-frame-pointer -pthread"
CXXLIBS="$RPATH $MLIBS -lm -lgomp"
CXXOPTIMFLAGS='-Ofast -DNDEBUG'
CXXDEBUGFLAGS='-g'
I installed Google perftools (google-perftools 1.7-1ubuntu1), and add -lprofiler to PKG_LIBS in R, when compiling the C++ code.
library(RcppArmadillo)
library(Rcpp)
Sys.setenv("PKG_CXXFLAGS"="-fopenmp")
Sys.setenv("PKG_LIBS"="-fopenmp -lprofiler")
sourceCpp('my.cpp')
The output is:
/usr/bin/ld: cannot find -lprofiler
collect2: ld returned 1 exit status
make: *** [sourceCpp_17496.so] Error 1
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fopenmp -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c my.cpp -o my.o g++ -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o sourceCpp_17496.so my.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -fopenmp -lprofiler -L/usr/lib/R/lib -lR
Error in sourceCpp("my.cpp") :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install GNU development tools including a C++ compiler.
Even if I run g++ in bash, I get the same error
$ g++ -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o sourceCpp_17496.so my.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -fopenmp -lprofiler -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lprofiler
collect2: ld returned 1 exit status
I wonder why -lprofiler doesn't specify google perfotools? How can I solve the problem? Thanks!
My g++ is g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3.
Quick ones:
Do you actually have the package libgoogle-perftools-dev installed? Ie do you have shared and static libraries /usr/lib/libprofiler.* ? This is the mother of all development FAQs: you need package libfoo to run code against foo, and package libfoo-dev to compile against foo.
I have old working examples in the slides from my 'HPC with R' talks from a few years ago; those should all work as is.