Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 06-03-2014, 21:37   #1
Registered User

Join Date: Mar 2014
Location: Hong Kong
Boat: Beneteau Oceanis 40
Posts: 5
OSX Development / Compile Questions

Hello all,

I have tried OpenCPN for a while now and I'm quite happy to see that a lot of progress has been made in the last year.

I'm on a Mac and have C++ background (although 14 years of PHP don't help that much) so I thought I try to contribute and help make OpenCPN better or iron out some bugs.

While I'm OK to compile OpenCPN on Mavericks (initial pitfalls were wxWidgets which needs be 3.0 and a few other glitches) I do have a problem with the plugins.

I'm using a mix of the documentation from the OpenCPN "building on mac" page. I then use Xcode to compile.

While all compiles, I cannot run any plugins. I have to say also that I'm quite a bit of a Xcode newbie, all my past (extensive) C++ development was done on MSVC (5+). My problem is that the project statically links the wxWidget libraries to both the opencpn app as well as the plugins.

Each of them weigh in much more than the original (recent) release of OpenCPN.

Now, I wonder, if anyone who compiles on a Mac is even using the Xcode project at all. I have so far not been able to build OpenCPN and the plugins without statically linked wxWidgets. I simply can't do it. I know I must be missing an interface file which lists the exported functions and dynamically loads the required dynlibs, however, on Windows I had no problem doing this, on Mac I fail. I remove the libs from xcode, the link will fail. I include the libs in the build phase, the plugins crash.

Result is that whenever a plugin gets loaded, it crashes, and I presume (I do get a warning on this in the log on startup) that wxWidget symbols are found in both OpenCPN and the plugin, and which one is being used is undefined.

Result: Crash (memory freed without being allocated)

I'm right now not at home (but cruising in the Philippines) and will be able to provide much more info later on, including a how-to I was then able to compile OpenCPN on Mac if somebody has problems in doing so.

I've compiled from the recent master, and have found that the performance (using CM93 maps) was much quicker and snappier than the compiled version downloaded from the opencpn page. For what's it worth; I didn't run benchmarks but it felt quite a bit faster (disabled opengl and running on my retina MBP later 2013).

I googled around for this and couldn't find a dedicated build page for mac so I'm posting this here. If this not the correct place to ask, I would appreciate a pointer to the correct one.

Thanks and happy sailing,

Tom
Krawall is offline   Reply With Quote
Old 07-03-2014, 00:36   #2
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,537
Re: OSX Development / Compile Questions

Tom,

I too once tried to compile OpenCPN and plugins with static wxWidgets lib. But when I saw each plugin grows so much I gave up and investigate no further. So I go back to dynamic libraries.
I am on Mavericks 10.9.2 and Xcode 5.0.2 currently using wx 3.1.0 daily build 18. February with:
../configure --with-osx_cocoa --enable-debug --enable-shared --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk --with-macosx-version-min=10.8 --enable-unicode --enable-mimetype=yes

I do have some individually done settings in Xcode for OpenCPN and plugins. Some settings for plugins are different. I you want I can send you my Xcode settings. Furthermore I have done several code changes e.g. to get a Mac menue in the upper screen bar with Mac help file and so on.

Gerhard
CarCode is online now   Reply With Quote
Old 07-03-2014, 02:27   #3
Registered User

Join Date: Mar 2014
Location: Hong Kong
Boat: Beneteau Oceanis 40
Posts: 5
Re: OSX Development / Compile Questions

Gerhard,

thanks so much. I feel so useless here at this point as I'm really trying to get up to speed with OSX development so please bear with me.

If you can share your xcode settings (and how) it would be very appreciated.

I will check what configure I've used with mine, and see if that --enable-shared is the cuprit but for sure i'm missing also someother finer points, so yes please let me know how I can get access to your xcode settings!

Cheer and thanks for the swift response.

Tom
__________________
Beneteau Oceanis 40 2008
Krawall is offline   Reply With Quote
Old 07-03-2014, 07:59   #4
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,537
Re: OSX Development / Compile Questions

Tom,
here are my settings for the main code of OpenCPN. The settings for the plugins are a little bit different. Please forget about the Sparkle.framework in that settings, it is for me only to notify about updates. Of course my folder names will be different from yours.

