Weird segmentation fault in python3 after updated to MAC OS X Mavericks - md5

I've updated my system to OS X Mavericks, just now when I tried to use hashlib module a strange Segmentation fault Raised. I've tried to rebuild the python3.3.2 and reinstall it again but it didn't help. So how could I fix this annoying problem? The out put looks like below:
ZZ:Python-3.3.2 zhangzhao$ python3
Python 3.3.2 (default, Oct 28 2013, 16:27:26)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> a = hashlib.md5()
Segmentation fault: 11

There are known problems with Python 3.3.2 and Mavericks. Please try Python 3.3.3rc1 as this may fix thes problem:
This release fully supports OS X 10.9 Mavericks. In particular, this
release fixes an issue that could cause previous versions of Python to
crash when typing in interactive mode on OS X 10.9

I had the same problem & found the answer here: python3 segmentation fault on osx mavericks
------>
This problem exists because of this bug: http://bugs.python.org/issue18458.
Basically, Python has code in Modules/readline.c that contains a workaround for a bug in libedit, however the bug in libedit was fixed and Mavericks comes with the new version of libedit and the workaround now causes ython to segfault. The quick and dirty fix is to disable deadline processing by running the following command (from the bug document):
curl -O http://bugs.python.org/file32324/patch_readline_issue_18458.sh
openssl sha1 patch_readline_issue_18458.sh
# the digest should be 7cb0ff57820a027dd4ca242eb2418930f8f46b4c
sudo sh ./patch_readline_issue_18458.sh
<------------

This same problem happens with both Python2.7.5 and python3.3.2 for OSX Mavericks 10.9. It was driving me nuts. I couldn't even assign and then invoke a simple variable without crashing the interpreter.
>>> a = 7
>>> a
Segmentation fault: 11
It is bug discussed at issue18458
The patched versions for OSX Mavericks can be found below for Python 2 and 3 respectively.
http://www.python.org/download/releases/2.7.6/
http://www.python.org/download/releases/3.3.3/

Related

Macos Ventura, #error SDL for Mac OS X only supports deploying on 10.7 and above

I just updated to Macos Ventura, however when I try to compile my project which was compiling cleanly before I updated, I get the below error message. Here is one of the outputs of the error message:
In file included from /opt/homebrew/include/SDL2/SDL_config.h:33,
from /opt/homebrew/include/SDL2/SDL_stdinc.h:31,
from /opt/homebrew/include/SDL2/SDL_main.h:25,
from /opt/homebrew/include/SDL2/SDL.h:32,
from ../include/gfc_audio.h:4,
from gfc_audio.c:4:
/opt/homebrew/include/SDL2/SDL_platform.h:112:3: error: #error SDL for Mac OS X only supports deploying on 10.7 and above.
112 | # error SDL for Mac OS X only supports deploying on 10.7 and above.
| ^~~~~
Also I am using gcc-12 from homebrew and reinstalled gcc and sdl if that helps.
So after some research, according to this github issue, XCode 14.1 has not been released and is still in release candidate state. After the release of XCode 14.1 it should be working fine.

In C, how do I install GL/glx.h , GL/gl.h and GL/glu.h on Mac OS

I have some code which includes the headers GL/glx.h , GL/gl.h and GL/glu.h . I do not even know what these are, and Google is not a lot of help because there is so much noise in the search results. So (optionally) what are they, but more importantly, how do I install them on a Mac (Mac OS 10.15.4). I have installed other stuff using homebrew so that would be my preference.
EDIT: By renaming the headers to OpenGL/glx.h etc, I can now find gl.h abd glu.h but not glx.h.
This answer openGL glx.h missing form xcode 4 mac lion says "If you install XQuartz you get X11 which has glx.h" but this is not correct, at least not for me. I have installed xquartz using brew, but still cannot find glx.h.
Another site suggested installing Xcode, which I did, but that does not contain glx.h either.
Installing xquartz fixed it. OpenGL (at least the versions I found) is insufficient because it does not include glx.h. The page xquartz.org says, "The XQuartz project is an open-source effort to develop a version of the X.Org X Window System that runs on OS X. Together with supporting libraries and applications, it forms the X11.app that Apple shipped with OS X versions 10.5 through 10.7."
So I downloaded and installed xquartz, and then compiled with -I/opt/X11/include instead of -I/usr/X11R6/include, and linked with -L/opt/X11/lib instead of -L/usr/X11R6/lib; as suggested at fatal error 'GL/glx.h' file not found on mac after Xquartz is installed ; and it all worked.

Debuging C on Mac OS Sierra

I currently have Mac Sierra 10.12.3 and I had the surprise that Valgrind is not compatible despite their latest version.
valgrind: mmap-FIXED(0x0, 253952) failed in UME (load_segment1) with error 12 (Cannot allocate memory).
I wanted to know if there was a solution to solve this problem or another debugger (gdb does not work either).
I prefer not to use XCode because I like to program with a terminal.
Thank you
Use LLDB as described in this article http://www.developerfiles.com/debugging-c-with-clang-compiler-and-lldb/

Unable to run c/c++ code on OS X 10.9

For some time now I have been unable to run c or c++ code on my Mac running OS X 10.9. See my earlier post for details on what I tried to do about this originally some time ago:
In Xcode running such code gives me the error: "clang: error: linker command failed with exit code 1 (use -v to see invocation)", which leads me to believe that it is some problem with clang symlinking to gcc, but I am not sure. I have already tried reinstalling OS X to no avail. Is there a way that I could reset everything related to running c/c++ code short of doing a clean install of OS X and manually restoring my files and apps? This has become very frustrating and it seems that there are no answers! Thanks.

MacOS compile from Mavericks Lion compatible executable

Since I updated to Mavericks my C app, compiled in my machine with clang, cannot be executed in Lion machines (yep, there are some people who have not updated). It throws
Segmentation fault: 11 error
I've read about stdlib option in this thread but it seems it only applies to clang++ and not to plain clang. Is there a similar option for clang? I've searched for --stdlib=libstdc in google but all results are for --stdlib=libstdc++
To compile an app for OS X 10.8 (Lion), you have to set the "Deployment Target".
The corresponding command line option for clang is
-mmacosx-version-min=10.8
You might also want to set the SDK to 10.8, to avoid that any library functions are used that are available only in 10.9:
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
I'm not sure the intent of the question, but Lion is actually 10.7, Mountain Lion is 10.8. Obviously, you wouldn't want to set the deployment target to 10.8, if you were targeting Lion (10.7). Both the previous comments and answer are conflicting in that regard.
*Note: I can't comment on them, as I don't have enough rep!

Resources