Macaulay2 » Documentation
Packages » Macaulay2Doc > getting started > teaching M2 how to find its shared libraries
next | previous | forward | backward | up | index | toc

teaching M2 how to find its shared libraries

Perhaps you know that your M2 executable is located at /foo/bar/bin/M2, say, but when you run it, you get something like this:
    /foo/bar/bin/M2
    M2: error while loading shared libraries: liblapack.so: cannot open shared object file: No such file or directory
What that means is that M2 hasn't been told where its shared libraries are. Actually, it's the operating system that has to be told, since otherwise M2 can't even start up. Hopefully, the missing shared libraries are located in /foo/bar/lib, and all we have to do is to tell the operating system by setting the environment variable LD_LIBRARY_PATH, if you are running a Unix operating system. If you have downloaded a version of Macaulay2 that comes with dynamically loaded libraries of its own, they will be in the directory /foo/bar/lib/Macaulay2/lib/lib/. After setting LD_LIBRARY_PATH temporarily you may use setup to record the correct value in your system start up files.

Alternatively, you may be getting something like this:

    $ /foo/bar/bin/M2
    dyld: Library not loaded: /capybara/lib/libgmp.3.dylib
      Referenced from: /foo/bar/bin/M2
      Reason: image not found
    Trace/BPT trap
That would mean that you are running under Mac OS, and the suggestion above would not apply. On such systems, Macaulay2 must be installed in the system application folder, or Macaulay2 will not be able to find its libraries.