I have a problem with WSTP in the newest version of Mathematica. I get the same problem on Ubuntu 14.04 and Mint 17.2.

Using the pre-built examples (...DeveloperKit/Linux-x86-64/PrebuiltExamples/...) with Install[...] works fine.

However, after I successfully compile the examples in (...DeveloperKit/Linux-x86-64/WSTPExamples/...) and try to use them with nstall[...], Mathematica hangs up.

Does anybody also observe this?

I complied everything using the standard Makefile in ...DeveloperKit/Linux-x86-64/WSTPExamples/...

Indeed, if I try to run the executables without Mathematica I get "error while loading shared libraries: libWSTP64i4.so".

If I try to run the executables in ...DeveloperKit/Linux-x86-64/PrebuiltExamples/... I get a prompt.

  • $\begingroup$ I don't observe this (10.2, Ubuntu 12.04 and 14.04) - worth noting that the bugs tag is typically reserved until others here have confirmed the same behaviour. $\endgroup$ Oct 9, 2015 at 11:47
  • $\begingroup$ Please give more details, such as how you compiled the code (full command line please). Also try running the executable without Mathematica, and see if it gives you a Create Link prompt. When you respond to this comment, you need to mention my name preceded by a @ character, otherwise I won't receive the response. $\endgroup$
    – Szabolcs
    Oct 9, 2015 at 12:14
  • $\begingroup$ Alerting @Szabolcs since the mention is in the question instead! $\endgroup$ Oct 9, 2015 at 12:47

2 Answers 2


The hang (or wait for a WSTP connection) is due to the WSTP executable not starting. As the "error while loading shared libraries" message indicates, this is because it cannot find its shared library dependencies. This is expected behavior, per the documentation,


This is the dynamic shared library that contains all of the WSTP functions. It should be included in your project. You could copy this library into the same directory as your source files, into a systemwide location such as /lib or /usr/lib, or leave it where it is if you added the WSTP directory to the search path for libraries. The 32/64 indicates whether the library is a 32-bit or a 64-bit version of the WSTP library.

The WSTP prebuilt examples did not depend on finding this library because they are statically linked.

For instance, if .../WSTP/DeveloperKit/$SystemID/CompilerAdditions/ is put on LD_LIBRARY_PATH, the examples would work fine even if using dynamic linking.


Ok, the problem was with the shared libraries. Things started working after I changed the Makefile to statically link to WSTP64i4lib.o. Thanks for the tips.

P.S. This helped: WSTP broken by upgrade to 10.0.1?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.