Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 20-08-2020, 07:01   #2611
Registered User

Join Date: Mar 2011
Posts: 732
Re: Beta Test / Technical

In the process of upgrading TwoCan plugin to support OpenCPN 5.2 and Plugin Manager.
Have reverted to just using the existing version of the plugin (v 1.8) with very minor changes so that it can just be installed as an "old" unmanaged plugin.
The minor code changes are merely just to support OpenCPN Plugin API 1.16.
Code:
inc/twocanplugin.h
class TwoCan : public opencpn_plugin_116, public wxEvtHandler {
....
src/twocanplugin.cpp
TwoCan::TwoCan(void *ppimgr) : opencpn_plugin_116(ppimgr), wxEvtHandler()
...
and returning the correct value for
TwoCan::GetAPIVersionMinor()
and building with the newer header ocpn_plugin.h and opencpn.lib library file.

It installs and runs as expected, however crashes OpenCPN upon exit. Snippet of opencpn.log following crash on exit:
Code:
22:56:29.150 MESSAGE twocandevice.cpp:591 TwoCan Device, Driver read thread started: 0
22:56:29.170 MESSAGE chart1.cpp:6860 OnInitTimer...3
22:56:29.280 MESSAGE chart1.cpp:6860 OnInitTimer...4
22:56:31.576 MESSAGE options.cpp:5819 options: got device count: 1
22:56:32.148 MESSAGE chart1.cpp:8796 Changing NMEA Datasource for IIDBT to  (Priority: 0)
22:56:32.303 MESSAGE chart1.cpp:6860 OnInitTimer...5
22:56:32.401 MESSAGE chart1.cpp:6860 OnInitTimer...6
22:56:32.401 MESSAGE chart1.cpp:7155 OnInitTimer...Last Call
22:56:32.401 MESSAGE chart1.cpp:7173 OnInitTimer...Finalize Canvases
22:57:26.282 MESSAGE chart1.cpp:7551 LOGBOOK:  2020-08-20 12:57:26 UTC  GPS Lat   43.76089 Lon    7.50066 COG  220.80000 SOG   5.89 kts
23:00:00.377 MESSAGE chart1.cpp:7551 LOGBOOK:  2020-08-20 13:00:00 UTC  GPS Lat   43.76029 Lon    7.49993 COG  214.10000 SOG   6.08 kts
On the other hand, if I disable the plugin prior to exiting, the plugin closes down cleanly and OpenCPN does not crash on exit. Snippet of log:
Code:
23:14:58.945 MESSAGE pluginmanager.cpp:1634 PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\twocan_pi.dll
23:14:58.945 MESSAGE twocanplugin.cpp:284 TwoCan Plugin, Terminating device thread id (0x2544)

23:14:58.959 MESSAGE twocanplugin.cpp:287 TwoCan Plugin, TwoCan Device Thread Delete Result: 0
23:14:58.965 MESSAGE twocandevice.cpp:642 TwoCan Device, Read Thread exiting
23:14:58.965 MESSAGE twocandevice.cpp:365 TwoCan Device, Unloaded driver: 0
23:15:00.954 MESSAGE routeman.cpp:1251 DPMM: 3.76471   ScaleFactorExp: 1
23:15:00.954 MESSAGE routeman.cpp:1258 Looking for UserIcons at C:\ProgramData\opencpn\UserIcons/
23:15:00.980 MESSAGE chcanv.cpp:2350 Metrics:  m_display_size_mm: 510     g_Platform->getDisplaySize():  1920:1080   
23:15:00.980 MESSAGE chcanv.cpp:2355 wxDisplaySize(): 1920 1080
23:15:02.318 MESSAGE routeman.cpp:1251 DPMM: 3.76471   ScaleFactorExp: 1
23:15:02.318 MESSAGE routeman.cpp:1258 Looking for UserIcons at C:\ProgramData\opencpn\UserIcons/
23:15:02.344 MESSAGE chcanv.cpp:2350 Metrics:  m_display_size_mm: 510     g_Platform->getDisplaySize():  1920:1080   
23:15:02.344 MESSAGE chcanv.cpp:2355 wxDisplaySize(): 1920 1080
23:15:02.437 MESSAGE glChartCanvas.cpp:693 BuildFBO 3
23:15:02.438 MESSAGE glChartCanvas.cpp:1177 OpenGL Framebuffer OK, size = 1326
23:15:02.486 MESSAGE glChartCanvas.cpp:693 BuildFBO 3
23:15:02.488 MESSAGE glChartCanvas.cpp:1177 OpenGL Framebuffer OK, size = 1326
23:15:02.507 MESSAGE glChartCanvas.cpp:693 BuildFBO 3
23:15:02.508 MESSAGE glChartCanvas.cpp:1177 OpenGL Framebuffer OK, size = 1326
23:15:02.553 MESSAGE glChartCanvas.cpp:693 BuildFBO 3
23:15:02.554 MESSAGE glChartCanvas.cpp:1177 OpenGL Framebuffer OK, size = 1326
23:15:04.699 MESSAGE chart1.cpp:7405    ***GPS Watchdog timeout at Lat:43.7618   Lon: 7.50171
23:15:06.949 MESSAGE pluginmanager.cpp:1634 PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\chartdldr_pi.dll
23:15:06.949 MESSAGE chartdldr_pi.cpp:224 chartdldr_pi: DeInit
23:15:06.949 MESSAGE pluginmanager.cpp:1634 PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\wmm_pi.dll
23:15:06.949 MESSAGE chart1.cpp:3878 opencpn::MyFrame exiting cleanly.
23:15:07.095 MESSAGE chartdb.cpp:326 Chart cache PlugIn purge
23:15:07.095 MESSAGE pluginmanager.cpp:1634 PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\chartdldr_pi.dll
23:15:07.096 MESSAGE pluginmanager.cpp:1634 PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\dashboard_pi.dll
23:15:07.096 MESSAGE pluginmanager.cpp:1634 PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\twocan_pi.dll
23:15:07.154 MESSAGE chart1.cpp:2614 opencpn::MyApp starting exit.
23:15:07.158 MESSAGE chart1.cpp:2651 LOGBOOK:  2020-08-20 13:15:07 UTC OFF: Lat   43.76178 Lon    7.50171
23:15:07.165 MESSAGE TCDataSource.cpp:43 UnLoading Tide/Current data source: C:\Program Files (x86)\OpenCPN\tcdata\HARMONIC.IDX
23:15:07.175 MESSAGE chart1.cpp:2674 opencpn::MyApp exiting cleanly...
Under OpenCPN 5.0, which exits cleanly, this opencpn.log also indicating a clean exit.
Code:
10:44:19 PM: PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\twocan_pi.dll
10:44:19 PM: TwoCan Plugin, Terminating device thread id (0x25a4)
10:44:19 PM: TwoCan Plugin, TwoCan Device Thread Delete Result: 0
10:44:19 PM: opencpn::MyFrame exiting cleanly.
10:44:19 PM: Chart cache purge
10:44:19 PM: Chart cache PlugIn purge
10:44:19 PM: PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\chartdldr_pi.dll
10:44:19 PM: PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\wmm_pi.dll
10:44:19 PM: PlugInManager: Deactivating PlugIn: C:\Program Files (x86)\OpenCPN\plugins\twocan_pi.dll
10:44:19 PM: TwoCan Device, Read Thread exiting
10:44:19 PM: TwoCan Device, Unloaded driver: 0
10:44:19 PM: Chart cache purge
10:44:19 PM: opencpn::MyApp starting exit.
10:44:19 PM: LOGBOOK:  2020-08-20 12:44:19 UTC OFF: Lat   40.00728 Lon    4.19760 COG    0.00000 SOG   0.10 kts
10:44:19 PM: UnLoading Tide/Current data source: C:\Program Files (x86)\OpenCPN\tcdata\HARMONIC.IDX
10:44:19 PM: opencpn::MyApp exiting cleanly...
I've tried stepping through the debugger but to no avail. I can step through the debugger from PlugInManager:: DeactivatePlugIn onwards but there is an ecxception immediately after the following in chart1.cpp
Code:
this->Destroy();
    gFrame = NULL;

#ifdef __OCPN__ANDROID__
#ifndef USE_ANDROID_GLES2
    qDebug() << "Calling OnExit()";
    wxTheApp->OnExit();
#endif
#endif

}
The exception message is:
Code:
Exception thrown at 0x010CD120 in opencpn.exe: 0xC0000005: Access violation reading location 0x77DFEB64. occurred
The twocan plugin code is on https://github.com/twocanplugin/twocanplugin under the ocpn5.2 branch.
Any help or advice would be appreciated.
stevead is offline   Reply With Quote
Old 20-08-2020, 07:33   #2612
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,500
Re: Beta Test / Technical

