Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 21-10-2014, 11:21   #1
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Unhappy Building OCPN on OS X

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
__________________

__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 13:26   #2
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 2,809
Re: Building OCPN on OS X

try configuring wxwidgets with --enable-compat28 ?
__________________

__________________
boat_alexandra is offline   Reply With Quote
Old 21-10-2014, 13:33   #3
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Quote:
Originally Posted by boat_alexandra View Post
try configuring wxwidgets with --enable-compat28 ?
What does that do?
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 13:50   #4
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Latest news:

Pavel tells me I probably do need to use the 10.7 SDK (and definitely need to use wxWidgets 3.0.2 for compatibility with official OCPN).

So I tried that. (Again, I had to use --disable-lzma.)

After about ten minutes, a new error:

Code:
wxregexu-3.0   -framework IOKit -framework Carbon -framework Cocoa -framework  AudioToolbox -framework System -framework OpenGL  -lz -lpthread -liconv  -llzma  -lz -lpthread -liconv -llzma
ld: framework not found System
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/caesar/Downloads/wxWidgets-3.0.2/lib/libwx_baseu-3.0.0.2.0.dylib] Error 1
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 13:51   #5
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Quote:
Originally Posted by boat_alexandra View Post
try configuring wxwidgets with --enable-compat28 ?
I see, that enables compatibility with wx 2.8. But it seems to be enabled by default in 3.0.2 - presumably you are talking about using master ("3.1") and using that flag?
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 14:51   #6
Registered User

Join Date: Jul 2010
Location: Monastir, Tunisia
Boat: Amel Sharki
Posts: 1,777
Re: Building OCPN on OS X

Try to use Xcode and not these cmake terminal stuff.
Xcode is a nice compiler GUI even for idiots like me.
Gerhard
__________________
CarCode is offline   Reply With Quote
Old 21-10-2014, 17:30   #7
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 2,809
Re: Building OCPN on OS X

Quote:
Originally Posted by Mollymawk View Post
I see, that enables compatibility with wx 2.8. But it seems to be enabled by default in 3.0.2 - presumably you are talking about using master ("3.1") and using that flag?
I would go back to git version of wxwidgets since you got closest there.

The error you posted about the function not existing is related to a change in the newer library version, so I imagined that enabling compatibility would solve it. Maybe needs 3.0 compatibility not 2.8 for this, so you can try both.

If neither work, you can add #ifdef in the opencpn source code to build checking the version and calling the appropriate function.
__________________
boat_alexandra is offline   Reply With Quote
Old 21-10-2014, 17:47   #8
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Quote:
Originally Posted by boat_alexandra View Post
I would go back to git version of wxwidgets since you got closest there.

The error you posted about the function not existing is related to a change in the newer library version, so I imagined that enabling compatibility would solve it. Maybe needs 3.0 compatibility not 2.8 for this, so you can try both.

If neither work, you can add #ifdef in the opencpn source code to build checking the version and calling the appropriate function.
Ah right. I'm trying to avoid that at the moment since Pavel told me it wouldn't be compatible with official releases of OpenCPN, but I'll come back to it if all else fails.

For the moment, I have managed to get wxWidgets stable to build by using the 10.9 SDK and setting the min-version to 10.7.

I did:
Code:
$ ./configure --enable-unicode --with-osx-cocoa --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk --with-macosx-version-min=10.7 --enable-aui --disable-debug --enable-opengl --disable-lzma

$ make
$ sudo make install
and it built and installed fine.

Now building OCPN... It's got past the point where it failed last time.
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 17:49   #9
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Quote:
Originally Posted by Mollymawk View Post
Now building OCPN... It's got past the point where it failed last time.
I spoke too soon!

Code:
[ 66%] Building C object CMakeFiles/OpenCPN.dir/src/macutils.c.o
Linking CXX executable OpenCPN.app/Contents/MacOS/OpenCPN
ld: framework not found System
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [OpenCPN.app/Contents/MacOS/OpenCPN] Error 1
make[1]: *** [CMakeFiles/OpenCPN.dir/all] Error 2
make: *** [all] Error 2
It's that same error about missing the System framework.

I'll get to the bottom of this!
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 18:17   #10
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Talking Re: Building OCPN on OS X

I managed to build it!

I had to build both wxWidgets and OpenCPN using the 10.9 SDK (but specifying 10.7 as minimum compatible version).

I think I know what the problem was now, and it's a bit embarrassing I didn't fully think about it earlier.
I put my old SDKs at /SDKs/ and symlinked them from inside Xcode, rather than actually storing them inside Xcode. I'm guessing ld didn't like the symlink.
When building wxWidgets I thought I could get around this by pointing straight at /SDKs/ when calling configure, but I guess that wasn't getting passed on to ld.
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 18:34   #11
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: chesapeake bay
Boat: bristol 27
Posts: 2,809
Re: Building OCPN on OS X

Are you able to build installers for the plugins?
__________________
boat_alexandra is offline   Reply With Quote
Old 21-10-2014, 19:01   #12
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: Building OCPN on OS X

Mollymawk...

Now that you are able to build OCPN, please download the latest github source, and make a fresh build/test.

There is a proposed correction for FS#1541 (Serious graphics errors with OpenGL enabled) in github now.

Thanks for your input
Dave
__________________
bdbcat is offline   Reply With Quote
Old 21-10-2014, 20:04   #13
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Quote:
Originally Posted by bdbcat View Post
Mollymawk...

Now that you are able to build OCPN, please download the latest github source, and make a fresh build/test.

There is a proposed correction for FS#1541 (Serious graphics errors with OpenGL enabled) in github now.

Thanks for your input
Dave
Dave,

Done. It works fine.
Well done!

~ Caesar
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 20:06   #14
Registered User
 
Mollymawk's Avatar

Join Date: Nov 2009
Location: on the high seas
Boat: "Mollymawk" 50ft Steel Ketch
Posts: 149
Re: Building OCPN on OS X

Quote:
Originally Posted by boat_alexandra View Post
Are you able to build installers for the plugins?
My battery is flat. :-/
I will play with this another time.

But, I think I will first have to rebuild with the 10.7 SDK somehow; if I put my build of the default plugins into the official beta it crashes.
__________________
www.yachtmollymawk.com
Mollymawk is offline   Reply With Quote
Old 21-10-2014, 20:36   #15
Registered User

Join Date: Oct 2014
Posts: 6
Re: Building OCPN on OS X

Mollymawk,

Good work getting it to compile on 10.10.

A few months ago I got a version compiled in 10.9 (Mavericks) with wxWidgets 3.0.1 with a lot of help from Sean (boat_alexandra).

I'm interested to hear if you get many runtime errors with Yosemite (the version your using should now include many of the fixes we made then I'm told). Anyway I'm going to try a build on 10.9 now so I'll report back on this thread as well.

Cheers
-Hugh
__________________

__________________
hmacread is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wood That Won't Warp For Building Entire Kitchen Counter, and Advice On Building Hatc albergsailor Monohull Sailboats 30 25-09-2012 10:15
How to use MMR2-C-Map card reader with OCPN ? Flemming Torp OpenCPN 6 28-05-2012 09:39
Pictures of OCPN in action. cagney OpenCPN 0 03-04-2012 10:16
Furuno and OCPN KrisCatteceur Navigation 2 12-01-2012 14:04
Does OCPN support NMEA 0183 v3.1? Netsurfer OpenCPN 5 25-05-2010 08:42



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 19:18.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.