Installing Wt on Mac OS X Yosemite or El Capitan (macosx 10.10-10.11+)¶
- Table of contents
- Installing Wt on Mac OS X Yosemite or El Capitan (macosx 10.10-10.11+)
The following are installation instructions for installing Wt (from source) on OS X 10.10 "Yosemite", using Homebrew to install dependencies. These instructions have also been tested and found to work on OS X 10.11 "El Capitan". The build toolchain on macosx Yosemite is based on CLang and libc, and requires the installation of Xcode and the Xcode Command-Line tools.
- Xcode (free download from the Apple App Store)
- Xcode Command-Line Tools (installed from within Xcode or from the command line)
This guide relies on the excellent Homebrew package manager, which facilitates the fast and easy installation of many popular packages and their dependencies on macosx. We will use Homebrew to install the dependencies that Wt requires, as well as additional packages that enable optional features in Wt.
If you haven't installed Homebrew already, it's very easy to do using the following command in Terminal:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Base Dependencies¶
With Homebrew installed, let's install the base dependencies for Wt:
$ brew install cmake $ brew install boost
Install Additional Dependencies¶
For this guide, we we be enabling the following optional features in Wt:
- HTTPS (SSL)
- Graphics drawing and PDF Generation
If you want FastCGI support:
$ brew install fcgi
If you want SSL (HTTPS) support in Wt's built-in web server:
$ brew install openssl
If you want support for MySQL:
$ brew install mysql-connector-c
If you want graphics drawing and PDF generation support:
$ brew install libpng $ brew install libtiff $ brew install libharu $ brew install pango $ brew install GraphicsMagick
NOTE: Homebrew detects existing packages on your system, and by default will not overwrite existing packages when installing new ones. Please pay attention to the messages displayed during the brew process. Mac OS X includes a few packages that conflict (harmlessly) with some of the packages we are installing (e.g. OpenSSL). When a package already exists on your system, Homebrew will place the new package in a different location, and notify you during the install. In the Wt configuration process, I have modified some of the library prefixes passed to cmake to point to these alternate locations for the affected libraries installed by brew.
At the time of this writing, Wt 3.3.7-rc1 supports the latest version of Boost installed by homebrew, so you can simply download and unarchive the Wt release package.
If you encounter incompatibilities, you can try downloading the latest version of Wt using git:
$ git clone git://github.com/kdeforche/wt.git
NOTE: Please notice the lines related to MySQL, GraphicsMagick, and OpenSSL passed to cmake below. Make sure the paths (and version numbers) match those reported by the brew installation of these packages on your system.
To build Wt, do the following:
$ cd wt $ mkdir build $ cd build $ cmake \ -DCMAKE_CXX_FLAGS='-stdlib=libc++' \ -DCMAKE_EXE_LINKER_FLAGS='-stdlib=libc++' \ -DCMAKE_MODULE_LINKER_FLAGS='-stdlib=libc++' \ -DWT_CPP_11_MODE='-std=c++11' \ -DMYSQL_LIBRARY=mysqlclient -DMYSQL_PREFIX=/usr/local/Cellar/mysql-connector-c/6.1.6 \ -DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick -DGM_PREFIX=/usr/local \ -DSSL_PREFIX=/usr/local/Cellar/openssl/1.0.2h_1 ../ $ make -j4 # set -jN to your number of CPU cores for a faster parallel build $ make -C examples # to build the examples $ sudo make install
You may receive warnings that not all features will be built, but Wt doesn't require them. To enable additional features, you can install the additional dependencies needed using brew.
If you successfully enable other optional features in Wt, or if you know how to get Wt's OpenGL support built under macosx, please contact me at kevpatt~at~khptech.com and/or consider updating this Wiki page.
To build OpenGL support, just correct first section in cmake/WtFindGL.txt file like this:
IF(WIN32) SET(GL_INCLUDE_DIR "") ELSEIF(NOT APPLE) FIND_PATH(GL_INCLUDE_DIR NAMES GL/gl.h PATHS /usr/include ) ELSEIF(APPLE) FIND_PATH(GL_INCLUDE_DIR NAMES gl.h PATHS /System/Library/Frameworks/OpenGL.framework/Headers ) ENDIF(WIN32)
$ LDFLAGS="-framework OpenGL" cmake ../
To run the examples, please see the generic installation instructions.
Here's how to compile and run the "Hello World" sample application from the Wt Online Tutorial
Assuming the code for "Hello World" has been saved in source file named "hello.cc":
$ c++ -o hello hello.cc -lwthttp -lwt -I/usr/local/include -L/usr/local/lib $ ./hello --docroot . --http-address 0.0.0.0 --http-port 9090
Updated by sashik sahik over 5 years ago · 26 revisions