rgleason / celestial_navigation_pi

celestial navigation plugin for opencpn
GNU General Public License v3.0
10 stars 6 forks source link

GetpPrivateApplicationDataLocation issue #14

Closed rgleason closed 3 years ago

rgleason commented 3 years ago
PS
As there is no way to write issues for the celestial_navigation_pi plugin, and knowing that you develop it too, I inform you that the same problem exists for it
to obtain that celestial_navigation create the good path inside flatpak :
/home/yourusername/.var/app/org.opencpn.OpenCPN/config/opencpn/plugins/ celestial_navigation
where to store the personnal writeable Sights.xml file
rgleason commented 3 years ago

See Dev Manual User Config Path https://opencpn-manuals.github.io/development/plugin-installer/0.0.1/Terminology.html#_user_config_path

For windows this is %LOCALAPPDATA% or %HOME%\Appdata\Local on window This directory cannot be written to by the User! Instead another data directory has to be created.

Why is it called the "User Config Path"? I think this is confusing. terminology.

I think it is intended to be called Plugin Install Path https://opencpn-manuals.github.io/development/plugin-installer/0.0.1/Terminology.html#_user_install_path

rgleason commented 3 years ago

Anyway right now I am having trouble getting getpPrivateApplicationDataLocation along with Android configuration (which worked earlier)

Please see these two builds.
2.3.5.1 incl android + flatpak (should be labeled2.3.5.2 to match the tag) - FAILS 2.3.5.1 rework bad merge - ALL BUILD

The last commit tries to implement getpPrivateApplicationDataLocation and add Android UI features. The difference is the issue in 2.3.5.1 rework bad merge The errors are "NAN" errors. Which I have not been able to fix.

bdbcat commented 3 years ago

Rick... I do not see NAN issues in the latest build failures. What I "see" is a missing file: src/zuFile.h. Causes all builds to fail. What happened to this file? Seems that this file first appeared in climatology, and is also required for celestial?

rgleason commented 3 years ago

Oh that is very helpful. Why did I not see that? I think Norton may have stolen it and put it in quarantine, not sure but this has happened once or twice before. Jeez Norton is a pain, but I feel bare without it. I will find one. Thank you! Sorry about bothering you.

rgleason commented 3 years ago

