Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 25-08-2016, 13:01   #496
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 8,015
GIT WORKFLOW - Final, Summary

This is the workflow:

1. github.com/author/project (upstream)
2. Local PC github repository (git cloned)
- git fetch upstream
- git checkout master
- git merge upstream/master
3. github.com/yourname/project (origin) (forked from the author) to update your repos
-git push origin master

Now, regarding your own work. Always Always make a NEW BRANCH and work out of that. Then when you are ready,
- git checkout <the new branch>
- git push origin <the new branch>

Then from your github directory while in the project, find the new branch and make a Pull Request out of it.

This is what your remote should look like. Sean is the author, I just help occasionally when I can.

C:\Users\Rick\Documents\GitHub\o-plugin\s-weatherfax_pi>git remote -v
origin https://github.com/rgleason/weatherfax_pi.git (fetch)
origin https://github.com/rgleason/weatherfax_pi.git (push)
upstream git://github.com/seandepagnier/weatherfax_pi.git (fetch)
upstream git://github.com/seandepagnier/weatherfax_pi.git (push)
__________________

__________________
rgleason is online now   Reply With Quote
Old 11-02-2017, 15:08   #497
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 8,015
Re: Development Debugging Environment - Setup Help

For those learning to Compile OpenCPN, learn Githiub, or learn how to compile Plugins this is a good thread to post to because it provides a common place for everyone interested in this topic.

By searching this thread, it is likely you will find some answers to your questions.
__________________

__________________
rgleason is online now   Reply With Quote
Old 12-02-2017, 02:46   #498
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

I am talking development under Windows here.

Under "3.1 Get binary dependencies" it states that if you are to make Release builds and create setup packages you need to get OpenCPN_buildwin.7z.
I Have fond that you do need to do this even if you are just compiling either for release or debug.

Can anyone confirm this ? If I get confirmation on this I will change the document.

/Hans
__________________
hasse_A is offline   Reply With Quote
Old 12-02-2017, 04:51   #499
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 1,799
Re: Development Debugging Environment - Setup Help

Hans
Confirmed! Cairo.....etc are needed for the debug build as well.
Håkan
__________________
Hakan is offline   Reply With Quote
Old 12-02-2017, 08:02   #500
Registered User
 
transmitterdan's Avatar

Join Date: Oct 2011
Boat: Valiant 42
Posts: 3,265
Re: Development Debugging Environment - Setup Help

Be aware that there are duplicate files in the binary dependencies .7z file as well as in the Git repository. Don't overwrite the ones that come from from the repository else it causes problems with pull requests.
__________________
transmitterdan is offline   Reply With Quote
Old 12-02-2017, 08:35   #501
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

Quote:
Originally Posted by transmitterdan View Post
Be aware that there are duplicate files in the binary dependencies .7z file as well as in the Git repository. Don't overwrite the ones that come from from the repository else it causes problems with pull requests.
Thank transmitterdan!

I have updated the manual with your note.

/Hans
__________________
hasse_A is offline   Reply With Quote
Old 13-02-2017, 10:48   #502
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

Hello all!

I am missing a development manual on how to debug a plugin in Visual Studio.

I am tying to debug the weatherfax_pi but am getting compiler errors I have trouble to sort out and need someone to lead me in the right direction.

In the process of getting the plugin working within VS I would like to write a manual describing the procedure how to debug a plugin with VS in Windows.
I know there are a few preferred ways among you.

I have no problems compiling the weatherfax_pi standalone and generating an install package. The problem is building/compiling within VS.

There are more than 200 errors.
The first error points to this line:

ssize_t read(void *data, size_t nbytes);

VS says ssize_t is undefined.

Error 1 error C2146: syntax error : missing ';' before identifier 'read' c:\users\hasse\opencpn\plugins\weatherfax_pi\src\l ibaudiofile\modules\FileModule.h 35 1 weatherfax_pi

Is ssize_t not predefined or where should it be defined.
I have a feeling all of the errors depend on just one missing file/misplacement.

/Hans
__________________
hasse_A is offline   Reply With Quote
Old 14-02-2017, 14:01   #503
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 1,799
Re: Development Debugging Environment - Setup Help

