Message Boards Message Boards

Can not built MathLink Examples on Raspberry Pi

Posted 10 years ago
POSTED BY: Nico Maas
6 Replies
Posted 10 years ago

Thank you Alex and Illian for your help :)! It is now working as expected!

POSTED BY: Nico Maas

You could add to your LD_LIBRARY_PATH

/opt/Wolfram/WolframEngine/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-ARM/CompilerAdditions
POSTED BY: Ilian Gachevski
Posted 10 years ago

OK, I came across an idea: I copied the contant of the /opt/Wolfram/WolframEngine/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-ARM/CompilerAdditions Folder:

libML32i3.a  libML32i3.so  libML32i4.a  libML32i4.so  mathlink.h  mcc  mprep

to /usr/lib

and ran sudo /sbin/ldconfig to refresh the cache. Now it works. But that is quite an ugly solution. Which adjustment should I do make it a proper solution?

POSTED BY: Nico Maas
POSTED BY: Alex Newman
Posted 10 years ago

Thank you very much, Alex. Now I could built the example. But sadly, on execution of the binary I get now following error:

./addtwo
./addtwo: error while loading shared libraries: libML32i4.so: cannot open shared object file: No such file or directory

Any idea about that?

Thanks a lot for your help,

Nico

POSTED BY: Nico Maas

MathLink binaries are expected to be run from within the Wolfram Language Kernel (e.g. Mathematica), so you'll see the binaries looking for some of the libraries contained in the $InstallationDirectory. These MathLink examples are providing an interface for the kernel to run the C code. The proper way to use them is to load them within the Kernel with Install.

SetDirectory[$InstallationDirectory <>                                  
           "/SystemFiles/Links/MathLink/DeveloperKit/" <> $SystemID <>          
           "/PrebuiltExamples/"];
link = Install["addtwo"];
AddTwo[1,2]

You can read more about this process in the documentation for Install and our documentation on MathLink/WSTP.

In general, you don't want to be modifying the system library paths to load non-standard library directories. If you really wanted to run with the Wolfram Language's libraries, you could just start a binary like this:

LD_LIBARY_PATH=/opt/Wolfram/WolframEngine/10.0/SystemFiles/Libraries/Linux-ARM/:$LD_LIBRARY_PATH ./my_binary
POSTED BY: Alex Newman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract