QUICK START: Build Hercules for macOS Using CMake
- Software Requirements
- Building from a command prompt
- Building using the Xcode IDE
- Installing and Uninstalling Hercules
- Helpful links
Why should I use CMake to build Hercules for macOS?
QUICK START: Build Hercules for macOS Using CMake
Software Requirements
-
Apple development tools.
Either of the following will do.
-
The Xcode Interactive Development Environment (IDE).
Note that the IDE package includes and installs the Xcode Command Line Tools.
Available in the macOS App Store.
To see if the full Xcode package is installed,
do the following in the terminal app:
xcode-select -p
and look for a response of/Applications/Xcode.app/Contents/Developer
-
The Xcode Command Line Tools.
To see if the Xcode Command Line Tools are installed,
do the following in the terminal app:
gcc --version
. If the tools are not installed, a dialog box will appear offering to install them. You can also install them from the Apple Developer site. A paid developer account is not required to obtain the Xcode command line tools.
-
The Xcode Interactive Development Environment (IDE).
Note that the IDE package includes and installs the Xcode Command Line Tools.
Available in the macOS App Store.
To see if the full Xcode package is installed,
do the following in the terminal app:
-
CMake
version 3.4 or better:
cmake --version
. -
A macOS git command line client
version 1.8.5.1 or better; use
git --version
. Note: the Xcode command line tools include a git client. Xcode 9.2, the current version, includes 2.14.3. -
Optional: The
Ninja build tool, a replacement for GNU make.
Ninja will build Hercules a bit faster than GNU make.
The installation package is a single executable that can be
extracted and moved to
/usr/local/bin
. -
(Optional but desireable): Either of the following REXX interpreters.
A REXX interpreter is needed if you wish to run the Hercules test cases using
CTest, runtest.rexx, and/or the RUN_TESTS project from
within Xcode.
REXX must alse be installed if you wish to use REXX
in Hercules scripts.
- Regina Rexx. A tar.gz archive is available for macOS; this archive must be manually installed.
- Open Object Rexx. A binary distribution is not available for Open Object Rexx; you will need to build from source.
- Note: neither Homebrew nor GNU Autotools are required when you use CMake to build Hercules.
Build using a command prompt
- Open a command line application, either Terminal on the Mac or using SSH from a remote computer.
- Clone or update your local clone of Hyperion, as needed.
- Create a build directory anywhere you wish, so long as the directory is writable, and change to that directory.
-
Configure:
cmake <hyperion-source-dir> -G "<generator-name>"
Choose the values for -G "<generator-name>" using the following table. Be sure to include the quotes.
Build tool <generator-name> Xcode IDE -G "Xcode"
GNU make -G "UNIX Makefiles"
Ninja -G "Ninja"
Running
cmake --help
from the command line will return a complete list of CMake options including the names of every generator available within CMake. - Build:
cmake --build . --config Release
The
--config Release
is required for the Xcode build tools and optional for Ninja and GNU Make.The option value
Release
must be written with an upper-caseR
;--config release
will not work. - Test:
ctest -C Release
As with the build step above, the option value Release
must be written with an upper-case R
.
That's it. SoftFloat-3a, and Zlib will be cloned from the Hercules-390 repository and built inside the Hercules build directory. If BZip2 and/or Zlib are newer than the versions installed on the target system, they will be cloned from the Hercules-390 repository and built inside the Hercules build directory. Once that is done, Hercules will be built.
Should you experience difficulties using CMake to build Hercules please follow the guidance provided in What To Do When it Fails and use the Installation Using Legacy Tools below to build Hercules.
Build using the Xcode IDE
Begin by following steps one through four above. Be sure you use -G "Xcode" in Step four.
- Open the Xcode application
- Open the Xcode project created by the CMake configure step: navigate to the build directory and open Hercules.Xcodeproj.
- Xcode by default builds for "Testing," which corresponds to a CMake Debug configuration. Change this if desired: Product, Build For, Release.
- Build the solution: Product, Build.
- When the build has completed, you may run the Hercules tests by building the RUN_TESTS scheme: Product, Scheme, RUN_TEST, followed by Product, Build.
Installing and Uninstalling Hercules
Hercules may be installed using a command line or using the Xcode IDE.
While it is possible to start the Xcode IDE with administrative privileges and use it to install, the command prompt is the recommended approach.
The CMake configure option -DCMAKE_INSTALL_PREFIX can be used to change the default installation directory.
Installing Hercules
- Open a command prompt.
- Navigate to the build directory.
-
Issue the following command. Use
sudo
if needed.cmake -P cmake_install.cmake
If you wish to install Hercules in a directory other than the one that was used in the CMake configure step, say, for example /home/userid/hercules, you can override that directory with the following form of the install command:
cmake -DCMAKE_INSTALL_PREFIX="/home/userid/hercules" -P cmake_install.cmake
Uninstalling Hercules
Uninstallation can be easily performed by deleting the installation directory.
If you have installed Hercules in a subdirectory that contains other applications, files, or data, you can use the following steps to remove just the Hercules files.
This procedure removes Hercules file by file from its last installed location. It uses a manifest of full path names that is re-created in the build directory on each install of Hercules. So if you install to the wrong location and then install to the right location, this procedure will remove Hercules from the right location.
- Open a command prompt.
- Navigate to the build directory.
-
Issue the following command. Use
sudo
if needed.cmake -P cmake_uninstall.cmake
Helpful pages
- Build Options - information on CMake build options that are specific to building Hercules.
- CMake Build Options, - information on standard CMake options may be used when building Hercules.
- An Overview of CMake - provides, unsurprisingly, an overview of the CMake application and its approach to building applications.
- External Packages - how to control how and where CMake builds SoftFloat-3a and other external packages needed by Hercules-390.
- FAQ - Frequently Asked Questions.
Why should I use CMake to build Hercules for macOS?
- The CMake scripts will automatically build SoftFloat-3a, and if the versions of BZip2 and Zlib are older than the versions in the Hercules-390 project, those packages as well. These packages are built in a subdirectory of the build directory. Options are provided to build these packages in another directory, to share one package build directory with multiple CMake Hercules build directories, or to use previously-built packages.
-
Hercules will be built to use macOS shared libraries (.dylib)
and dynamically loaded libraries (.so).
When built using the legacy
configure.ac
script, Hercules is built as a single statically-linked executeable with no support for cryptographic instructions. - The CMake scripts for Hercules are the same for UNIX-like, macOS, and Windows systems. The same options are used when building Hercules on any of those systems. See the Alphabetical List of CMake Hercules Build Command-Line Options for more information about Hercules-specific options that can control the build when using CMake. See Standard CMake Build Options for more information about general CMake options that can be useful when building Hercules.
- The Hercules source directory is not altered when you build Hercules. All files created or changed by the build are stored in a separate build directory, as is the case when one builds Hercules on a UNIX-like system.
- You can build in any directory that is not the Hercules source directory. There is no specific directory structure requirement, nor any required relationship between the build directory and the source directory.
- A corollary of the above is that you can build multiple copies of Hercules with different build options, say, different versions of external packages, without having to clone Hercules multiple times into separate source directories. This should simplify local clone management for Windows developers.
- You can develop and build using the Integrated Development Environment provided by Microsoft Visual Studio 2017 Community Edition or Microsoft Visual Studio 2015 Community Edition. Older versions are supported by CMake, but the Hercules CMake build has not been tested. Note that building Hercules with Visual Studio versions older than 2008 is not supported by Hercules regardless of the build tool in use.
- A target RUN_TESTS is created to allow running the complete runtest suite from within the Xcode IDE.
- You can build Hercules from a command line using either GNU Make or Ninja. GNU Make is a component of the Xcode Command Line Tools.
Hercules Windows Build Development Status
- CMake may be used to build Hercules for all releases of macOS currently supported by Hercules.
-
The CMake scripts for Hercules has been tested on
macOS Sierra, 10.12.6,
using the following build tools:
- Xcode 9.2
- GNU make 3.81
- Ninja 1.8.2
- All testing has used Apple LLVM C compiler 9.0.0 included with Xcode version 9.2.
External Package Incompatibilities (BZip2, PCRE, Zlib)
When building Hercules using CMake on Windows, the external packages BZip2, PCRE, and Zlib will normally be built at the same time and in the Hercules build directory from github repositories that are part of the Hercules-390 project. DLLs for these applications will be installed as part of Hercules in the Hercules installation directory.
Older pre-built versions of these external packages cannot be used when building Hercules on Windows using CMake. This applies to versions of these packages built from other sources or libraries installed from Zip archives found in sundry locations on the web (including the binaries included in Hercules 4.0 Release Candidate 0 ).
The Hercules-390 repositories for the BZip2, PCRE, and Zlib cannot be used to build packages for the makefile.bat build because the directory structures differ from that required for makefile.bat.
The sources for these packages in the Hercules-390 project are at the latest release, incorporate corrections and security updates not found in binaries available in other locations, and are otherwise unmodified from the originals. They are used subject to the terms of their original licenses, which are included in the repositories.
For additional information about the Hercules-specific builds for these packages, please see the repositories for the packages at:
- BZip2 1.0.6: https://github.com/hercules-390/h390BZip
- PCRE 8.41: https://github.com/hercules-390/h390PCRE
- Zlib 1.2.11: https://github.com/hercules-390/h390Zlib
What To Do When it Fails
Please create a github issue in Hercules-390/hyperion. The following information will be needed and can be posted to the issue in a tarball:
- config.h
- CMakeCache.txt
- commitinfo.h
- CMakeFiles/CMakeError.log
- CMakeFiles/CMakeOutput.log
- CMake execution console log
- Console from the build tool execution
- Contents of the Testing/Temporary/ directory if the failure occurred during make test
This web page Copyright © 2018 by Stephen R. Orso.
This work is licensed under the Creative Commons Attribution-
ShareAlike 4.0 International License.
To view a copy of this license,
visit
http://creativecommons.org/licenses/by-sa/4.0/
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.