How do I install `libgmp3-dev` on OSX? - ruby

I encountered an error when I installed the 1.8.3 version of the json gem:
dyld: lazy symbol binding failed: Symbol not found: _rb_str_new_static
Referenced from: /Users/gnerkus/.rvm/gems/ruby-2.2.3/gems/json- 1.8.3/lib/json/ext/parser.bundle
Expected in: flat namespace
It was recommended on the json issue thread that libgmp3-dev be installed.
There are instructions for installing it on Linux but I've been unable to find any instructions for installing it on OSX.

If you happen to be on the same wagon, like I was today, the correct answer to install libgmp3-dev on mac is
brew install gmp

The issue resolved itself after a reboot. There was no need to install libgmp3-dev as this was already installed by xcode.
I discovered that the issue was not caused by the json module but by rvm when it discovers a ruby binary.

Related

How do you install the x86_64 version of a brew package on a M1 Mac?

I'm working on an M1 processor and I'm running a setup script that needs access to the package libsodium which doesn't exist on my computer.
I run brew install libsodium which installs the package here /opt/homebrew/Cellar/libsodium with all my other packages installed with brew
Re-running the setup script I get this error saying that it's looking for libsodium here /usr/local/lib/sodium which it can't find and that it found libsodium here /opt/homebrew/lib/libsodium.dylib but can't open it due to an incompatible architecture (have 'arm64', need 'x86_64')
LoadError: Could not open library 'sodium': dlopen(sodium, 0x0005): tried: 'sodium' (no such file), '/usr/local/lib/sodium' (no such file), '/usr/lib/sodium' (no such file), '/Users/peter.walker/projects/chopin/sodium' (no such file).
Could not open library '/opt/homebrew/lib/libsodium.dylib': dlopen(/opt/homebrew/lib/libsodium.dylib, 0x0005): tried: '/opt/homebrew/lib/libsodium.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/opt/homebrew/Cellar/libsodium/1.0.18_1/lib/libsodium.23.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')).
How are you supposed to handle installing Intel only brew packages?
Here is the command for installing x86_64 version of a brew package.
arch -x86_64 /usr/local/bin/brew install package
You might have to install brew for x86_64.
Try bundle config set force_ruby_platform true, bundle install, then gem update --system if you're getting this error message from trying to run a Rails app on M1.
The question I originally asked was unrelated to the issue I was having.

curl gives an ERROR on Mac OS

when running curl via Terminal, I get the following error:
dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/curl
Reason: image not found
Abort trap: 6
I installed the latest version of Xcode and even "brew install curl" but neither helped. any ideas what is going on??
(OS Sierra)
The issue is that the version of curl installed is incomplete. It appears that it's one installed from MacPorts, since /opt/local/bin/curl is the normal location of where it installs.
The native Apple version is in /usr/bin.
You can either uninstall or reinstall the MacPorts version:
sudo port install curl
or to uninstall
sudo port uninstall curl
↳ MacPorts Common Tasks

pdf2swf not installed through Homebrew – but the rest of swftools are

Environment OSX 10.9.5
I am trying to install swftools so that I can use pdf2swf. I am installing through HomeBrew. I've seen various notes about pdf2swf failing to install if its dependencies have not been previously installed. So using the command at the link I use:
$ brew install freetype libjpeg giflib swftools
And it completes without error – except pdf2swf is not installed. When I look in usr/local/bin, I see the other swftools are installed successfully.
Does anyone know what might be wrong?
Update: For completeness if anyone comes across this question looking to use pdf2swf in an AIR desktop app: you can't. Apparently pdf2swf compiles the swf with certain "AllowDomain" security settings and there is no option to not do that. Short of editing the source code and compiling pdf2swf oneself, it seems a deadend.
If you look at the brew formula: brew edit swftools, PDF support comes via xpdf and this is not included by default as XQuartz needs to be installed:
brew instal swftools --with-xpdf
swftools: XQuartz is required to install this formula.
You can install with Homebrew Cask:
brew install Caskroom/cask/xquartz
You can download from:
https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.
So:
Install XQuartz
brew install swftools --with-xpdf

Homebrew - dyld not found

I run brew after a fresh install, and this is what I get:
dyld: Library not loaded: /usr/local/Cellar/ruby/1.9.3-p194/lib/libruby.1.9.1.dylib
Referenced from: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Reason: image not found
I've tried most of the common fixes. Everything is up to date, and I'm using 1.9.3. Any help on this issue would be greatly appreciated.
I was getting this error after installing rvm and then running brew on Mac OSX. It seems as if the brew script targets a System version of ruby in the script, which wasn't mounted by rvm. All that I did was change this line:
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
In my /usr/local/bin/brew file to this:
#!/Users/<my user name>/.rvm/rubies/ruby-1.9.3-p385/bin/ruby -W0
The location that rvm installed the version of ruby I was using (NOTE: I omitted my username in the snippet above, the path should be to a valid install of ruby on your system)
brew started to be happy after that.

Problems getting ruby-libvirt extensions to compile Mountain Lion

I bought a new Mac this week and have had big problems getting this gem installed. It was never a problem on my old Mac but seems to be particularly difficult on this one.
I have installed libvirt via Homebrew, Xcode4.4 (with command line tools) and gcc4.2. I have symlinked to make gcc4.2 the default compiler.
gem install ruby-libvirt -v '0.4.0' fails because it cannot find the headers
If I pass in the paths to the headers and libraries, like so:
ruby-libvirt -v '0.4.0' -V -- --with-libvirt-include=/usr/local/Cellar/libvirt/0.9.11.3/include/ --with-libvirt-lib=/usr/local/Cellar/libvirt/0.9.11.3/lib/
, it compiles just fine but fails when linking with the following errors:
linking shared-object _libvirt.bundle
ld: library not found for -lruby.1.9.1
collect2: ld returned 1 exit status
make: *** [_libvirt.bundle] Error 1
I have installed Ruby 1.9.3 via RVM and haven't had any troubles installing other native extensions, so I cannot see why it fails to find the ruby libraries in this case.
Does anyone have any ideas? Help would be much appreciated.
I built ruby-libvirt-0.4.0/ext/libvirt by proving external libvirt installed using brew.
Here is what I did to successfully install libvirt.
brew install libvirt
ruby extconf.rb --with-libvirt-include=/usr/local/include/libvirt --with-libvirt-lib=/usr/local/lib/libvirt
gem install ruby-libvirt -v '0.4.0' -V -- --with-libvirt-include=/usr/local/Cellar/libvirt/1.1.4/include/libvirt --with-libvirt-lib=/usr/local/Cellar/libvirt/1.1.4/lib
Hope this helps.
To install the gem you need to install the libvirt libraries. Using 'Homebrew' (a package manager for mac) :
brew install libvirt
bundle install
The exact error you got might have been:
An error occurred while installing ruby-libvirt (0.4.0)
I have finally solved this. It turns out that the command line tools were not properly installed. The following line needs to be added to your .zshrc file (or whatever applies to your choice of shell):
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
You need only to install libvirt, before the bundle install.
brew install libvirt

Resources