Code:
OTHER_LD Flags:
-arch x86_64 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.1 -lwx_osx_cocoau_webview-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_qa-3.1 -lwx_osx_cocoau_adv-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1 -lwx_osx_cocoau_aui-3.1 -lwx_osx_cocoau_gl-3.1 /Users/heidi/devel/Cocoa-OCPN/buildXcode/Debug/libNMEA0183.a /Users/heidi/devel/Cocoa-OCPN/buildXcode/Debug/libS57ENC.a /Users/heidi/devel/Cocoa-OCPN/buildXcode/Debug/libGARMINHOST.a -framework AGL /usr/lib/libbz2.dylib /usr/lib/libz.dylib -ldl HEADER_SEARCH_PATH: /usr/local/lib/wx/include/osx_cocoa-unicode-3.1 /usr/local/include/wx-3.1 /Users/heidi/devel/Cocoa-OCPN/include /Users/heidi/devel/Cocoa-OCPN/src /Users/heidi/devel/Cocoa-OCPN/src/nmea0183 /Users/heidi/devel/Cocoa-OCPN/src/mygdal /Users/heidi/devel/Cocoa-OCPN/src/garmin/jeeps /usr/X11/include /usr/X11/include/GL "$(FRAMEWORKS_FOLDER_PATH)/Sparkle.framework/Headers" "$(SRCROOT)/Sparkle.framework" "$(SRCROOT)/Sparkle.framework/Headers" /Users/heidi/devel/Cocoa-OCPN/Sparkle.framework
LIBRARY_SEARCH_PATH:
/usr/local/lib /Users/heidi/devel/Cocoa-OCPN/buildXcode/Debug
LLVM 5.0 Compiler Flags
OTHER_CFLAGS:
-arch x86_64 -Wall -Wno-unused -fexceptions -g -fno-strict-aliasing OTHER_CPLUSPLUSFLAGS:
-arch x86_64 -Wno-deprecated -Wno-deprecated-declarations -Wall -Wno-unused -fexceptions -g -fno-strict-aliasing WARNING_CFLAGS: -Wmost -Wno-four-char-constants -Wno-unknown-pragmas
LLVM 5.0 Preprocessing GCC_PREPROCESSOR_DEFINITIONS: 'CMAKE_INTDIR="$(CONFIGURATION)$(EFFECTIVE_PLATFOR M_NAME)"' '_FILE_OFFSET_BITS=64' WXUSINGDLL __WXMAC__ __WXOSX__ __WXOSX_COCOA__ ocpnUSE_GL USE_GLU_TESS TIXML_USE_STL USE_S57 USE_GARMINHOST USE_SPARKLE

Gerhard
CarCode is online now   Reply With Quote
Old 08-03-2014, 06:16   #5
Registered User

Join Date: Mar 2014
Location: Hong Kong
Boat: Beneteau Oceanis 40
Posts: 5
Re: OSX Development / Compile Questions

Gerhard,

thanks a lot, I got it all compiled now.

I have to settle down the project with all settings and getting git to work with it, then I'm ready for some dev'ving.

The changes that you made, are they to be included in the master branch anytime soon?

Thanks,

Tom
__________________
Beneteau Oceanis 40 2008
Krawall is offline   Reply With Quote
Old 08-03-2014, 06:30   #6
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,194
Re: OSX Development / Compile Questions

It depends on when (and if) Gerhard contributes them. The pull request that are not obviously broken are merged into the master fast.

Pavel
nohal is online now   Reply With Quote
Old 09-03-2014, 23:58   #7
Registered User

Join Date: Jul 2010
Posts: 51
Re: OSX Development / Compile Questions

Quote:
Originally Posted by Krawall View Post
Hello all,


I've compiled from the recent master, and have found that the performance (using CM93 maps) was much quicker and snappier than the compiled version downloaded from the opencpn page. For what's it worth; I didn't run benchmarks but it felt quite a bit faster (disabled opengl and running on my retina MBP later 2013).
Since you have a MBP Retina, maybe you could try to make OpenCPN run at Retina resolution? It would be appreciated.
stensmo is offline   Reply With Quote
Old 10-03-2014, 17:05   #8
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,387
Re: OSX Development / Compile Questions

Krawall....

I'd like to know more about your impressions that your local builds are snappier than the current opencpn.org downloadable DMG.

Any quantification of "snappier" possible? Any ideas why?

Thanks
Dave
bdbcat is offline   Reply With Quote
Old 10-03-2014, 23:10   #9
Registered User

Join Date: Mar 2014
Location: Hong Kong
Boat: Beneteau Oceanis 40
Posts: 5
Re: OSX Development / Compile Questions

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

I'd like to know more about your impressions that your local builds are snappier than the current opencpn.org downloadable DMG.

Any quantification of "snappier" possible? Any ideas why?

Thanks
Dave
Dave, if you want, and are on Mavericks, I can get you one of my installs over and you can judge. I haven't run any tests but I had a lot of delays when using the downloadable version, in zooming in or any other action that I did. None of these stutters have happened in my version so far.

But I can only compile for Mavericks, so perhaps that's a reason why... I probably shouldn't have made the remark in the first place, as it was just my initial impression. Apologies to confuse.

Quote:
Originally Posted by stensmo View Post
Since you have a MBP Retina, maybe you could try to make OpenCPN run at Retina resolution? It would be appreciated.
Let me check this but please don't forget I'm just starting with all this OSX stuff and so far I've barely managed to compile sources that dozens of people have worked on tirelessly over the past years.

So while I hope I can contribute with time, I may be completely and utterly failing ;-)

Tom
__________________
Beneteau Oceanis 40 2008
Krawall is offline   Reply With Quote
Old 11-03-2014, 02:44   #10
Registered User

Join Date: Jul 2010
Posts: 51
Re: OSX Development / Compile Questions

Quote:
Originally Posted by Krawall View Post
Dave, if you want, and are on Mavericks, I can get you one of my installs over and you can judge. I haven't run any tests but I had a lot of delays when using the downloadable version, in zooming in or any other action that I did. None of these stutters have happened in my version so far.

