Mathematica won't find SerialIO package - macos

I'm following a guide from The Mathematica Journal that describes how to use Mathematica with the Lego Mindstorms NXT. I have some trouble getting started and got stuck with the SerialIO package.
I use Mac OSX and I have installed the package to:
/Applications/Mathematica.app/AddOns/ExtraPackages/SerialIO/
The command Needs["SerialIO`"] gives me the following error message:
LinkOpen::linke: Could not find MathLink executable.
And trying
SetDirectory[FileNameJoin[{$InstallationDirectory, "AddOns", "ExtraPackages", "SerialIO", $SystemID}]];
Does not help either, it gives:
SetDirectory::cdir: Cannot set current directory to /Applications/Mathematica.app/AddOns/ExtraPackages/SerialIO/MacOSX-x86-64.
There seem to be some problem with the alias/symbolic link in the SerialIO folder. By default they pointed to an absolute directory on the machine that this library was built on:
MacOSX-x86-64 -> /Files/schofield/Packages/SerialIO/Build/Mac/build/Deployment/Package/SerialIO/MacOSX
I tried deleting the alias and creating a symbolic link in the terminal:
ln -s MacOSX MacOSX-x86-64
Running the SetDirectory command again result in... no result, so I guess thats good. The commands seem to have been loaded as when typing Serial it want to autocomplete to SerialOpen etc.
However, using the command mybrick = SerialOpen["name of serial port"] does not put the NXT in connected mode (<> on NXT display). Does anyone else got it to work?

There was a problem in SerialIO in combination with Mathematica9. After some correspondence in may 2013, Wolfram Support find the problem and updated SerialIO for me. It seems logical that they also update SerialIO on their site. Please have a try and download SerialIO again and update. My OS is MaxOSX.

Related

Compilation fails using Chapel on a mac

Using a stock install of Chapel (via Homebrew) on a Mac running Big Sur. Tried to compile one of the example programs:
chpl /usr/local/Cellar/chapel/1.27.0/libexec/examples/hello.chpl
followed with
mv: rename /var/folders/81/9s9zv6450td9kgh_znllq52000037c/T//chpl-username.deleteme-nJkMMc/hello.tmp to hello: No such file or directory
error: mv /var/folders/81/9s9zv6450td9kgh_znllq52000037c/T//chpl-username.deleteme-nJkMMc/hello.tmp hello
error: Make Binary - Linking
Looks like a simple fix, but would appreciate suggestions. (And annoyingly, am trying to (eventually!) do a local compile of a package I contributed to)
R.
As noted and verified in the comments above, this seems to have been a recently discovered issue in our code base that can be worked around in homebrew for the time being by doing a brew update. It ought to be fixed in a more principled manner in Chapel 1.28.0 and onwards. If others see this failure mode going forward, please consider opening a GitHub issue on the Chapel repository so that we can help you work through it.

openfoam v2006 wsl2 ubuntu 20.04 GLIBCXX_3.4.26 not found

