I'm trying to build
OpenCPN on my Mac (OS X 10.10 Yoesmite), but I'm having a bit of trouble.
Pavel's updated
build instructions are a help, and Gerhard - who has built OCPN on Yosemite - has given me some
advice via PM, but I'm still not managing and I thought I'd post here rather than continue PM'ing so the solution is around for posterity.
I have Xcode 6.1, with the SDKs for 10.10 and 10.9 built into it. I have the SDK for 10.8 symlinked.
(I have an old Xcode 4 installer package around from which I will later try to extract the 10.7 SDK, but I know Gerhard managed to build against the 10.10 SDK so it shouldn't be necessary.)
I'm going to start by listing the problems I've had and 'solved', in case it helps anyone see where I'm going wrong.
My
current problem is right at the bottom.
My first problem was with building wxWidgets. I was using the latest stable version, 3.0.2, as instructed on the build instructions page. But I was linking against the 10.9 SDK since I didn't have 10.7 and 10.9 was the oldest I had.
Not far into the build, I would get the following error:
Code:
/Users/caesar/Downloads/wxWidgets-3.0.2/bk-deps gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/ -mmacosx-version-min=10.9 -c -o wxtiff_tif_lzma.o -DNDEBUG -I./src/jpeg -I/Users/caesar/Downloads/wxWidgets-3.0.2/src/tiff/libtiff -I./src/tiff/libtiff -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -I/Users/caesar/Downloads/wxWidgets-3.0.2/lib/wx/include/osx_cocoa-unicode-3.0 -I./include -Wall -Wundef -O2 -fno-strict-aliasing -fno-common ./src/tiff/libtiff/tif_lzma.c
./src/tiff/libtiff/tif_lzma.c:38:10: fatal error: 'lzma.h' file not found
#include "lzma.h"
^
1 error generated.
make: *** [wxtiff_tif_lzma.o] Error 1
I was able to solve this error by passing the flag --disable-lzma to the configure script. Then, make would run for a very long time (an hour?) before throwing the following errors:
Code:
/Users/caesar/Downloads/wxWidgets-3.0.2/bk-deps g++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/ -mmacosx-version-min=10.10 -c -o webviewdll_osx_webview_webkit.o -I./.pch/wxprec_webviewdll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/caesar/Downloads/wxWidgets-3.0.2/src/tiff/libtiff -I./src/tiff/libtiff -I./src/jpeg -I./src/png -I./src/regex -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -I/Users/caesar/Downloads/wxWidgets-3.0.2/lib/wx/include/osx_cocoa-unicode-3.0 -I./include -O2 -fno-strict-aliasing ./src/osx/webview_webkit.mm
./src/osx/webview_webkit.mm:392:30: warning: incompatible pointer types sending 'WebViewUIDelegate *' to parameter of type 'id<WKUIDelegate>' [-Wincompatible-pointer-types]
[m_webView setUIDelegate:uiDelegate];
^~~~~~~~~~
./src/osx/webview_webkit.mm:464:34: warning: 'WKPreferences' may not respond to 'setUsesPageCache:'
[[m_webView preferences] setUsesPageCache:NO];
~~~~~~~~~~~~~~~~~~~~~~~ ^
./src/osx/webview_webkit.mm:466:34: warning: 'WKPreferences' may not respond to 'setUsesPageCache:'
[[m_webView preferences] setUsesPageCache:YES];
~~~~~~~~~~~~~~~~~~~~~~~ ^
./src/osx/webview_webkit.mm:936:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
WebBackForwardList* history = [m_webView backForwardList];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/osx/webview_webkit.mm:954:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
WebBackForwardList* history = [m_webView backForwardList];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 2 errors generated.
make: *** [webviewdll_osx_webview_webkit.o] Error 1
Following Gerhard's
advice, I pulled the latest wxWidgets sources from Github, and used the following configure command:
Code:
../configure --with-osx_cocoa --enable-debug --enable-shared --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk --with-macosx-version-min=10.9 --enable-unicode --enable-mimetype=yes --disable-lzma
Then wxWidgets built successfully.
BUT... I wasn't able to build
OpenCPN.
First I got the following error:
Code:
CMake Warning at /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/Platform/Darwin.cmake:179 (message):
Ignoring CMAKE_OSX_SYSROOT value:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
because the directory does not exist.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:43 (PROJECT)
CMake Error at /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/Platform/Darwin.cmake:211 (message):
CMAKE_OSX_DEPLOYMENT_TARGET is '10.8' but CMAKE_OSX_SYSROOT:
""
is not set to a MacOSX SDK with a recognized version. Either set
CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
empty.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:43 (PROJECT)
-- Configuring incomplete, errors occurred!
So then I installed the 10.8 SDK, and cmake would run fine.
But when I ran make, I got the following error...:
Code:
[ 4%] Building CXX object CMakeFiles/GARMINHOST.dir/src/garmin/jeeps/garmin_wrapper.cpp.o
In file included from /Users/caesar/dev/OpenCPN/src/garmin/jeeps/garmin_wrapper.cpp:22:
In file included from /Users/caesar/dev/OpenCPN/src/garmin/jeeps/garmin_wrapper.h:29:
In file included from /usr/local/include/wx-3.1/wx/wx.h:15:
In file included from /usr/local/include/wx-3.1/wx/object.h:19:
In file included from /usr/local/include/wx-3.1/wx/memory.h:15:
In file included from /usr/local/include/wx-3.1/wx/string.h:37:
/usr/local/include/wx-3.1/wx/strvararg.h:22:14: fatal error: 'type_traits' file not found
#include <type_traits>
^
1 error generated.
make[2]: *** [CMakeFiles/GARMINHOST.dir/src/garmin/jeeps/garmin_wrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/GARMINHOST.dir/all] Error 2
make: *** [all] Error 2
Suspecting that this was due to building against an older SDK than I'd used to build wxWidgets, I changed every mention of 10.8.sdk to 10.10.sdk in the CMakeCache.txt file. That
solved that problem.
BUT... now I'm getting the following error.
Code:
[ 38%] Building CXX object CMakeFiles/OpenCPN.dir/src/chcanv.cpp.o
/Users/caesar/dev/OpenCPN/src/chcanv.cpp:4810:24: error: no member named 'LeftDown' in 'wxMouseState'; did you mean 'LeftIsDown'?
if( !state.LeftDown() )
^~~~~~~~
LeftIsDown
/usr/local/include/wx-3.1/wx/mousestate.h:71:10: note: 'LeftIsDown' declared here
bool LeftIsDown() const { return m_leftDown; }
^
/Users/caesar/dev/OpenCPN/src/chcanv.cpp:6645:70: error: no member named 'GetLabel' in 'wxMenuItem'
pimis->pmenu_item->GetLabel(), pimis->pmenu_item->GetHelp(),
~~~~~~~~~~~~~~~~~ ^
/Users/caesar/dev/OpenCPN/src/chcanv.cpp:10901:32: error: no member named 'SetDividerPen' in 'wxGrid'
( (wxGrid*) win )->SetDividerPen(
~~~~~~~~~~~~~~~~~ ^
3 errors generated.
make[2]: *** [CMakeFiles/OpenCPN.dir/src/chcanv.cpp.o] Error 1
make[1]: *** [CMakeFiles/OpenCPN.dir/all] Error 2
make: *** [all] Error 2
I'm on the point of giving up, but I do really want to get this going so I can at least do some debugging and hopefully even contribute a few improvements to OCPN.
So, if anyone can help me here, I'd greatly appreciate it.
~ Caesar