How to compile ruby from source with debugging symbols on osx? - ruby

I'm trying to compile Ruby from source with debugging symbols. I am not using rbenv or rvm, etc.
I have already tried
./configure optflags="-O0" debugflags="-g3 -ggdb"
To no avail :( (the debugger claims it has no symbols)
Thanks!

I figured it out in the end, you do this:
CFLAGS="-O0 -ggdb" ./configure

I recently needed to build ruby inside a docker container. Here's what I did:
1.sh:
#!/bin/sh
set -eux
apk add build-base autoconf bison linux-headers git ruby zlib-dev openssl-dev readline-dev libffi-dev gdbm-dev
git clone https://github.com/ruby/ruby
cd ruby
git checkout v2_6_6
autoconf
./configure optflags=-Og
make install
$ docker run --rm -itv $PWD:/app alpine:3.11 sh
/ # /app/1.sh

Related

Docker installs different version of git

I'm trying to do a container with some tools, one of those is git.
I need git 1.8.4.2 and I downloaded the tarball from here
https://github.com/git/git/archive/v1.8.4.2.tar.gz
First tried to do all the setup in a vanilla centos:7 container to do the test and it worked very well.
The problem is when I build the container with the commands, it installs git 1.8.4.1. This version may be work with the things that I will do, but I'm very curious why this happens if I'm using the same tarball and same commands.
Here is my Dockerfile
FROM centos:7
## Installing git 1.8.4.2
RUN yum -y install gcc make
RUN yum -y install wget zlib-devel openssl-devel cpio expat-devel gettext-devel curl-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
RUN wget -O v1.8.4.2.tar.gz https://github.com/git/git/archive/v1.8.4.2.tar.gz
RUN tar -xzvf ./v1.8.4.2.tar.gz
RUN cd git-1.8.4.2/ \
make prefix=/usr/local all \
make prefix=/usr/local install
Output when I build the container
[root#adbc2f7ab54f git-1.8.4.2]# git --version
git version 1.8.3.1
Output when I do it manually
root#adbc2f7ab54f git-1.8.4.2]# git --version
git version 1.8.4.2
The last three lines of your Dockerfile are specifying a single command:
cd git-1.8.4.2/ make prefix=/usr/local all make prefix=/usr/local install
...which doesn't work. As a result git 1.8.4.2 is not being compiled, it's not being installed, and the version of git in the container is the one that comes with CentOS 7 (1.8.3.1).
You need to add && between the three commands:
RUN cd git-1.8.4.2/ \
&& make prefix=/usr/local all \
&& make prefix=/usr/local install

How do I compile MODFLOW6 on Mac?

I'm familiar with cmake, however I don't see a cmake file in the MODFLOW6 code. I thought I had brew installed, but my computer can't seem to find it. Any help getting MODFLOW6 compiled would be great!
Go to https://brew.sh/ and get the homebrew install command from there:
From the command-line run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Add it to the path with:
sudo echo "export PATH=\"/opt/homebrew/bin/:$PATH\"" >> ~/.zshrc
Load the homebrew path into your activate terminal
source ~/.zshrc
Install the meson build system and gfortran
brew install meson
brew install gfortran
brew install git
Acquire the code:
git clone https://github.com/MODFLOW-USGS/modflow6.git
Enter the directory:
cd modflow6
Make a build directory:
mkdir build
cd build
Build the makefiles:
meson ..
Compile the code:
ninja
The compiled code is now at:
modflow6/build/utils/mf5to6
You can even add this to your path with:
sudo echo 'export PATH="$HOME/modflow6/build/utils/mf5to6:$PATH"' >> ~/.zshrc
source ~/.zshrc
if you want to be able to run mf5to6 from anywhere.
Alternatively, you can run it from its location using:
./modflow6/build/utils/mf5to6

Need to install Watchman version 4.9.0 on a mac

These instructions at https://facebook.github.io/watchman/docs/install.html do not work for mac osx:
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.9.0
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
./autogen.sh...
The error:
pkg-config appears to be missing (not available to autoconf tools)
please install the pkg-config package for your system.
The reason I suspect is that not all the same linux packages are available on a mac. How can I get this working on a mac?
// autoconf#2.7
brew uninstall autoconf
brew install autoconf#2.6.9
//pass
./autogen.sh
Just run ./autogen.sh

wxWidgets (wxRuby) with Ruby 2.0

I'm looking for an Win32 wxRuby gem for Ruby 2.0, does someone know where to find it? I didn't have success trying to build it and it seems the project is dead.
I'm still on the battle, I successfully built wxRuby using Ruby 2.3 on linux Ubuntu (Xenial 16.04) and Mint (17 and 18), for both i386 and amd64, testing and using instructions from here and here:
# temporary add this source for a complete libwxgtk2.8
echo "deb http://archive.ubuntu.com/ubuntu precise main universe" | tee /etc/apt/sources.list.d/precise-copies.list
apt update
# install required packages
apt-get install libwxgtk2.8-dev libglib2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev pangox-1.0-dev build-essential curl git
# install recommended swig version
wget "http://downloads.sourceforge.net/project/swig/swig/swig-1.3.38/swig-1.3.38.tar.gz?r=&ts=1471028964&use_mirror=ufpr" -O swig-1.3.38.tar.gz
tar zxvf swig-1.3.38.tar.gz
cd swig-1.3.38
./configure
make -j8
make install
# install ruby, using RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install 2.3.0
# wxRuby
git clone https://github.com/cinnammon/wxRuby-ng
cd ~/wxRuby-ng
export WXRUBY_EXCLUDED=GLCanvas
export WXRUBY_VERSION=2.0.1
# add "Config = RbConfig unless defined?(Config)" to the top of ./rakefile
# and change 'raise "This version of Ruby (#{RUBY_VERSION}) is not supported"'
# on line 38 for "SWIG_MINIMUM_VERSION = '1.3.37'"
rake
# I got some "extern" "static" declaration errors on some files,
# just changed "static" to "extern" and all went well
rake install
# remove source
rm /etc/apt/sources.list.d/precise-copies.list
apt update
I will keep trying to port it to Windows or maybe stick to Linux, but will update this post :)
Latest ruby version which supports wxruby gem is 1.9.1 (gem is named wxruby-ruby19, gem named wxruby is dedicated for ruby 1.8) and wxruby project is no longer developed. So if you need to use ruby 2.0 you are on your own now. But try to ask at http://www.ruby-forum.com/forum/wxruby where some of former wxruby developers are still active and eager to help.

How do I install libksba on mac osx?

According to rvm requirements, "For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'"
I am completely new and am not familiar with terminal commands. How can I install libksba without using homebrew?
Please help!!!
I just installed libksba and its dependency libgpg-error from source and I can assure you that installing Homebrew and then installing libksba is much more straightforward. With Homebrew, you'll spend far less time dealing with terminal commands and the likelihood of success is considerably higher. It is popular for a reason.
For the benefit of future visitors, here are instructions to compile and install libgpg-error and libksba from source via bash without Homebrew:
cd /usr/local/src
curl -O ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.9.tar.gz
tar -xvf libgpg-error-1.9.tar.gz
cd libgpg-error-1.9/
./configure
make
make install
cd ..
curl -O ftp://ftp.gnupg.org/gcrypt/libksba/libksba-1.2.0.tar.bz2
tar -xvf libksba-1.2.0.tar.bz2
cd libksba-1.2.0/
./configure
make
make install
you need to install the command line tools of xcode. Then you don't need to install libksba.
http://blog.salientdigital.com/2012/05/16/how-to-fix-no-acceptable-c-compiler-found-in-path-on-mac-os-x-lion/
Best,
Olli

Resources