Since I installed according to the guide here on wsl2 ubuntu 20.04, I've been having errors related to libstc++.so.6, specifically GLIBCXX_3.4.26 not found (required by ...) where ... refers to different files within /opt/OpenFOAM/ThirdParty-v2006/platforms/linux64/gcc-6.3.0/lib64/ ending in .so, .so.1, .so.6 and so on (for instance, when running paraFoam the error would appear with respect to about 20 such files). I am able to successfully visualize the cavity tutorial (in paraview installation on windows).
I could get the errors to go away by doing what the user laborg suggested on Jan 4 for a similar problem with julia (see here), specifically copy libstdc++.so.6 from /usr/lib/x86_64-linux-gnu to /opt/OpenFOAM/ThirdParty-v2006/platforms/linux64/gcc-6.3.0/lib64/.
The questions is whether this copy-paste solution is recommended; will it come back and haunt me later? Is the libstdc++.so.6 from system installation going to be an issue if used in the lib64 folder of openfoam?
An additional info concerning openfoam installation, foamInstallationTest shows *not installed* errors against flex, wmake, gcc, g++, icoFoam and *critical error* for gcc, g++, icoFoam; but I as given here, foamInstallationTest is not meant for installation from the tar file. Openfoam installation seems to be alright based on the running of the cavity tutorial.
ok, please don't do copy past operation to solve this problem. The error means that you haven't installed the pre request libraries in your ubuntu. It seems that you have missed the first step in the tutorial.
It is not recommended but it will not hurt as long as the GLIBC versions returned from this command
strings /opt/OpenFOAM/ThirdParty-v2006/platforms/linux64/gcc-6.3.0/lib64/libstdc++.so.6 | grep GLIBC
are a subset of the GLIBC versions from this command.
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC
which was no doubt the case for your Ubuntu setup.
A less risky route would be to redirect the soft link /opt/OpenFOAM/ThirdParty-v2006/platforms/linux64/gcc-6.3.0/lib64/libstdc++.so.6 to point to your other libstdc++.so.6 (that way you retain both versions)
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/OpenFOAM/ThirdParty-v2006/platforms/linux64/gcc-6.3.0/lib64/libstdc++.so.6
Then, if you hit an issue, you can always reset the link back to its original target. Of course /usr/lib/x86_64-linux-gnu/libstdc++.so.6 is itself a soft link, but you can point to it all the same or you can point to its target.
I believe the issue you are hitting is a derivative of the one mentioned here https://www.cfd-online.com/Forums/main/229027-persistence-glibcxx_3-4-26-not-found.html, which would point towards the fact that it is not an installation error on your part but an issue related to the packaging of the OpenFoam binaries. I agree it would screw up the wsl2 setup owing to the way OpenFoam prepends everything to paths. Of course the safest route is to compile from source using the Ubuntu system's gcc and thereby bypass the ThirdParty.
Seeing as you are using Ubuntu in the WSL instance, could also just install the Ubuntu package directly:
https://develop.openfoam.com/Development/openfoam/-/wikis/precompiled/debian
This problem comes from this line in the tutorial:
echo "source /opt/OpenFOAM/OpenFOAM-v2012/etc/bashrc" >> ~/.bashrc
This will point to OpenFOAM's libstdc++ everytime you open a terminal (or start a WSL2 session). If your workflow is not related to OpenFOAM, that can be an issue. If you remove or comment that line in your ~/.bashrc things should get back to normal. You can use nano in WSL2.
nano ~/.bashrc
Then comment:
#source /opt/OpenFOAM/OpenFOAM-v2012/etc/bashrc
However, as OpenFOAM uses that bashrc, you will need to source the OpenFOAM bashrc in each terminal before using openFOAM.
source /opt/OpenFOAM/OpenFOAM-v2012/etc/bashrc
My personal choice is to keep that line commented and, if I have a long work session using OpenFOAM, I just use nano to uncomment it, so every shell that I open works without sourcing again.
There are more elegant or complex approaches, but I prefer this one.
This answer should be valid with the 2006 version too, the link you shared points to 2012, so I guess they just updated the tutorial. If you installed 2006, just make sure when you source comment/uncomment to use the correct name.
In the same manner, if you followed another tutorial with another tool and sourced another library, you may experience issues.
Just start by taking a look at your bashrc and cleaning it.

How to use MySQL-Connector-C++ in a brew environment in Sierra?

I have been trying to test a code to connect to MySQL using C++ on a MacBook Pro, but I always get an error about boost/filename.hpp not found. I fix that by adding a full path on e.g. /usr/local/boost_1_64_0/boost/filename.hpp.
This fixes an error for one #include, when I compile again I get the same error on another line.
It will take me forever to do that (correcting the path all the time). I then downloaded MySQL-Connector-C++ using brew - which is now located at /usr/local/Cellar/mysql-connector-c++/1.1.9/.
Within the Cellar folder there are boost, mysql, openssl directories.
Can anyone please tell me how I can use this to test my code, run a simple query, and where do I put my c++ file I've created and need to compile?
I have written the code but I can't test it, it's private and for an organization which gave me the task.
I have been trying to figure out how to avoid correcting paths for more than three days now, followed all the instructions from the manual from the MySQL website.

