How to make a clean installation of OpenSSL - macos

I'm afraid I have made a mess with the version (0.9.8zg) of OpenSSL which was installed on my Mac. While I was trying to update it, now I have some error and for some reasons applications like Apache or Google Drive do not work anymore and they don't even start.
I would like to know which would be the best way to restore openssl to a working version without re-installing the whole operating system.
How can I do that?
Up to know I have tried to download openssl-0.9.8zg and build it with ./config, make and make install but it did not solve the problem.
Please help me if possibile
Some command outputs:
$ file /usr/lib/libssl.0.9.8.dylib` --> `/usr/lib/libssl.0.9.8.dylib: Mach-O 64-bit dynamically linked shared library x86_64`
$ otool -L /usr/lib/libssl.0.9.8.dylib`--> `/usr/lib/libssl.0.9.8.dylib:
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/Cellar/openssl/1.0.2d_1/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)`
The output of nm /usr/lib/libssl.0.9.8.dylib is here.

Related

Ruby Bundler sqlite3 extension dependency on local libruby in user's folder

OS: macos with brew
Ruby version manager: rbenv
I am using bundler (2.1.4) to deploy my application with all the required gems.
I am currently on Ruby 2.2.4 and trying to update to Ruby 2.5.5. I am also updating the various gems to the latest versions.
I am having an issue with bundler introducing a dependency for compiled extensions on libruby.2.5.dylib. This library is in the local .rbenv folder in the local user's folder. This is causing the application to fail when it is launched on other users' machines because of course this file is not available.
Interestingly this was not happening with the previous version of Ruby (2.2.4). If you take sqlite3, for example, I have the following.
Ruby 2.2.4 and sqlite-ruby 1.3.13
otool -L /Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/sqlite3-1.3.13/sqlite3/sqlite3_native.bundle
/Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/sqlite3-1.3.13/sqlite3/sqlite3_native.bundle:
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 308.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
Ruby 2.5.5 and sqlite-ruby 1.4.2
otool -L /Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.5.0/extensions/x86_64-darwin-19/2.5.0/sqlite3-1.4.2/sqlite3/sqlite3_native.bundle
/Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.5.0/extensions/x86_64-darwin-19/2.5.0/sqlite3-1.4.2/sqlite3/sqlite3_native.bundle:
/Users/dev-user/.rbenv/versions/2.5.5/lib/libruby.2.5.dylib (compatibility version 2.5.0, current version 2.5.5)
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 308.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
As you can see, there is now a dependency on
/Users/dev-user/.rbenv/versions/2.5.5/lib/libruby.2.5.dylib (compatibility version 2.5.0, current version 2.5.5)
that of course it is not available on other machines. This behaviour is common to all compiled gems (I have 5 of them).
I was hoping that bundle package would help, but I have the same results if I run it before bundle install.
Any idea on how I can remove this dependency or any other alternative solution?
When you compile Ruby you can pass --enable-load-relative flag to ./configure to remove (some?) of the absolute paths from compiled binaries. This might affect extensions also.

Curl not working! dyld: Library not loaded: /usr/local/lib/libidn.11.dylib Reason: image not found

I've looked at what may be a useful answer at Library not loaded error (libidn.11.dylib) when trying to install Homebrew.
However, I don't remember ever having purposely installed MacPorts. Also, do not want to remove anything before I better understand what I would be doing.
Can anyone help me fix this without potentially doing damage.
snapshot from my console
Another snippet from console:
Jonathans-MacBook-Pro-2:bin JonMac$ pwd
/usr/local/bin
Jonathans-MacBook-Pro-2:bin JonMac$ brew install libidn
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 26: /usr/local/Library/brew.rb: Undefined error: 0
Jonathans-MacBook-Pro-2:bin JonMac$
Console log trying alvits' suggestions:
Last login: Mon Jul 18 18:10:39 on ttys002
Jonathans-MacBook-Pro-2:~ JonMac$ otool -L /usr/local/bin/curl
/usr/local/bin/curl:
/usr/local/lib/libcurl.4.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/local/lib/libidn.11.dylib (compatibility version 18.0.0, current version 18.11.0)
/usr/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
/usr/local/ssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/ssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.4.0)
/usr/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
Jonathans-MacBook-Pro-2:~ JonMac$ cd /System/Library/Frameworks/Ruby.framework/Versions
Jonathans-MacBook-Pro-2:Versions JonMac$ ls
2.0 Current
Jonathans-MacBook-Pro-2:Versions JonMac$
The curl installed as part of your PHP installation is missing a
library that it expects, for some reason.
You'll probably want to delete these PHP installs from /usr/local, as
chances are that they will interfere with future installs of software
through Homebrew, but that's up to use.
Try explicitly using the OS X provide curl in /usr/bin/curl.
Based on this response

Python segmentation fault 11 on OpenNI module import -- issues with Homebrew boost and python?

