How to install OpenMp on Mac? - xcode

I tried to install openmp via
brew install llvm
then did symlink libomp.dylib to
usr/local/lib
and added the necessary paths to Xcode, the program started, but immediately raised an exception:screenshot
Also I tried to install OpenMp via:
this
but after unpacking the archive, I did not understand how to set the necessary flags.
Who can help me with this problem? I have Intel MacBook with MacOs Ventura.

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.

what is EXC_BAD_INSTRUCTION (sigill)? Why is it caused?

My application file works fine on my mac, the problem is when i try and install it on client's machine.
In the crash report I see that functions from libfreetype.dylib are causing the crash.
Is it because I have ported an incompatible dylib to client's machine? because when i compiled freetype using brew I used -universal flag.
Both the machines are Mountain Lion.
Your client machine is probably an older hardware.
Brew builds optimised code for your machine's processor by default.
This will result in occasional SIGILL when that code is run on older hardware that doesnt have the newer instruction set used for optimization.
For distrubution, you should:
brew install --build-bottle freetype
for that and any other libraries that you ship from brew

How can I prevent homebrew from upgrading VTK dependency for PCL?

I would like to install the pcl formula through homebrew, which is documented here:
http://www.pointclouds.org/documentation/tutorials/installing_homebrew.php
Unfortunately, homebrew decides it needs to upgrade my VTK installation to the latest release (6.0) even though I have a perfectly working version (5.10.1) installed already. I would like to compile against and link with this existing version. (The minimum VTK version for pcl is listed as 5.6.1, so everything should work fine. I actually manually build pcl and tried to link it against VTK 6.0, which doesn't even work, yet.)
Therefore, my question is, why does homebrew try to upgrade VTK (to an incompatible version) and how can I prevent it from doing this?
All I am calling is: brew install pcl, which triggers this:
==> Installing pcl dependency: vtk
==> Downloading http://www.vtk.org/files/release/6.0/vtk-6.0.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/vtk-6.0.0.tar.gz
This eventually leads to an error, as vtk 6.0 does not compile under Mac OS X 10.9 through homebrew (https://github.com/Homebrew/homebrew-science/issues/401).
To be clear, even if VTK 6.0 would compile fine, I do not want to upgrade, so does anyone know how to prevent homebrew from upgrading a dependent formula?
You can trick Homebrew to think it has Vtk 6.0 installed. For that you have to run this command in a terminal
ln -s /usr/local/Cellar/vtk/5.10.1 /usr/local/Cellar/vtk/6.0.0
When the time comes for you to really want to update vtk, just eliminate that symlink with
rm /usr/local/Cellar/vtk/6.0.0
and let Homebrew do its job.
Homebrew actually has a formula for vtk5 separately now, so this should now be the correct way to install it (currently it's 5.10.1).
brew install vtk5 --with-qt
You also need eigen, flann, qhull and boost. Also useful, but optional is getting sphinx via pip install sphinx if you want docs. If you want to build simulations (see below option) then you need to get glew too (although it wouldn't find the header).
I can verify that this works on 10.8 and will check 10.9 tonight. I've had problems installing 1.7.1 from the archive, but cloning the github repository worked for me.
$ git clone https://github.com/PointCloudLibrary/pcl pcl-trunk
$ cd pcl_trunk
$ mkdir build; cd build
$ cmake .. -DBUILD_global_tests=ON -DBUILD_examples=ON -DBUILD_simulations=ON
$ ./configure; make; make install
Without VTK you can get to a few % before the PCL install fails. Installing VTK with X11 seems to be a recipe for a disaster here, I had to manually install libX11, libXt and others because VTK was trying to include the incorrect headers. The problems continued with OpenGL and I couldn't compile past around 42%. I reinstalled vtk5 without --with-x11 and it compiled fully.
There is a PCL formula for Homebrew knocking around, but it's rarely updated and I didn't have much luck editing it (not familiar enough with Brew's syntax). I tried to update it and submit a pull request, but when it came to testing the actual 'stable' build fails at the moment so there's no point.
EDIT: To be clear, installing the 1.7.1 tarball fails due to some problem with Eigen (around 12% in when compiling pcl_search).
Proposed pull request, it's a HEAD only fix at the moment.
https://github.com/ros/homebrew-hydro/pull/7
Just downgrade to previous version.
1) cd /usr/local/Library/Taps/homebrew-science/
2) brew versions vtk
3) git checkout 27a4327 vtk.rb
4) brew uninstall vtk && brew install vtk

Downgrade or remove GCC 4.8 from Mac OS X Mountain Lion

I am in the process of trying to essentially start from scratch with getting homebrew, GCC and RVM 1.9.3 on to my mac OS x 10.8.2 after determining that my problems with RVM were "related to a messy environment which can not be fixed automatically without what we plan for RVM2" in a thread that began here on SO and ended as a github for ticket RVM.
I had XCode 4.6 with Command Line Tools installed as was recommended here but at this point have completely deleted XCode (by trashing it- due to the version sudo /Developer/Library/uninstall-devtools --mode=all did not work), I uninstalled homebrew by running
cd `brew --prefix`
brew install libtool
rm -rf Cellar
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
and imploded my rvm. However, I am not sure how to go about 'refreshing' my GCC situation. Which is as follows:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-apple-darwin12.2.0
Configured with: ../gcc-4.8-20130113/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.8.0 20130113 (experimental) (GCC)
I have Time Machine backups from various stages of my undoing and made a bootable USB of Mountain Lion but was hoping to try reinstalling a fresh copy of Xcode or running the GCC-10.7 program installer before using either of those methods. However, I don't know if I can or how I would rectify the GCC situation before doing so.
From reading Change to GCC 4.7.., it seems that there might be a way of pointing/directing my system to a different version of GCC, but I don't know how to do that without MacPorts or homebrew.
Is there a way to get rid of the experimental GCC 4.8 so it doesn't come back in the future?
I have run a VM of my system with a copy of /usr/local/ from before I had ever installed XCode CLT or any of these other libraries, but my $ gcc -v still came back with gcc version 4.8.0
Sorry if I omitted and/or added necessary/unnecessary information and thank you in advance for any help.
This is a confusing dump of information. You don't want to use MacPorts or Homebrew? I seriously recommend you go with Homebrew. That should get the latest GCC 4.8 onto OR OFF OF your box with ease. If you can't figure out where your current gcc 4.8 is, try typing "which gcc" and that will tell you where it's located. It's not coming back. Clearly you never removed it if typing gcc brings up gcc. It's probably in /usr/local/opt.
If you insist on wiping out ALL the homebrew stuff manually, you COULD just zap /usr/local/opt to get rid of the symlinks, and /usr/local/Cellar to get rid of the real stuff, but I don't recommend it. Why? Zapping directories by hand could cause you to lose data especially if you're prone to making mistakes. Use MacPorts or Homebrew to REMOVE whatever you used it to install.

Error building Omnet++: Cannot build Tcl/Tk apps on Mountain lion

I'm trying to Compile Omnet++ 4.1 on Mountain Lion. When I type:
./configure
I get the following error:
configure: error: Cannot build Tcl/Tk apps, probably due to misconfigured or missing X11 headers or libs. Check config.log for more info!
I remember compiling it on Lion without any problems, any ideas how to get it working on Mountain Lion?
Found a solution for this over on the omnetpp google group, I'll paste it in here:
Hi all,
just tried Mountain Lion, which was released yesterday. Unfortunately,
the new MacOSX does not include X11 by default. I really HATE this
decision. As a result, it does not pass the Tcl/Tk checks when we do
./configure.
After hours of efforts, I finally figured out how to work around this:
download and install XQuartz at http://xquartz.macosforge.org/landing/
make a symbolic link at /usr/include: sudo ln -s /opt/X11/include/X11 /usr/include
and you are all set. In 2, you may also set some environment variables
accordingly instead of making the symbolic link.
Future OMNet++ releases may consider setting associated environment
variables so that the compiler looks for Xlib.h in
/opt/X11/include/X11 with Mountain Lion.
Just successfully compiled the simulator and haven't encountered other
problems yet.
Have fun,
TS
If you have the same problem on Linux (ubuntu) a solution is run this in the console:
sudo apt-get install build-essential gcc g++ bison flex perl tcl-dev tk-dev blt libxml2-dev zlib1g-dev openjdk-6-jre doxygen graphviz openmpi-bin libopenmpi-dev libpcap-dev
Installing XQuartz is still the solution to overcome this problem.

Resources