Xlib.h not found when building graphviz on Mac OS X 10.8 (Mountain Lion)

When using homebrew to install graphviz, the script gets to the point of "Making install in tkstubs" and then throws the following fatal error:
In file included from tkStubLib.c:15:
/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
I have installed XQuartz as X11 has been dropped in Mountain Lion, but I'm unsure if it is installed correctly. The location of Xlib.h is:
/opt/X11/include/X11/Xlib.h
There are also two symlinks to /opt/X11, they are:
/usr/X11
/usr/X11R6
Does this look like the correct setup to you? I've never dealt with X11 or XQuartz until yesterday.
Cheers.
After installing XQuartz you may add a symlink to your X11 installation folder by just entering
ln -s /opt/X11/include/X11 /usr/local/include/X11
in terminal. That will fix the problem as well without changing any ruby script.
You need to tell the tkstubs build (and possibly other bits in the package as well) to look for headers in /opt/X11/include; this is not on the standard include path.
Usually this is achieved by passing -I/opt/X11/include as an additional compiler flag, the method to do so is however dependent on the build system.
For reasonably modern configure scripts, the best approach is to pass it in the environment variable CPPFLAGS; if the package uses another build system or this doesn't work for another reason, then you need to look at the Makefile in the build directory.
You can enter in your shell before the compile/link (or brew) command:
export CPPFLAGS=-I/opt/X11/include
The export line will tell the compile/linker to look in /opt/X11/include for the X11 include files
Had the same issue and running this command on terminal
xcode-select --install
worked for me. Run this command after installing xQuartz.
If you need this to work in your CMake builds:
if(APPLE)
include_directories(AFTER "/opt/X11/include")
endif()
That worked well for me.
I got it to install by copying the x11 header file directory to the /opt/local/include directory. Probably not the best way to work around it but quick and easy.
I found this thread while trying to compile ffmpeg from source on OS X. I needed --enable-x11grab and the homebrew build does not support this option.
I had XQuartz installed already but I kept getting errors from ./configure: ERROR: Xlib not found. I thought the answers here would solve my problem, but they did not!
So, if anyone is ever in the same boat, my solution was this:
I opened up the generated config.log and found lots of errors referring to various includes and header files, including X11/Xlib.h - this is misleading. At the very bottom of the logfile was the key, pkg-config was complaining about looking for xbc.pc, and requested that it be put on the path. However, the error message that is displayed on the terminal says nothing about pkg-config or xbc!
The solution is to add to your PKG_CONFIG_PATH environment variable. Mine was nonexistent, so I just did export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/ (the folder where I found xbc.pc).
I reran configure and everything worked like a charm!
TL;DR: check config.log - don't trust the terminal output!
Since the make file is looking for X11/xlib.h i.e., it is looking for X11 folder in the current directory, one way to solve this problem is to simply copy the /opt/X11/include/X11 directory to the directory that contains make file.

Problem with Zend Framework Quickstart Tutorial and version 1.8.2

I'm trying to work through the quick start tutorial of the Zend Framework version 1.8.2, but I'm getting an error when running this code:
zf.sh create project quickstart
error: expecting `'{'' in /Users/andrew/Sites/_library/ZendFramework-1.8.2/library/Zend/Tool/Framework/Client/Console.php on line 63
I'm doing this on Mac OS X 10.4. Is there an error in Zend Tool? or am I doing something wrong? Or is my environment not set up correctly to run this script?
I tried this on my other computer and got
-bash: zf.sh: command not found
I think this one is a separate problem, but not sure what to do
to the second problem:
$ chmod +x zf.sh
or place it to /usr/bin (or where the other executables lives, don't know where it is in OS X)
or use
$ sh ./zf.sh
first problem:
which PHP version do you use? The problem exists maybe at multi interface implementation.
you can still manually create the folder structure that Zend_Tool does, the quickstart guide does give examples of the naming conventions and there are numerous other examples. in order to better understand the framework, doing this manually can be good since your forced to think about the files your creating and how they are used.

Resources