Glut Error on Mac with Haskell Program - macos

I am trying to run a Haskell program which has to use GLUT (to draw shapes) but I get this error message :
*** Exception: user error (unknown GLUT entry glutSetOption)
My program works and GLUT lauches when I run it on Linux
So I only get this problem from my Mac..

As user2141650 suggested in a comment, this seems to be caused by a discrepancy between the default macOS GLUT and freeGLUT. Since version 2.7.0.12, Haskell GLUT automatically picks freeGLUT if it's installed. Here's how I managed to install freeGLUT:
Install XQuartz:
brew cask install xquartz or
install the .dmg from xquartz.org.
brew install freeglut
After I installed XQuartz and freeGLUT with brew, my program still couldn't open the display. As suggested in this Reddit thread, I did the following:
launchctl load -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
restarted my computer
Maybe the launchctl command would have been enough, or maybe restarting the computer would have done it, or maybe all that isn't necessary if you install XQuarts using the .dmg file. I don't know. Good luck!

Related

cannot run gdb on mac's terminal even after codesign

I'm trying to install gdb on my Mac. I downloaded it with brew and code signed it according to the instructions on https://sourceware.org/gdb/wiki/BuildingOnDarwin
However, when I run gdb in the terminal, it still doesn't work and output the following error message:
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.6.dylib
Referenced from: /usr/local/bin/gdb
Reason: image not found
Trace/BPT trap: 5
Does anyone know what it means? My Mac version is 10.11.5, by the way
I ran into the same issue on macOS 10.11.6, I'm guessing (and this is just speculation; I don't actually know how Homebrew works) that Homebrew installed a pre-compiled version of gdb which depended on a library that existed on the machine it was compiled with, but did not exist on my machine.
At any rate, I was able to get a working version of gdb by downloading & unzipping version 7.12 (8.1 failed to compile on my machine) from http://ftp.gnu.org/gnu/gdb/gdb-7.12.tar.gz, then compiling & installing with (IIRC) the commands:
./configure
make
sudo make install
I blogged about this and the subsequent steps (getting the executable code-signed so that macOS would allow it to debug other processes, etc) here: http://prust.github.io/posts/2018-02-24-interactively-debugging-c-in-sublime-text-3.html
I get this problem too. And I find solution in https://qiita.com/yoshixj/items/698d94337ca447e9b9de
Since we don't have /usr/local/opt/mpfr/lib/libmpfr.6.dylib
we can simply install it. Use this command:
brew install gawk
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
I had the same error message when running gdb after installing it from Homebrew (gdb v8.1) on a Mac OS X El Capitan v10.11.6. However, installing it via Homebrew using its Python binary solved the issue:
brew install gdb --with-python
Beaware that this may take some time, since you'd be compiling gdb from scratch. After it's done, you still need to create a certificate and codesign gdb.

How to install gdb on MacOS terminal Sierra

I searched online about how to install gdb on macOS Sierra 10.12.2 but failed on the methods I could find. Then I figure out the following way which is easy and works fine on my machine. hope it may help you too:)
download the most recent GDB from https://www.sourceware.org/gdb/download/
expand the gdb-7.12.1.tar.xz file: tar xopf gdb-7.12.1.tar.xz
cd gdb-7.12.1 in terminal to open the gdb folder
then follow the instructions in the README file in the gdb folder, or simply follow the following steps:
./configure, wait for the terminal
make and wait again (which can take some time)
sudo make install
Now gdb is installed at /usr/local/bin/
Note that you might want to try/use LLDB (lldb) instead. This is now the default (don't know about 10.12, but on 10.13 it is installed, when you install the Xcode utilities). It even comes with a nice curses GUI, but otherwise a shell very similar to GDB.
You can also use homebrew to get gdb in mac os:
install-gdb-macos-sierra
Surprised no one mentioned:
brew install gdb
How to install brew?

How to install MATLAB 2012b Mac OSX 10.9.2?

I'm trying to install MATLAB 2012b on my mac OSX 10.9.2 but when I run the installer I get the message:
"You can’t open the application “InstallForMacOSX” because PowerPC
applications are no longer supported".
Is there anyway I could install the software?
Try to install XQuartz. Upgrading to Matlab R2014a will not do the trick, because you will have to go through the same process (however, Matlab 2013a does not need XQuartz installed strangely enough).

Install wxpython on mac

I am new to Mac, have always used windows and I am confused on how to install wxPython. I downloaded the .dmg file from the website, and it contained three files:
a pkg file, a readme, and an uninstall.py
I opened the pkg file, went through the steps, and Im not sure where it installed after it said "Installation Complete"
Also, I did the import wx in idle, which caused a stacktrace error.
Thanks.
From personal experience on installing wxPython on both Windows 7 and Mac OSX, I found restarting the computer helps out after installation and stacktrace errors appearing in the Shell upon 'import wx'. Sounds simple enough, but it worked for me. If no errors appear after 'import wx', that means wxPython installed correctly. To add to bouke's answer above, the current way to install Python 2.7 via homebrew in Terminal:
brew install python
To install wxPython:
brew install wxpython
At least for development, I would suggest to install (python and) wx using homebrew. It will install version 2.9 and you're ensured that Apple-provided system libraries remain untouched.

CMake 2.8.10 installation for mac os x fails creating symlinks

I am updating Cmake in my Mac Book pro with OS X Lion 10.7.5. The old version of Cmake is 2.8.8 and the new one is 2.8.10. When I run almost to the end of the installation process, the installer prompts
for creating a Symlink to /usr/bin of several tools. After click on continue, the installer throws an exception telling that couldn't create symlinks. Previously of the process, I've moved to trash the old version of Cmake and then using finder I got nothing more files of Cmake on the machine. Any idea how Can I complete the installation succesfully?
In my case, attempting to install cmake 2.8.12 on OSX 10.8.5 failed. The cmake-2.8.12.2-Darwin-universal.dmg installer downloaded directly from cmake.org would hang while running the post install scripts. I found and removed all the symlinks described by willyMon, but it still would hang, requiring me to resort to ps + kill to unhang the installer.
For me, installing via brew did the trick:
brew install cmake
It installed 2.8.12.2 in /usr/local/bin without a hitch.
Opening the Applications folder in a terminal
cd /
cd Applications/
then doing:
sudo bash
CMake.app/Contents/bin/cmake-gui
Then run from the CMake GUI:
"Tools->Install For Command Line Use"
works OK for me.
Ok, after looking in deep for this error, I found that I missed some simple detail and this was the key to solve the problem. The Cpack installer of Cmake 2.8.10.1 try to create symbolic links to this files:
-cmake-gui
-cmakexbuild
-cmake
-cpack
-ctest
So, from a terminal I've removed all the previous Symlinks that the older version created, then I ran the installer again and the installation was done succesfully without any errors or warnings.

Resources