Hans
I haven't tried to build this plugin before so I made a try.
Here's from my consol and some more:
C:\Builds\OCPN>git clone https://github.com/seandepagnier/weatherfax_pi
Cloning into 'weatherfax_pi'...
remote: Counting objects: 1755, done.
remote: Total 1755 (delta 0), reused 0 (delta 0), pack-reused 1755
Receiving objects: 100% (1755/1755), 1.58 MiB | 958.00 KiB/s, done.
Resolving deltas: 100% (1208/1208), done.
Checking connectivity... done.

C:\Builds\OCPN>cd weatherfax_pi

C:\Builds\OCPN\weatherfax_pi>md build

C:\Builds\OCPN\weatherfax_pi>cd build

C:\Builds\OCPN\weatherfax_pi\build>cmake -T v120_xp ..
-- Building for: Visual Studio 12 2013
-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler using: Visual Studio 12 2013
-- Check for working C compiler using: Visual Studio 12 2013 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 12 2013
-- Check for working CXX compiler using: Visual Studio 12 2013 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *** Staging to build weatherfax_pi ***

..............A lot info deleted here


-- Generating done
-- Build files have been written to: C:/Builds/OCPN/weatherfax_pi/build

C:\Builds\OCPN\weatherfax_pi\build>copylib => my own bat file to copy OCPN.lib
C:\Builds\OCPN\OpenCPN\build\Release\opencpn.lib -> C:\Builds\OCPN\weatherfax_pi\build\opencpn.lib
1 File(s) copied
C:\Builds\OCPN\weatherfax_pi>

Then I opened: \build\weatherfax_pi.sln with VS2013 and build for Release.
Ooops One error No \Buildwin\portaudio_x86.dll !!
Read Seans Github: There are also some libraries and an external program needed:
http://sourceforge.net/projects/open...12.7z/download
OK- Buildwin also there. After that VS2013 builds w/o error.
Then I built for Debug also w/o errors.
BUT-
To actually run it in Debug inside OCPN I use to also clone and build it in
c:\......OpenCPN\Plugins\ Beside Dashboard and the other.
You have to edit pluginmanager.cpp to something like this:
Row: ~308 (Well I've some auto copying but the method is to copy all plugin dll's, you want to debug, to one folder specified herein)
Code:
   #if _DEBUG    //Has for debug use
