Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OSX - Getting Segmentation Faults on every C++ Program (Even Hello World) after Yosemite Update

I recently just upgraded to OSX Yosemite on my Mac and while I'm not sure if this is the cause, it does seem suspicious that suddenly all of My C++ Programs throw a Segmentation Fault.

I even tried the basic of all basic "Hello World" programs and I still get a Segmentation Fault. Literally, every single C++ program does the same.

#include <iostream>

using namespace std;

int main()
{
   cout << "Hello World" << endl;
}

I installed the Xcode updates to see if that would remedy the situation but no luck. I'm curious, is anyone else out there having the same problem? Regardless of Yosemite, have you had this problem where your Mac throws Segmentation faults for everything?

I should add, I'm compiling with g++

like image 269
carbon_ghost Avatar asked Oct 25 '14 13:10

carbon_ghost


1 Answers

After a few more tries I have found a workaround from here:

http://lists.gnu.org/archive/html/libtool-patches/2014-09/msg00002.html

Simply

setenv MACOSX_DEPLOYMENT_TARGET 10.9

or

export MACOSX_DEPLOYMENT_TARGET=10.9

Happily works after that. However, proper bug fixes should be forthcoming from libtool, so watch the progress there.

like image 73
Salvatore Rappoccio Avatar answered Nov 14 '22 16:11

Salvatore Rappoccio