thk686 / odeintr

An R package for integrating differential equations in C++
18 stars 2 forks source link

Problems compiling #1

Closed goodsman closed 9 years ago

goodsman commented 9 years ago

After installing odeintr, running the following code:

compile_sys("logistic", "dxdt = x * (1 - x)") system.time({x = logistic(0.001, 15, 0.01)})

results in the following message

Warning message: running command 'make -f "C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.2/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="sourceCpp_1.dll" WIN=64 TCLBIN=64 OBJECTS="file27c42a93610.o"' had status 2 Error in Rcpp::sourceCpp(code = code, env = env, ...) : Error 1 occurred building shared library.

This message is preceded by a very long string of character output. Pasting the entire output here would make this post extremely long, but I will include it upon request.

thk686 commented 9 years ago

That is probably an issue with your build environment. Please see if you can use Rcpp::sourceCpp outside of odeintr. I am sure there is some example code around (try: example('sourceCpp')?).

Note that there is currently an issue with the Windows environment because odeintr uses the BH package, which does not work with the gcc in the current windows R setup. You may need to install a separate compiler (clang/gcc) and for R to use that. This is probably not the issue above.

THK

http://www.keittlab.org/

On Tue, Sep 22, 2015 at 12:54 PM, goodsman notifications@github.com wrote:

After installing odeintr, running the following code:

compile_sys("logistic", "dxdt = x * (1 - x)") system.time({x = logistic(0.001, 15, 0.01)})

results in the following message

Warning message: running command 'make -f "C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.2/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="sourceCpp_1.dll" WIN=64 TCLBIN=64 OBJECTS="file27c42a93610.o"' had status 2 Error in Rcpp::sourceCpp(code = code, env = env, ...) : Error 1 occurred building shared library.

This message is preceded by a very long string of character output. Pasting the entire output here would make this post extremely long, but I will include it upon request.

— Reply to this email directly or view it on GitHub https://github.com/thk686/odeintr/issues/1.

goodsman commented 9 years ago

Thanks for your help.

I am able to run the following code.

sourceCpp(code='

include

// [[Rcpp::export]] int fibonacci(const int x) { if (x == 0) return(0); if (x == 1) return(1); return (fibonacci(x - 1)) + fibonacci(x - 2); }' )

I am running on Windows. I will look into installing a separate compiler.

thk686 commented 9 years ago

This is fixed. There was indeed a bug. Because g++ in the windows R build environment is outdated, it does not support some newer C++ features. When converting type aliases to typedefs, I left out a template parameter. Try it now.

goodsman commented 9 years ago

Thanks. I'll uninstall the version downloaded from CRAN and build it from the tarball.