How do I compile MODFLOW6 on Mac? - macos

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

Related

An issue with installation of ansible-pylibssh on Apple Silicon M2

I've got an issue with installation of ansible-pylibssh.
During installation
pip3 install --user ansible-pylibssh
I got
ld: library not found for -lssh
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit code 1
Could someone explain how to overcome this?
I've already done softlink
% cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
% sudo ln -s /opt/homebrew/Cellar/libssh/0.10.4/include/libssh/ libssh
Install libssh:
brew install libssh
Use a python virtual environment :
python3 -m venv .venv
source .venv/bin/activate
EDIT:
Install with correct compiler flags:
CFLAGS="-I $(brew --prefix)/include -I ext -L $(brew --prefix)/lib -lssh" pip install ansible-pylibssh
Thanks, #webknjaz!
OLD Additional steps not needed (preserved for history):
Install tox build tool:
pip install 'tox >= 3.19.0'
Build from source on ARM-based Macs, per the ansible-pylibssh docs:
#git clone https://github.com/ansible/pylibssh.git ~/src/github/ansible/pylibssh
# or, if you use SSH:
git clone ssh://git#github.com/ansible/pylibssh.git ~/src/github/ansible/pylibssh
cd ~/src/github/ansible/pylibssh
Use libraries installed by brew with clang:
export CFLAGS="-I $(brew --prefix)/include -I ext -L $(brew --prefix)/lib -lssh"
Build ansible-pylibssh:
tox -e build-dists
Install built ansible-pylibssh wheel:
pip install ~/src/github/ansible/pylibssh/dist/ansible_pylibssh*.whl
Additional resources that lead to this answer:
Kristof Rado's answer to Cannot install ansible-pylibssh on macOS
ansible/pylibssh GitHub issue 207 provides background on why this package is not available for macOS on ARM from PyPi (symlink/softlink to point to the libraries did not help. Correct compiler flags were the needed answer.)
If you prefer not to work with a virtual environment, this may work: replace pip commands python3 -m pip --user and python commands with python3.

Problem with installing Go on Ubuntu 20.04 server

I am new to Ubuntu and am trying to install Go onto my server, however I get an error when trying to use Go.
Command 'go' not found, but can be installed with:
sudo apt install golang-go # version 2:1.13~1ubuntu2, or
sudo apt install gccgo-go # version 2:1.13~1ubuntu2
The commands I used to install Go are below.
$ wget https://dl.google.com/go/go1.15.10.linux-amd64.tar.gz
$ sudo tar -xvf go1.15.10.linux-amd64.tar.gz
$ sudo mv go /usr/local
Then I appended the following to the bash_aliases file.
$ vi ~/.bash_aliases
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
What am I doing wrong here?
I will give you some suggest.
check your path var
echo $PATH
Since you edit ~/.bash_aliases, I think you maybe not source this file.
please try source ~/.bash_aliases.
or try
export $PATH=$PATH:/usr/local/go/bin
beside ~/.bash_aliases may not be load by default. see if . ~/.bash_aliases is in your ~/.bashrc file.
Check if bin can run
/usr/local/go/bin/go version
if have error, maybe is the package you download is wrong. checksum the tar package(for example: md5sum xxxx.tar.gz).
check the default path of go
which go
if go bin not in /usr/local/go/bin/go, you should delete the go bin that shown by which go
Using APT, there is an official package you can install using Ubuntu
Open a terminal and run:
sudo apt update
sudo apt install golang-go
Depending on your version of Ubuntu, you may have to run:
sudo apt install golang
Hope this helps! Its my first answer!

msgmerge on macos Catalina

I am trying to run a unix command line for some i18n work on a project. Using gettext library my issue is about running msgmerge
$ msgmerge
zsh: command not found: msgmerge
I tried brew instal gettext and brew link gettext but with no success. This was working well on my previous machine, but can't make it work on a fresh install.
I can confirm binary is available in /usr/local/opt/gettext/bin/msgmerge.
Fixed. When running brew reinstall gettext, command actually give the answer:
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
Export is only triggered when opening a new zsh prompt, PATH was not updated yet and worked when I re-openned a new window.
I tried running this brew link gettext --force, but I was getting:
$ brew install gettext
Warning: gettext 0.20.2 is already installed and up-to-date
To reinstall 0.20.2, run `brew reinstall gettext`
$ brew link gettext --force
Warning: Refusing to link macOS provided/shadowed software: gettext
If you need to have gettext first in your PATH run:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
For compilers to find gettext you may need to set:
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
Then, I just added it to the system path with:
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile
Related:
https://apple.stackexchange.com/questions/299048/can-not-use-the-gettext-which-is-installed-by-brew
Homebrew refusing to link OpenSSL
How to install gettext on MacOS X
Installed, just not linked

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

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

Installing osm2pgsql from source not actually installing?

I'm trying to install osm2pgsql from source on a Mac using Terminal.
I ran these commands:
git clone git://github.com/openstreetmap/osm2pgsql.git
cd osm2pgsql
./autogen.sh && ./configure && make
And it runs, but then if I try to run an osm2pgsql command, it says:
-bash: osm2pgsql: command not found
There are no further instructions online about how to install from source, so I'm not sure what I'm missing here.
Anyone help me?
Thanks
You might need to install the build-essential and automake packages.
Type the following in the terminal (before trying to install osm2pgsql):
sudo apt-get install build-essential
sudo apt-get install automake
sudo apt-get install checkinstall
You need to add it to your path! To "install" something is really just to let the OS know where it is, because it's too dumb to figure that out on its own, even if you're in the same directory with it. In Unix, every command is a program; when you enter a command, the OS checks the "path" which is just a list of directories where that command might live.
First of all, to test that it's compiled and working properly in its own directory:
./osm2pgsql
If that works, add the current directory to the path variable:
export PATH=$PATH:`pwd`
Now you can execute the command from anywhere.

Resources