carbon_ghost
carbon_ghost

Reputation: 1124

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++

Upvotes: 8

Views: 16812

Answers (2)

Ahmed Nawar
Ahmed Nawar

Reputation: 1325

My g++ version is (MacPorts gcc47 4.7.4_5+universal) 4.7.4

I ran sudo port selfupdate followed by sudo port upgrade outdated

This worked for me

also you can run launchctl setenv MACOSX_DEPLOYMENT_TARGET 10.9 to make it permanent.

Upvotes: 0

Salvatore Rappoccio
Salvatore Rappoccio

Reputation: 131

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.

Upvotes: 11

Related Questions