Dave, I've found two files that are needed, plus added zlib-1.2.3 and bzip2 files which were also missing since there were errors looking for these. What I have done so far:

  1. Found zuFile.h and zuFile.cpp on Climatology added them to Celestial_Nav /src/ folder. Then added paths in CmakeLists.txt under set SRC and set HDRS. These files were from zygrib grib viewer.
  2. Found libs/bzip2 on Weather_routing bzip2 and added that to Cel_Nav libs/ folder (has a cmakelists.txt file, and have added the necessary text to the "If not Flatpak" statement to include bzip2 files.
  3. Found zlib-1.2.3 and added that to libs\zlib-1.2.3\include the two files are zlib.h and zconf.h Then added an include statement.
  4. I believe these files are all found now during build.
  5. What is happening now is I am getting a fatal error from CelestialNavigaionDialog.cpp at line 625.

C:\Users\fcgle\source\celestial_navigation_pi\src\CelestialNavigationDialog.cpp(625): fatal error C1004: unexpected end-of-file found [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj] (Also there are a lot of Nan and infinity warnings.)

I have checked all the pairs of brackets in the file, compared it to earlier files and have tried to save it with a feature "trim trailing spaces". I can't figure out what the problem is. It won't build locally, but I am going to push it up to github.

https://github.com/rgleason/celestial_navigation_pi Master branch

output.txt

If you have any other thoughts about this I would be very interested.

bdbcat commented 3 years ago

Rick... typo in CelestialNavigationDialog.cpp:424 is: m_lSights->SetItem(idx, rmTYPE, SightType[s->m_Type]); should be: m_lSights->SetItem(idx, rmTYPE, SightType([s->m_Type]);

Note added "(".

rgleason commented 3 years ago

Dave,

m_lSights->SetItem(idx, rmTYPE, SightType([s->m_Type]));

You are very kind to put up with the likes of me, with eyesight getting worse, an old hack, etc.

Do I need another right bracket too?

Rick PS: Sorry I emailed this too by mistake.

bdbcat commented 3 years ago

Rick... Disregard previous suggestion. Line 424 is fine as is.

  1. in CMakeLists.txt, correct spelling of zufile, should be zuFile, two places
  2. in CelestialNavigationDialog.cpp, add #endif after line 216:
rgleason commented 3 years ago
  1. Done.
  2. The #endif that is missing, seems to be part of #ifdef OCPNANDROID__
  3. So all of that code is for Android?
  4. Maybe I was sloppy and deleted or missed in copying, an #endif after

    
    . #ifdef __OCPN__ANDROID__
    void CelestialNavigationDialog::OnEvtPanGesture( wxQT_PanGestureEvent &event)
    {
    switch(event.GetState()){
        case GestureStarted:
            m_startPos = GetPosition();
            m_startMouse = event.GetCursorPos(); //g_mouse_pos_screen;
            break;
        default:
        {
            wxPoint pos = event.GetCursorPos();
            int x = wxMax(0, pos.x + m_startPos.x - m_startMouse.x);
            int y = wxMax(0, pos.y + m_startPos.y - m_startMouse.y);
            int xmax = ::wxGetDisplaySize().x - GetSize().x;
            x = wxMin(x, xmax);
            int ymax = ::wxGetDisplaySize().y - GetSize().y;          // Some fluff at the bottom
            y = wxMin(y, ymax);
    
            Move(x, y);
        } break;
    }
    // master
    }
    LINE 217?   put  #endif   here?


around line 217  
rgleason commented 3 years ago

I think I'll try that.

rgleason commented 3 years ago

Ok that seems to build further, don't know for sure if that is where the #endif goes.....

but the next hangup is from zuFile and I have seen this before, unresolved external symbol gzopen, gzread, gzseek, gxtell, and gxclose

So something is wrong in my cmakelists.txt file

  geodesic.c
     Creating library C:/Users/fcgle/source/celestial_navigation_pi/build/Release/celestial_navigation_pi.lib and object C:/Users/fcgle/source/celestial_navigation_pi/build/Release/celestial_navigation_pi.exp
zuFile.obj : error LNK2019: unresolved external symbol _gzopen referenced in function _zu_open [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj]
zuFile.obj : error LNK2019: unresolved external symbol _gzread referenced in function _zu_read [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj]
zuFile.obj : error LNK2019: unresolved external symbol _gzseek referenced in function _zu_rewind [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj]
zuFile.obj : error LNK2019: unresolved external symbol _gztell referenced in function _zu_rewind [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj]
zuFile.obj : error LNK2019: unresolved external symbol _gzclose referenced in function _zu_can_read_file [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj]
C:\Users\fcgle\source\celestial_navigation_pi\build\Release\celestial_navigation_pi.dll : fatal error LNK1120: 5 unresolved externals [C:\Users\fcgle\source\celestial_navigation_pi\build\celestial_navigation_pi.vcxproj]
rgleason commented 3 years ago

Those are located in zlib and we have zlib-1.2.3 in the libs/ folder, but there are no cpp files! https://www.zlib.net/ has zlib 1.2.11 from 2017 do I dare download and use that? I guess I don't understand why all this is missing. I am going to check github history!

rgleason commented 3 years ago

I checked back in the frontend2 branch and did not find these libraries were being used. I don't know why we are being forced down this road of adding libraries that were not there. Indeed frontend2 built fine, but without some of the more recent if androids.

I did find that Sean had added android UI and had fixed the database for android see https://github.com/rgleason/celestial_navigation_pi/commit/89fef0eb6f5ac4d3a811cef84309ce12cc47a892#diff-41f953ddfbd947912eec708c84fc4a9bfdce02acea05dd66e86d034e141f51cd

And in that same area he changed the db to work with android, so android has been around for some time...

rgleason commented 3 years ago

Do you think I should just update the library to zlib 1.2.11 ?

bdbcat commented 3 years ago

No. This is a rathole. Revert back to before Android, and drop Android for now. I cannot help you now. Later days....

rgleason commented 3 years ago

Ok, I agree totally. I will revert it. But as I wrote earlier, android has been in this plugin a long time However, I think I still need the getpPrivateDataLocation addition to be compatible with the new PIM standard for data location.

BTW I found https://zlib.net/fossils/ with zlib-1.2.3 it is just500kb but many files, and I determined that weather_routing (which is where I got zlib-1.2.3) just has the two header files and no cpp.

rgleason commented 3 years ago
  1. In celestialnavigtiondialog.cpp at the top commented out the one Android UI addition towards the top and left the getpPriCommented out the #include zuFile.h vateDataLocation code at the top
  2. In cmakelists.txt Removed references to zuFile.h and zuFile.cpp in SRC and HDRS also commented out the include dir for zlib-1.2.3
    Now it seems to build. I will check whether it works and clean up.

Thanks

rgleason commented 3 years ago

I had to try it after learning more, I uncommented the one AndroidUI command at the top of cel_navdialog.cpp and then ran a build and it completed! The include zuFile.h is still commented out, so that was the problem, I think I am going to remove that commented out line completely and all the excess files/libs and cmakelists.txt refs. to clean up.

Will test and see what happens.

rgleason commented 3 years ago

Cleaned up and working in Win10, will push