sakra / findmathematica Goto Github PK
View Code? Open in Web Editor NEWCMake module for Mathematica.
License: MIT License
CMake module for Mathematica.
License: MIT License
Dear @sakra ,
I've found an issue with FindMathematica
3.3.0 on my Raspberry Pi 3 (Raspbian, based on Debian buster, 32-bit): CMake complains:
Unknown CMake command "Mathematica_ADD_LIBRARY"
I've setup the test repository which shows the setup and the error output here:
https://github.com/Expander/test-FindMathematica
If needed, I can paste more configuration files etc. to trace the issue.
Best regards,
Alexander Voigt
Dear Sascha Kratky,
we are using your FindMathematica
module in to build a MathLink executable for GM2Calc. This works very nicely for all platforms, except Fedora: On Fedora we get a linker error when the MathLink executable (gm2calc.mx
) is created and libuuid
is not installed:
/usr/bin/c++ -O2 -DNDEBUG -rdynamic CMakeFiles/gm2calc.mx.dir/gm2calc.tm.c.o -o ../bin/gm2calc.mx -Wl,-rpath,/usr/local/Wolfram/Mathematica/11.1/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions /usr/local/Wolfram/Mathematica/11.1/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/libML64i4.so -lstdc++ -lm -lpthread -lrt -ldl -luuid ../lib/libgm2calc.a
/usr/bin/ld: cannot find -luuid
It seems, that FindMathematica
does not check that libuuid
is installed on the system, although it links libuuid
to the MathLInk executable.
Probably this can be fixed within FindMathematica
by requiring that libuuid
is installed on the system.
Best regards,
Alexander Voigt
Dear Sascha Kratky,
I'm wondering whether FindMathematica
could also support the "Free Wolfram Engine"?
Personally, for license reason I can currently not use Mathematica and so I'm stuck to the "Free Wolfram Engine".
Interestingly, the "Free Wolfram Engine" provides
math
kernelmcc
compilerMathLink
LibraryLink
and many more. However, it does not provide the classic Mathematica
notebook executable.
Anyway, I guess a support for "Free Wolfram Engine" would in principle be possible and I guess also very useful in general. :)
Best regards
Alexander Voigt
Hello,
I think 12.3.1 was the first macOS Mathematica version with native ARM/Silicon support, and after upgrading to it I get the following error in a program that uses FindMathematica in its cmake-list:
"could NOT find Mathematica_WolframLibrary (missing: Mathematica_WolframLibrary_LIBRARY) (found version "6")
-- Could NOT find Mathematica (missing: Mathematica_WolframLibrary_LIBRARY) (found version "12.3.1")"
After looking in the cmakeCACHE file, I found that it did not find the Wolfram Runtime Library (correct path: "/Applications/Mathematica.app/Contents/SystemFiles/Libraries/MacOSX-ARM64/libWolframRTL.dylib" ),
and the cache file contains the entry
//Last value of Mathematica_SYSTEM_IDS.
Mathematica_SYSTEM_IDS_LAST:INTERNAL=MacOSX-x86-64
which I guess could be problematic. It seems like in most other relevant paths it correctly replaced MacOSX-x86-64 by /MacOSX-ARM64. I will try to fix it by myself, but if you could make FindMathematica compatible with the 12.3.1 version in a clean way, I guess it would be greatly appreciated by many.
On Mac OS X with Mathematica 10 I'd like to statically link my code to libMLi3.a instead of libMLi4.a because libMLi4.a requires also linking to CoreFoundation and seems to introduce a weird performance penalty on startup and shutdown. Setting Mathematica_USE_STATIC_LIBRARIES to TRUE seems to always find libMLi4.a. Is there a way to specifically select libMLi3.a instead?
Dear Sascha Kratky,
a student reported an issue to me when building a LibraryLink library with FindMathematica.cmake
. He uses the following configuration:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
Mathematica version: 10.3
When building a LibraryLink library (Himalaya_LibraryLink.so
), FindMathematica.cmake
links libuuid to the shared library like so:
/usr/bin/c++ -fPIC -O3 -DNDEBUG -shared -o Himalaya_LibraryLink.so CMakeFiles/Himalaya_LibraryLink.dir/source/LibraryLink/Himalaya_LibraryLink.cpp.o -Wl,-rpath,/home/thomas/Promotion/Himalaya/Himalaya-master/build:/home/thomas/Dokumente/Mathematica10.3/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions libHimalaya.so /home/thomas/Dokumente/Mathematica10.3/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/libML64i4.so -lstdc++ -lm -lpthread -lrt -ldl -luuid libDSZ.so
/usr/bin/ld: cannot find -luuid
collect2: error: ld returned 1 exit status
This linking command fails and I believe it is because on this Ubuntu version libuuid is installed in the non-standard directories
/lib/x86_64-linux-gnu/libuuid.so.1
/lib/x86_64-linux-gnu/libuuid.so.1.3.0
/lib/i386-linux-gnu/libuuid.so.1
/lib/i386-linux-gnu/libuuid.so.1.3.0
This issue can be fixed by creating a symlink in /usr/lib/
:
cd /usr/lib/
sudo ln -s /lib/x86_64-linux-gnu/libuuid.so.1.3.0 libuuid.so
But I believe a better solution would be to let FindMathematica.cmake
search for libuuid and add its proper path to the linking command.
With best regards,
Alexander Voigt
When using ${Mathematica_MathLink_LIBRARIES} cmake selects the following mathlink library /Applications/Mathematica.app/Contents/SystemFiles/Links/MathLink/DeveloperKit/MacOSX-x86-64/CompilerAdditions/AlternativeLibraries/mathlink.framework/mathlink in Mathematica 10.3. Unfortunately this library is linked against a non existing library /Volumes/Jenkins/workspace/MathLink.MacOSX-x86-64.release/scratch/CMake.build/lib/mathlink-libc++.framework/Versions/4.25/mathlink-libc++, which subsequently leads to a error when using the compiled executable.
A solution could be to use the library under /Applications/Mathematica.app//Contents/Frameworks/mathlink.framework/mathlink.
Dear @sakra ,
a colleague of mine stumbled upon the issue with missing libuuid
again.
He has an Ubuntu machine with Mathematica 12. On this machine the package uuid-dev
is not installed, so libuuid
is not installed on the system.
When he calls find_package(Mathematica COMPONENTS MathLink)
, he gets an error message of the form:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Mathematica_uuid_LIBRARY (ADVANCED)
linked by target "gm2calc.mx" in directory /home/pathron/software/GM2Calc/src
If I interpret the error message correctly, it seems that the command
find_library (Mathematica_uuid_LIBRARY uuid)
inside FindMathematica.cmake
fails to find libuuid
on his system. In this case the variable Mathematica_uuid_LIBRARY
is set to NOTFOUND
. However, the script just continues without checking if libuuid
has been found.
If my interpretation is correct, then a possible fix would be to raise an error if libuuid
has not been found.
Many thanks in advance and best regards,
Alexander Voigt
P.S.: This issue has been found when running cmake
in https://github.com/GM2Calc/GM2Calc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.