Steve...
I'll take a look at this tonight.
Please stand by.


Dave
bdbcat is offline   Reply With Quote
Old 20-08-2020, 18:01   #2613
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Beta Test / Technical

Fixed with Statusbar_pi v0.7.6.0 and submitted to master catalog.

We should really have Preferences selection for 'Show only Right Screen' or "Show only Left Screen". I would really appreciate a PR for this.



Quote:
Originally Posted by rgleason View Post
Sean's Statusbar_pi requires the "Preferences" button to provide access to settings. Currently "Preferences" is greyed out, but it was working previously.

https://github.com/rgleason/statusbar_pi/commits/master
rgleason is offline   Reply With Quote
Old 20-08-2020, 19:19   #2614
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,500
Re: Beta Test / Technical

Steve...
I tried a simple build/install on linux, branch ocpn5.2, legacy ("old") build.

No problems starting or stopping.
Are there any particular settings/configuration that is important for this test, or any that provoke a crash? Or could it be Windows only problem?



Dave
bdbcat is offline   Reply With Quote
Old 20-08-2020, 21:59   #2615
Registered User

Join Date: Mar 2011
Posts: 732
Re: Beta Test / Technical

Hi Dave,

I have yet to test on Linux yet, however I get the same problem on both Windows & OSX. I have only stepped through with the debugger on Windows.

