How to use the linear algebra library armadillo with emscripten?

183 views
Skip to first unread message

Frédéric Faure

unread,
Sep 10, 2018, 8:32:40 AM9/10/18
to emscripten-discuss
Hello,
i would like to use  C++ library called armadillo that enable to use linear algebra, with emscripten:

I have downloaded armadillo, and  I have followed the instructions from

so i did:
./emconfigure cmake .
then
./emmake make

It seems to work, it gives:
Scanning dependencies of target armadillo
[ 33%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper.cpp.o
[ 66%] Linking CXX shared library libarmadillo.so
[100%] Built target armadillo


It produces a file:  libarmadillo.so
After i write the command:
emcc -O2 ./libarmadillo.so -o libarmadillo.js

the problem is that  the answer is:

WARNING:root:emcc: cannot find library "armadillo"
ERROR:root:no input files
note that input files without a known suffix are ignored, make sure your input files end with one of: ('.c', '.C', '.i', '.cpp', '.cxx', '.cc', '.c++', '.CPP', '.CXX', '.CC', '.C++', '.ii', '.m', '.mi', '.mm', '.mii', '/dev/null', '.bc', '.o', '.obj', '.lo', '.dylib', '.so', '.a', '.ll', '.h', '.hxx', '.hpp', '.hh', '.H', '.HXX', '.HPP', '.HH')


I don't know how to proceed. Can you help me please?


Thanks,
Frédéric Faure.

-----
For exemple, my  first objective is to be able to use the following simple code with emscripten:

#include <iostream>
using namespace std;

#include <armadillo>
using namespace arma;

 
main ()
{
 Col<int> V("1 2 3"); // vector
 cout<<"V="<<endl<<V<<endl;
 Mat<int> M("3 2 1; 4 5 0");// matrix
 cout<<"M="<<endl<<M<<endl;
 Col<int> W = M * V; // compute the product
 cout<<"M*V="<<endl<<W<<endl;
 cout<<"Matrix element M(0,0)="<<M(0,0)<<endl;
}

Segmentation Fault Error

unread,
Sep 11, 2018, 10:15:13 AM9/11/18
to emscripte...@googlegroups.com
Aren't you missing the object file of your example where you make use of the armadillo ".so" when linking?

In other words, I think you are just missing a file in "emcc -O2 ./libarmadillo.so -o libarmadillo.js", example.o?

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages