User Tools

Site Tools


howto:building_on_os_x

Building on OS X

This how-to assumes that you have already installed the current X-code development environment on your OS X computer. It further assumes that your have some familiarity with the OS X terminal. OS X is a derivative of Free-BSD, a public domain version of the Unix operating system. As such, OS-X supports all of the usual terminal commands and utilities that are found on any Free-BSD operating system. The terminal shell program is the Bourne Again SHell, bash. It provides the $ prompt and executes line entries, shell scripts, and binary programs directly from the terminal window. You will be working in a terminal window for all of this how-to, so become familiar with using the shell program. I recommend this web page if you need to do a bit of learning.

Shell Programming

Don't be put off by it being written specifically for Linux. Bash on OS-X and bash on Linux are identical.

Open the OS-X terminal. The application is found in the “Finder / Applications / Utilities” folder. You should drag the icon to your launch bar for convenience in future terminal work.

The $HOME folder is the one that contains your Documents, Photos, etc. folders. You will be in that folder immediately after starting the terminal program. Return to the $HOME folder at any time by simply executing “cd” with no other parameters.

Refer to the Bash Shell Programming in Linux as needed..

This how-to will help you create a single architecture (i.e., not “universal”) binaries. They were tested on a MacOS 10.12.6 system.

Creating Build dependencies

Begin by creating these two folders if they do not already exist:

  • Create a folder named dev-src in your $HOME folder.
  • Create a folder named src within dev-src.
$ cd
$ mkdir dev-src
$ cd dev-src
$ mkdir src

Download these files which are located on the W1HKJ web site, Build Dependencies, to the new src folder.

Untar each compressed file, i.e.

$ tar xzf fltk-1.3.4-2.tar.gz

Validate the shell scripts do not have a .txt extension

$ ls config* hamlib-config* fltk-config* makebin*

If they do, remove the .txt extension

$ for script in *txt; do mv ${script} ${script%%.txt}; done

Make these 4 shell scripts executable.

$ chmod a+x config hamlib-config fltk-config makebin

Then move the “makebin” shell script file up one folder to the dev-src folder

$ mv makebin ..
(note the two dots, which means 'parent directory')

Set the environment

$ cd
$ ls .bash_profile  (note the dot)

if not found then

$ touch .bash_profile

use the “nano” editor to edit the new or existing file

$ nano .bash_profile

add these lines if they are not already in that file

export PKG_CONFIG=/usr/local/bin/pkg-config
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Save the file: Ctrl+x, y, Enter.

Close down the terminal and then open a new terminal window. This is necessary as the bash environmnet is most easily read and set when the terminal programs starts. Then

$ env

to make sure the changes to local bash environment were made correctly.

The config file downloaded above is for all but fltk, hamlib and pkg-config, i.e. libpng, libsamplerate, libsndfile, libtool, and portaudio.

Compile and install libraries (you can just copy/paste these commands):

cd ${HOME}/dev-src/src/pkg-config-0.29.1
./configure --with-internal-glib
make
sudo make install

cd ${HOME}/dev-src/src/fltk-1.3.4-2
../fltk-config
make
sudo make install

cd ${HOME}/dev-src/src/hamlib-3.0
../hamlib-config
make
sudo make install

cd ${HOME}/dev-src/src/libpng-1.6.25
../config
make
sudo make install

cd ${HOME}/dev-src/src/libsamplerate-0.1.9
../config
make
sudo make install

cd ${HOME}/dev-src/src/libsndfile-1.0.27
../config
make
sudo make install

cd ${HOME}/dev-src/src/libtool-2.4.6
../config
make
sudo make install

cd ${HOME}/dev-src/src/portaudio
../config
make
sudo make install

Getting the source

Download the fldigi source to ${HOME}/dev-src and uncompress it as the other sources were uncompressed.

Either download the tar.gz file from the files directory using a browser and download using it's built-in http file download mechanism (typically Right-click → Save As…).

or download using curl (note the curl command line option is an uppercase “O”, not a zero.

$ cd
$ cd dev-src
$ curl -O http://www.w1hkj.com/files/fldigi/fldigi-x.xx.xx.tar.gz
  where x.xx.xx is the current version number

$ tar xzf fldigi-x.xx.xx.tar.gz (uncompress the downloaded archive)

then:

$ cd fldigi-x.xx.xx
$ ../makebin

To create an installation disk image file (dmg)

$ make appbundle

Which will create a two dmg files in the src sub-directory. One of the dmg files will have “no-libs” within the file name. It will be slightly smaller than the other. Either can be used for a system installation of the new application. If you use the “no-libs” installation files then you may have to recompile and install if you subsequently update one of the libraries.

Notes:

1. Building with Xcode 8.x on OSx version 10.11 that fail to execute and give an error regarding “clock_gettime” even though the build completed normally.

Suggest you try this:

Set the build target with the following:

$ export MACOSX_DEPLOYMENT_TARGET=10.11

Execute the configure adding this parameter to the options found in the makebin shell script

–without-clock_gettime

ie:

./configure "CFLAGS=-w -g \
  -headerpad_max_install_names" \
  -"CXXFLAGS=-w -g -headerpad_max_install_names " \
  -"LDFLAGS=-w -headerpad_max_install_names" \
  --enable-static \
  --without-clock_gettime

Note: the backslash is a line continuation in bash shell scripts.

Execute “make” and test the binary in src/fldigi

If the new binary is OK you should edit the makebin script to include the –without-clock_gettime parameter.

Acknowledgement

This how-to was written jointly by W1HKJ, David; AE5ZA, Cliff; and K9DWR, David. Cliff tested the process on his MacOS system that had not previously been used to build fldigi, flrig, etc.

howto/building_on_os_x.txt · Last modified: 2018/03/10 12:17 by 72.104.160.29