But I can only compile for Mavericks, so perhaps that's a reason why... I probably shouldn't have made the remark in the first place, as it was just my initial impression. Apologies to confuse.



Let me check this but please don't forget I'm just starting with all this OSX stuff and so far I've barely managed to compile sources that dozens of people have worked on tirelessly over the past years.

So while I hope I can contribute with time, I may be completely and utterly failing ;-)

Tom
Sounds great! Retina support and power saving for Mavericks would be nice. OpenCPN uses a lot of battery, so an improvement would be appreciated.
stensmo is offline   Reply With Quote
Old 11-03-2014, 03:15   #11
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,537
Re: OSX Development / Compile Questions

Please keep in mind that OpenCPN depends on and was written with wxWidgets. Most of the graphics comes from wxWidgets which might be the bottleneck often. The OS X port of wxWidgets is still young and not so good developed as the Windows or Linux port.

Gerhard
CarCode is online now   Reply With Quote
Old 11-03-2014, 15:36   #12
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,537
Re: OSX Development / Compile Questions

Quote:
Originally Posted by stensmo View Post
Sounds great! Retina support and power saving for Mavericks would be nice. OpenCPN uses a lot of battery, so an improvement would be appreciated.
OpenCPN uses nearly the same amount of energy as e.g.Firefox here. The attached picture is OS X Mavericks.

Gerhard
Attached Thumbnails
Click image for larger version

Name:	Energy.png
Views:	140
Size:	147.4 KB
ID:	77412  
CarCode is online now   Reply With Quote
Old 12-03-2014, 17:50   #13
Registered User

Join Date: Mar 2014
Posts: 5
Re: OSX Development / Compile Questions

Dave,

I'm observing the same difference between OpenCPN releases for OS X and my local builds for Mavericks. I would suspect that the wxWidgets 3.0.0 build is very different from the 2.9 build, and any 3.x build might be faster on OS X.

Here was my starting platform (all latest versions, as of Mar 6, 2014): OS X 10.9.2, Xcode 5.0.2 -- Using OS X 10.9 SDK and command line tools, Cmake 2.8.12, OpenCPN 3.3.419, wxWidgets-3.0.0, and gettext 0.18.3.2.

It seems that wxWidgets 3.0.0 isn't compatible with the OpenCPN code using this combination of platforms without introducing some macro definitions to resolve ambiguous function definitions (this looks like a problem in wxWidgets, not OpenCPN, but it's fixable by modifying the OpenCPN code). There may have been a more elegant fix, but I got it to work by patching printable.cpp, routeprintout.cpp, and remove most of scrollingdialog.cpp and scrollingdialog.h (many of the classes defined here are now included in wxWidgets 3.0, so including them causes conflicts). I've seen other people reporting compiling for wxWidgets >=3.x without mentioning this, so I don't understand how they're managing that, but I'd suspect my methods before theirs.

I can't quantify snappy, but interface response feels instant on the OS X 10.9 builds, while there's noticeable lag in the stable OpenCPN OS X releases.

Cheers,

Brad

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

I'd like to know more about your impressions that your local builds are snappier than the current opencpn.org downloadable DMG.

Any quantification of "snappier" possible? Any ideas why?

Thanks
Dave
bjbest is offline   Reply With Quote
Old 13-03-2014, 01:51   #14
Registered User

Join Date: Jul 2010
Location: Hannover - Germany
Boat: Amel Sharki
Posts: 2,537
Re: OSX Development / Compile Questions

Latest version of Xcode is 5.1 not 5.0.2.

Have you ever checked your syslog? Are there lines like that?

Code:
13.03.14 09:46:02,663 OpenCPN[508]: CoreText performance note: Client called CTFontCreateWithName() using name "Times" and got font with PostScript name "Times-Roman". For best performance, only use PostScript names when calling this API.
That is a typical issue of wxWidgets not knowing Mavericks style although I'm using wx 3.1.0.

Gerhard
CarCode is online now   Reply With Quote
Old 13-03-2014, 10:30   #15
Registered User

Join Date: Mar 2014
Posts: 5
Re: OSX Development / Compile Questions

Regarding Xcode versions, the Xcode 5.1 update wasn't available on March 6th when I last updated my toolchain to build OpenCPN and I haven't rebuilt since that 5.1 update became available.

Regarding lines in the syslog, I don't have any log messages in opencpn.log (or anywhere else) matching the string "CoreText".

Cheers,

Brad

Quote:
Originally Posted by CarCode View Post
Latest version of Xcode is 5.1 not 5.0.2.

Have you ever checked your syslog? Are there lines like that?

Code:
13.03.14 09:46:02,663 OpenCPN[508]: CoreText performance note: Client called CTFontCreateWithName() using name "Times" and got font with PostScript name "Times-Roman". For best performance, only use PostScript names when calling this API.
That is a typical issue of wxWidgets not knowing Mavericks style although I'm using wx 3.1.0.

Gerhard
bjbest is offline   Reply With Quote
Reply

Tags
men

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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


Advertise Here


All times are GMT -7. The time now is 03:23.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.