I think I have managed to solve the problem (or at least hide the symptoms ??) by adding wxLog::FlushActive() calls in the destructors for both the TwoCanDevice and TwoCanPlugin classes. Now on both Windows & Mac, OpenCPN shuts down cleanly and with the expected flow of messages in opencpn.log.

I'll now continue with converting the legacy plugin to the new Plugin Manager and see whether they now also shutdown gracefully.

Thanks.
stevead is offline   Reply With Quote
Old 21-08-2020, 22:29   #2616
Registered User

Join Date: Mar 2011
Posts: 732
Re: Beta Test / Technical

Quote:
Originally Posted by bdbcat View Post
Steve...
I tried a simple build/install on linux, branch ocpn5.2, legacy ("old") build.

No problems starting or stopping.
Are there any particular settings/configuration that is important for this test, or any that provoke a crash? Or could it be Windows only problem?

Dave
Hi Dave,

Just tested on Ubuntu 18.04.4 LTS. From a UI perspective it is asymptomatic (doesn't appear to crash), however on further examination the opencpn.log indicates that OpenCPN did not shutdown cleanly, the file startcheck.dat is present and upon restarting OpenCPN it displays the "Safe Restart" dialog.

The good news at least is that adding wxLog::FlushActive solves the problem, not that I understand what the problem is. Debugging chart1, plugin manager and wxWidgets to that level is a tad beyond my pay grade.
stevead is offline   Reply With Quote
Old 24-08-2020, 04:30   #2617
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Beta Test / Technical

Dave, I am locked out of the wiki again. This seems to happen when I try to fix certain pages and links that are screwed up, which makes it even harder to fix, because it is several days before I get access again. I wish I knew what caused this bothersome thing to happen.
rgleason is offline   Reply With Quote
Old 24-08-2020, 07:14   #2618
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,500
Re: Beta Test / Technical

Rick...
Your IP?


Dave
bdbcat is offline   Reply With Quote
Old 24-08-2020, 08:32   #2619
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Beta Test / Technical

Dave, sorry. Will sent via email.
rgleason is offline   Reply With Quote
Old 24-08-2020, 12:30   #2620
Registered User

Join Date: Feb 2011
Posts: 1,128
Re: Beta Test / Technical

Request for informations:-
Does anyone has tide tables of Brazil that has the informations differences along the Rio Amazonas and could spare me a print copy of the offset along the river? If so, it would help me to check the job done.
Thanks.
P_Dub is offline   Reply With Quote
Old 25-08-2020, 03:51   #2621
Registered User

Join Date: Mar 2011
Posts: 732
Re: Beta Test / Technical

CMAKE & MacOSX runtime paths.

For the TwoCan plugin on OSX to support the Rusoku CAN adapter I require a Rusoku dynamic library. Ordinarily a user needs to compile & install this dylib which ordinarily would reside in /usr/local/lib.

I wish to avoid this and install the dylib as part of the Plugin Manager installation into my plugin's data directory so that users do not have to download, compile & install a third party library and also in case they uninstall the plugin, the Rusoku library would also be removed.

I have yet to figure out the cmake commands to do this.

With the current frontend2 builds, the twocan plugin builds & installs, however fails to load if the third party library is no installed in /usr/local/lib with the expected OS X error.
Code:
18:06:36.289   ERROR dlunix.cpp:162 dlopen(/Users/stevead/Library/Application Support/OpenCPN/Contents/PlugIns/libtwocan_plugin_pi.dylib, 2): Library not loaded: libTouCAN.0.1.dylib
  Referenced from: /Users/stevead/Library/Application Support/OpenCPN/Contents/PlugIns/libtwocan_plugin_pi.dylib
  Reason: image not found
Viewing the plugin dylib with otool shows that the LC_LOAD_DYLIB name does not have the correct path.
Code:
Load command 11
          cmd LC_LOAD_DYLIB
      cmdsize 160
         name libTouCAN.0.1.dylib (offset 24)
   time stamp 2 Thu Jan  1 10:00:02 1970
      current version 0.0.0
compatibility version 0.0.0
If I use the command
Code:
install_name_tool -change libTouCAN.0.1.dylib "/Users/stevead/Library/Application Support/OpenCPN/Contents/SharedSupport/plugins/twocan_plugin_pi/data/drivers/libTouCAN.0.1.dylib" libtwocan_plugin_pi.dylib
the runtime path is resolved correctly and the plugin runs as expected.

I think the runtime path to be used would be of the form
Code:
"@executable_path/./../Contents/SharedSupport/plugins/twocan_plugin_pi/data/drivers"
Does anyone know what is the correct CMAKE command to achieve this ? I am not sure which of the many (and for me confusing) CMAKE RPATH commands to use.

Thanks in advance.
stevead is offline   Reply With Quote
Old 26-08-2020, 15:22   #2622
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Beta Test / Technical

Dave, I am still locked out. I sent one email with the IP and then responded to your email with the IP, but evidently both emails were sent to trash or junk.
So here is the ip (which I really did not want to be public) My Public IPv4 is: 73.60.236.200
rgleason is offline   Reply With Quote
Old 26-08-2020, 16:42   #2623
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Beta Test / Technical

I would really appreciate some help getting Celestial Navigation working again since ov50. With the new frontend2 configuration we are getting a lot of "macro redefinition" and many many "identifier not found" errors.


Please see

https://github.com/OpenCPN/plugins/issues/234
rgleason is offline   Reply With Quote
Old 26-08-2020, 16:49   #2624
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,766
Images: 2
Re: Beta Test / Technical

Steve, maybe what bdbcat did for copying the "icons" directory and files (similar location to the "data" directory) will help you accomplish what is needed. I am going to point to a commit in climatology. We needed to do this so the green puzzle icon would not show, due to the fact that the 'data' directory was a virtual directory being hosted on Sean's repository which is used for all downloads of 32 years of weather data.


https://github.com/rgleason/climatol...bc941ed92e0115


Dave made some changes to Jon's cmake/PluginInstall

which I hope will help. It accomplished exactly what we needed. I was surprized he did it in PluginInstall, but it does make sense. Perhaps you could add a file to the Extras directory that Jon has provided for plugin particulars and then call that? He is going to use that Extras folder for doing things specific to Ocpn_draw.

Quote:
Originally Posted by stevead View Post
CMAKE & MacOSX runtime paths.

For the TwoCan plugin on OSX to support the Rusoku CAN adapter I require a Rusoku dynamic library. Ordinarily a user needs to compile & install this dylib which ordinarily would reside in /usr/local/lib.

I wish to avoid this and install the dylib as part of the Plugin Manager installation into my plugin's data directory so that users do not have to download, compile & install a third party library and also in case they uninstall the plugin, the Rusoku library would also be removed.

I have yet to figure out the cmake commands to do this.

With the current frontend2 builds, the twocan plugin builds & installs, however fails to load if the third party library is no installed in /usr/local/lib with the expected OS X error.
Code:
18:06:36.289   ERROR dlunix.cpp:162 dlopen(/Users/stevead/Library/Application Support/OpenCPN/Contents/PlugIns/libtwocan_plugin_pi.dylib, 2): Library not loaded: libTouCAN.0.1.dylib
  Referenced from: /Users/stevead/Library/Application Support/OpenCPN/Contents/PlugIns/libtwocan_plugin_pi.dylib
  Reason: image not found
Viewing the plugin dylib with otool shows that the LC_LOAD_DYLIB name does not have the correct path.
Code:
Load command 11
          cmd LC_LOAD_DYLIB
      cmdsize 160
         name libTouCAN.0.1.dylib (offset 24)
   time stamp 2 Thu Jan  1 10:00:02 1970
      current version 0.0.0
compatibility version 0.0.0
If I use the command
Code:
install_name_tool -change libTouCAN.0.1.dylib "/Users/stevead/Library/Application Support/OpenCPN/Contents/SharedSupport/plugins/twocan_plugin_pi/data/drivers/libTouCAN.0.1.dylib" libtwocan_plugin_pi.dylib
the runtime path is resolved correctly and the plugin runs as expected.

I think the runtime path to be used would be of the form
Code:
"@executable_path/./../Contents/SharedSupport/plugins/twocan_plugin_pi/data/drivers"
Does anyone know what is the correct CMAKE command to achieve this ? I am not sure which of the many (and for me confusing) CMAKE RPATH commands to use.

Thanks in advance.
rgleason is offline   Reply With Quote
Old 26-08-2020, 17:44   #2625
Registered User

Join Date: Mar 2011
Posts: 732
Re: Beta Test / Technical

Thanks Rick,

I thought there was an "elegant" solution using one of the CMAKE commands such as
Code:
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_INSTALL_RPATH "path to the lib")
but they didn't work.

in the end I used a sledgehammer
Code:
ADD_CUSTOM_COMMAND( POST_BUILD
      TARGET ${PACKAGE_NAME} 
      COMMAND install_name_tool -add_rpath "@loader_path/./../SharedSupport/plugins/${PACKAGE_NAME}/data/drivers" "lib${PACKAGE_NAME}.dylib"
      COMMAND install_name_tool -change libTouCAN.0.1.dylib @rpath/libTouCAN.0.1.dylib lib${PACKAGE_NAME}.dylib)
Ugly, but it works.
stevead is offline   Reply With Quote
Reply


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
Beta Marine Diesel michaelmrc Engines and Propulsion Systems 48 23-03-2016 13:44
Need some technical advice....antennas. Just a Tinch Marine Electronics 15 01-12-2007 15:57
Blue Sea Systems Technical Brief GordMay Electrical: Batteries, Generators & Solar 0 16-03-2007 04:16
technical difficulties witchcraft The Sailor's Confessional 1 30-05-2005 14:09
Dow Corning Technical Manual GordMay The Library 0 12-04-2005 16:25

Advertise Here


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


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.