Message Boards Message Boards

Can not built MathLink Examples on Raspberry Pi

Posted 10 years ago

Hello Community,

I am using the Raspberry Pi, Modell B with the latest version of Raspbian and the Wolfram Engine. For an project I need to wirte an own MathLink Addon and therefore I started to look at the existing examples in: /opt/Wolfram/WolframEngine/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-ARM/MathLinkExamples

I tried to built the simple addtwo Example, but only got this error:

sudo make addtwo
/usr/bin/cc -c  -I/opt/Wolfram/WolframEngine/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-ARM/MathLinkExamples/../CompilerAdditions addtwo.c
/usr/bin/c++  -I/opt/Wolfram/WolframEngine/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-ARM/MathLinkExamples/../CompilerAdditions addtwotm.o addtwo.o -L/opt/Wolfram/WolframEngine/10.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-ARM/MathLinkExamples/../CompilerAdditions -lML32i4 -lm -lpthread -lrt -lstdc++ -ldl -luuid -o addtwo
/usr/bin/ld: cannot find -luuid
collect2: ld returned 1 exit status
Makefile:29: recipe for target 'addtwo' failed
make: *** [addtwo] Error 1

I could not manage to get it to work, could anyone help me?

Thanks a lot,

Nico

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

Hi, the process is failing because it needs the uuid development libraries. You can install them with the following commands:

sudo apt-get update
sudo apt-get install uuid-dev

We'll update the installer to require this package.

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