#ifdef __WXMSW__
    bool x;
    wxString f, volume, path, name, ext, mess;
    wxString destf, Dest = _T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\Debug_pi\\");

    f = wxFindFirstFile(_T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\dashboard_pi\\Debug\\*.*"), wxFILE);
        while (!f.empty())
        {
            wxFileName::SplitPath(f, &volume, &path, &name, &ext);
            destf = Dest;
            destf << name << _T(".") << ext;
            x = wxCopyFile(f, destf, true);
            f = wxFindNextFile();
        }
        mess = name;

    f = wxFindFirstFile(_T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\wmm_pi\\Debug\\*.*"), wxFILE);
        while (!f.empty())
        {
            wxFileName::SplitPath(f, &volume, &path, &name, &ext);
            destf = Dest;
            destf << name << _T(".") << ext;
            x = wxCopyFile(f, destf, true);
            f = wxFindNextFile();
        }
        mess << _T(" and ") << name;
        //x = wxCopyFile(_T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\BR24radar_pi\\Debug\\br24radar_pi.dll"),
        //  _T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\Debug_pi\\br24radar_pi.dll"), true);
        if (0) { // Set 1 for BR24
            f = wxFindFirstFile(_T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\BR24radar_pi\\Debug\\*.*"), wxFILE);
            while (!f.empty())
            {
                wxFileName::SplitPath(f, &volume, &path, &name, &ext);
                destf = Dest;
                destf << name << _T(".") << ext;
                x = wxCopyFile(f, destf, true);
                f = wxFindNextFile();
            }
            mess << _T(" and ") << name;
        }
        mess << _T(" copied to ") << Dest;
        //wxMessageBox(mess, _T("Debug - Plugin info"));  

    m_plugin_location = _T("C:\\Builds\\OCPN\\OpenCPN\\build\\plugins\\Debug_pi\\");
#endif
    #else
        m_plugin_location = plugin_dir;
    #endif
Håkan
__________________
Hakan is offline   Reply With Quote
Old 15-02-2017, 03:27   #504
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

Quote:
Originally Posted by Hakan View Post
To actually run it in Debug inside OCPN I use to also clone and build it in
c:\......OpenCPN\Plugins\ Beside Dashboard and the other.
Håkan
Thanks. That helped a lot.
Now what do you mean by clone?

Do you just copy the stand alone weatherfax_pi into OpenCPN\plugins\ ?

/Hans
__________________
hasse_A is offline   Reply With Quote
Old 15-02-2017, 05:51   #505
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 1,799
Re: Development Debugging Environment - Setup Help

Hans
I mean the Git command "clone" like this, from my commands above:


C:\Builds\OCPN>git clone https://github.com/seandepagnier/weatherfax_pi
Cloning into 'weatherfax_pi'...

I think "clone" is in principal the same as "fetch".
Håkan
__________________
Hakan is offline   Reply With Quote
Old 15-02-2017, 09:06   #506
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

No, I can not get this to work.

I download the weatherfax_pi to sit in // with the other plugins under
OpenCPN\plugins.

I create OpenCPN\plugins\weatherfax_pi\build
I copy opencpn.lib to this build directory, not buildwin

Then I copy portaudio_x86.dll and portaudio_x86.lib to OpenCPN\plugins\weatherfax_pi\buildwin

I copy buildwin directory downloaded as said on weatherfax_pi git page
and place that under OpenCPN\plugins\weatyherfax_pi
(This is a merge with the existing files under buildwin)

Then I copy PVW32Con.exe to OpenCPN\plugins\weatherfax_pi\buildwin

Then I run copyfiles.bat (Håkans bat-file) under OpenCPN\plugins\weatherfax_pi

I cd into OpenCPN\build and do cmake -T v120_xp ..

All is well (no errors) up until now.

I start Visual Studio 2013.

What happens is that in the Solution Explorer Window under weatherfax_pi there is not the structure I think should be there. Se attachment.
Compare with grib_pi. For instance there is no Source or Header folders.

When I try to build I get 271 errors.

/Hans
Attached Thumbnails
Click image for larger version

Name:	VS_errors.jpg
Views:	19
Size:	280.1 KB
ID:	141340  
__________________
hasse_A is offline   Reply With Quote
Old 15-02-2017, 10:06   #507
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 1,799
Re: Development Debugging Environment - Setup Help

Hans
Let's see if can describe my method to have a plugin inside OCPN repo:
My build path is : C:\Builds\OCPN\OpenCPN\
> I cd: C:\Builds\OCPN\OpenCPN\plugins\
> Do: Git fetch(clone) https\\...........weatherfax_pi
weatherfax_pi should now be in C:\Builds\OCPN\OpenCPN\plugins\weatherfax_pi
Now copy the two files needed to weatherfax_pi\buildwin

Since we're now inside OCPN you neither need any weatherfax_pi\build directory nor copy the ocpencpn.lib file.

If necessary or not at this stage i use to rerun cmake -T v120_xp .. in opencpn\build\ because now we're inside OCPN and what's there should be build together with OCPN as the inbound plugins.
Then open your normal OpenCPN.sln in VS2013 and build as usual. weatherfax will be built together with OCPN and the other inbound plugins. Now its no difference between handling weatherfax or e.g. Dashboard.

The release build will make dll for all plugins. My own BR24 dll is here:
C:\Builds\OCPN\OpenCPN\build\plugins\BR24radar_pi\ Release

To debug OCPN and one or more plugins you need to copy all files from corresponding C:\Builds\OCPN\OpenCPN\build\plugins\BR24radar_pi\ Debug\ to one common folder you have to specify in pluginmanager. AND that copying has to be done for every plugin change you want to debug. Otherwise will the change not be seen in debug mode and no brake will be recognized. (The brake symbol will be a ring instead of a fat dot.

If you later make OCPN package weatherfax will included as Dashboard etc. are.

Git:
Since you made a clone in opencpn\plugins\weatherfax_pi\ there will be a separate Git there. You can make test branches and more independently of OCPN Git.
But changes to weatherfax will be seen also in OCPN Git and need to be committed also there unless you:
Before your plugin fetch/clone add to C:\Builds\OCPN\OpenCPN\.gitignore:
plugins/weatherfax _pi/

With hope of a understandable text/
Håkan
__________________
Hakan is offline   Reply With Quote
Old 15-02-2017, 12:23   #508
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

Quote:
Originally Posted by Hakan View Post
Hans
Let's see if can describe my method to have a plugin inside OCPN repo:
My build path is : C:\Builds\OCPN\OpenCPN\
> I cd: C:\Builds\OCPN\OpenCPN\plugins\
> Do: Git fetch(clone) https\\...........weatherfax_pi
weatherfax_pi should now be in C:\Builds\OCPN\OpenCPN\plugins\weatherfax_pi
Now copy the two files needed to weatherfax_pi\buildwin

Since we're now inside OCPN you neither need any weatherfax_pi\build directory nor copy the ocpencpn.lib file.

If necessary or not at this stage i use to rerun cmake -T v120_xp .. in opencpn\build\ because now we're inside OCPN and what's there should be build together with OCPN as the inbound plugins.
Then open your normal OpenCPN.sln in VS2013 and build as usual. weatherfax will be built together with OCPN and the other inbound plugins. Now its no difference between handling weatherfax or e.g. Dashboard.
I deleted the weatherfax_pi under OpenCPN\plugins and got a new one from the repository with "git clone https://github.com/seandepagnier/weatherfax_pi"

Added the 2 files " portaudio_x86.dll and portaudio_x86.lib"
Reran cmake -T v120_xp .. in OpenCPN\build\
Did not copy the buildwin directory as said in the repositary since you did not mension it.

Started VS 2013 and ran Build, and got my 271 errors.
I.e no luck.

Should the Solution Explorer window really look like in the previous attachment ? For the other plugins there are header and sourse file folders. For the weathefax_pi it looks like its the structure under "OpenCPN\build\plugins\weatherfax_pi"

/Hans
__________________
hasse_A is offline   Reply With Quote
Old 15-02-2017, 14:28   #509
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

I started all over. Got a new copy of OpenCPN. Build that without errors.
Then got the weatherfax_pi source code. Added the 2 files and build directory.
ran cmake -T v120_xp .
opend VS 2013

Now the folders under weatherfax_pi looks as I think they should with
External Dependencies, Sourcefiles and CmakeList.txt

When trying to build this I still get my 271 errors!

The first is :
Error 1 error C2146: syntax error : missing ';' before identifier 'read' c:\users\hasse\opencpn\plugins\weatherfax_pi\src\l ibaudiofile\modules\FileModule.h 35 1 weatherfax_pi

line 35 looks like this : ssize_t read(void *data, size_t nbytes);
I think it complains on ssize_t.
A file, config.h under libaudiofile contains.

#if defined(__MSVC__)
#include <BaseTsd.h>
typedef int ssize_t;
#define snprintf _snprintf
#define HAVE_UNISTD_H 0

#pragma warning(disable: 4244)
#pragma warning(disable: 4800)
#else
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
#endif

Here is a "typedef int ssize_t;"
Why is this not recognized ? ( If this is the problem )

There are no files under : OpenCPN\build\plugins\weatherfax_pi\Release

/Hans
__________________
hasse_A is offline   Reply With Quote
Old 15-02-2017, 15:13   #510
Registered User

Join Date: Feb 2013
Location: Gothenburg, Sweden
Boat: Allegro 33
Posts: 224
Re: Development Debugging Environment - Setup Help

Ok, to verify that I am not totally out in the blue I downloaded
the watchdog_pi and build that under OpenCPN.

No problem what so ever. Builds fine for both Debug and Release.

I can see it under options->plugins and if enabled it turns up among the tools.
I can set breakpoints and debug.

Still no luck with the weatherfax_pi.

/Hans
__________________

__________________
hasse_A is offline   Reply With Quote
Reply

Tags
environment

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



Our Communities

Our communities encompass many different hobbies and interests, but each one is built on friendly, intelligent membership.

» More about our Communities

Automotive Communities

Our Automotive communities encompass many different makes and models. From U.S. domestics to European Saloons.

» More about our Automotive Communities

Marine Communities

Our Marine websites focus on Cruising and Sailing Vessels, including forums and the largest cruising Wiki project on the web today.

» More about our Marine Communities


Copyright 2002- Social Knowledge, LLC All Rights Reserved.

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


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.