I am running a homebrew version of python on OSX 10.9: Maverick.
Short version:
I am experiencing a Python segmentation fault 11 when I try to import an OpenNI module into python. I have tried renaming my readline.so file as suggested in the link below, so I am assuming this is a different problem:
Python crashing when running two commands (Segmentation Fault: 11)
I am wondering if this might be an issue with my homebrew boost install not linking to the correct version of python. Though I cannot seem to fix it and very well may be barking up the wrong tree.
Very long version:
I've been trying to to install the PyOpenNI python module following directions from this site:
http://www.justinfx.com/2012/06/21/getting-started-with-xbox-360-kinect-on-osx/
Instead of manually installing OpenNI, NITE, and the Sensor Kinect drivers as specified on that link, I used brew versions I found here:
https://github.com/totakke/homebrew-openni
Everything seems to have worked fine until I reached the last step, installing PyOpenNI. I ran into a CMake error when creating the make file; it did not find the OpenNI library and include directories. I manually put these in the CMakeCache.txt file and installation seemed to work fine after that.
Once I tried to to import the openni module in a python shell, I got:
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
Googling this for a bit, some people suggested it was a Boost error, having installed to the Mac build of Python instead of the Homebrew version.
Homebrew + Python on mac os x 10.8: Fatal Python error: PyThreadState_Get: no current thread importing mapnik
Running otool -L $(brew list boost | grep 'python.*.dylib') output suggested this was the case:
Line of interest:
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
Full output:
/usr/local/Cellar/boost/1.55.0/lib/libboost_python-mt.dylib:
/usr/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/local/Cellar/boost/1.55.0/lib/libboost_python.dylib:
/usr/local/lib/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
I uninstalled boost and reinstalled it with brew install boost --build-from-source
Funny thing is, after installing, it gave this warning:
The Boost bottle's module will not import into a Homebrew-installed Python.
If you use the Boost Python module then please:
brew install boost --build-from-source
which is obviously funny since I just did that. Running otool again:
Line of interest:
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
Full output:
/usr/local/Cellar/boost/1.55.0/lib/libboost_python-mt.dylib:
/usr/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/local/Cellar/boost/1.55.0/lib/libboost_python.dylib:
/usr/local/lib/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
So now it seems to point to a different python framework directory, but seems like it is still not the Homebrew python framework directory.
Am I correct in this assessment that boost is still not linking to the homebrew version of python? Could this be causing the Segmentation fault 11, or is that caused by something else entirely?
I know the answer is late but it might be helpful to someone as it was to me. Apparently the solution to this was posted by akakcolin as an answer to one of the issues related to PyOpenNI on Github.
Rebuild homebrew Python:
brew update then brew doctor
brew rm python
brew install python --force --install-lib --install-headers --install-data --verbose
Symlink:
ln -s /usr/local/Cellar/python/2.7.x/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib /usr/local/lib/ (pay attention to the version of python you are using)
cmake and make:
cmake ../PyOpenNI you might have to specify -D OPENNI_INCLUDE_DIR
make
This worked for me with Python 2.7.10 and boost (with boost-python) 1.58.0

Script to patch Qt binaries after relocation on Mac OSX

I'm building qt 5 from source. I'm wondering what is the easiest way to copy-paste qt binaries under MacOS. If you run otool on any of the qt frameworks you'll see that all the dependencies are using absolute paths:
bash-3.2$ otool -L QtWidgets
QtWidgets:
/Users/../Qt/qt5/qtbase/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.1.0, current version 5.1.1)
/Users/../Qt/qt5/qtbase/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.1.0, current version 5.1.1)
/Users/../Qt/qt5/qtbase/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.1.0, current version 5.1.1)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 155.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 19.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.18.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.16.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 45.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1187.37.0)
When I copy qt binaries and link my application against that copy, it works but some dependent frameworks are taken from the old place. The things become even worse when I try to move the binaries to another machine. I know that the problems can be fixed using install_name_tool but it's a lot of error-prone manual work. I'm wondering if there is a script which could help me in that?
After a long search on the Internet. I discovered that Qt Installer Framework has necessary code to patch relocated Qt binaries under Mac OSX. There was small problem to run that code, it's written in C++ that was not that easy to compile since it depends on Qt4 while I'm using Qt5.1. Fortunately, it turned out that all the operations are available via command line.
To use that commands you need any installer created with Qt Installer Framework (Qt binary installer for Mac OSX is good enough) and to use the command below:
./qt-mac-opensource-5.1.0-clang-offline.app/Contents/MacOS/qt-mac-opensource-5.1.0-clang-offline --runoperation "QtPatch" "mac"
"/Path/to/Qt/binaries/which/need/to/be/patched" "qt5"
========================================
Operation was successfully performed.
In case you get an error message which says "qmake is not a program" or something like that try to chmod qmake:
chmod 777 qmake
Note: this works with any QtIFW installer. Play around with prebuilt version of QtIFW
OK, that's it, that's the most straight forward way I found so far.
If you are building QT5 from source anyways then static linking will solve some of your headaches.
The original link listed broke.
To build QT statically add -static to the arguments when you run ./configure e.g.
./configure -prefix /Developer/qt -qt-zlib -qt-libpng -qt-libjpeg -universal -sdk /Developer/SDKs/MacOSX10.4u.sdk -static -release
Compile with: make sub-src
Install with: sudo make install

List of libraries available on a stock installation of OS X?

I'm trying to compile a version of convert (one of the ImageMagick tools) for distribution with a Cocoa app I'm writing, and I've mistakenly bundled a version that relies on shared libraries my users don't have (twice, already). Thus, I'm trying to pare down the list. After stripping out everything I didn't need, running otool -L convert gives me the following list:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
and for another tool bundled with the same app, I'm also using:
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
Is it safe to assume that any out-of-the-box installation of Leopard or above will have these libraries on board? (More generally, my google-fu has failed me, so if anyone can point me to a resource that would answer these questions for me, I'd be eternally grateful!)
If the library path is /usr/lib, it should be available on a vanilla OS X of the level you're running on (and presumably above). Third-party apps and installers should not be installing into /usr/lib.
Yes, on my Snow Leopard box that has no changes to /usr/lib, all of these libraries exist

Resources