Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken linux build with GDAL 3.2.0 #98

Closed
Gigas002 opened this issue Dec 14, 2020 · 25 comments
Closed

Broken linux build with GDAL 3.2.0 #98

Gigas002 opened this issue Dec 14, 2020 · 25 comments
Assignees
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
Milestone

Comments

@Gigas002
Copy link
Owner

According to MaxRev-Dev/gdal.netcore@76b614c#diff-6d6fa00a963a2026bc7d3d2ee4486b1eb68f25bbb6e14b9164de138aca393cde, it's currently impossible to use gdal with libtiff on linux due to some problems with other dependencies. I'll continue using 3.1.2 until this'll be fixed.

@Gigas002 Gigas002 added bug Something isn't working dependencies Pull requests that update a dependency file labels Dec 14, 2020
@Gigas002 Gigas002 added this to the Future milestone Dec 14, 2020
@Gigas002 Gigas002 added this to To do in Core via automation Dec 14, 2020
Gigas002 pushed a commit that referenced this issue Dec 14, 2020
@MaxRev-Dev
Copy link

@Gigas002 I can't see the problem. With v3.2.0, we use gdal's internal libtiff again as in previous versions before vcpkg was integrated.

@MaxRev-Dev
Copy link

@Gigas002
Copy link
Owner Author

Gigas002 commented Dec 14, 2020

@MaxRev-Dev
Thanks for your reply, I'll take a look at these. Unit tests for my project in CI on linux failed on the last gdal update, I thought that might be the issue.

@Gigas002
Copy link
Owner Author

Oh, by the way it was still bugged, when I used previous LinuxRuntime package (3.1.2.110) with newer WindowsRuntime and Core (3.2.0.100/3.2.0.100). Probably a bug in core? I'll research more into this.

@MaxRev-Dev
Copy link

I don't think this is related, but the latest version for windows (110) is a patch for the cached GEOS 3.8.0 (this was also in changelog). That's because I'm building it locally without CI, and did not configured travis yet. But still GEOS was updated to 3.9.0beta2.
I agree, that should be a bug in core bindings. But windows part works just fine, despite the core was built from linux.

@MaxRev-Dev
Copy link

Created an issue for this MaxRev-Dev/gdal.netcore#30

@Gigas002
Copy link
Owner Author

@MaxRev-Dev Ran through some tests on Ubuntu-20.04. Updated only LinuxRuntime to 3.2.0.100 with Core version 3.1.2.110 tests runs fine. After updating the core lib something breaks, can't tell, what exactly (most tests passes still). So it seems more like core bug.

@Gigas002
Copy link
Owner Author

Located one of errors:

        public static string GetProjString(string inputFilePath)
        {
            GdalBase.ConfigureAll();

            using Dataset dataset = Gdal.Open(inputFilePath, Access.GA_ReadOnly);

            string wkt = dataset.GetProjection();

            using SpatialReference spatialReference = new SpatialReference(wkt);

            spatialReference.ExportToProj4(out string projString);

            return projString;
        }

The string wkt = dataset.GetProjection(); returns empty string.

@Gigas002
Copy link
Owner Author

GdalWarp breaks too, probably because it can't get the projection to translate.

MaxRev-Dev added a commit to MaxRev-Dev/gdal.netcore that referenced this issue Dec 14, 2020
Fixes broken bindings in Gigas002/GTiff2Tiles#98
- new tests for bindings
- rebuit bindings
@MaxRev-Dev
Copy link

@Gigas002 Please, checkout the latest patch (110) of core at nuget.

@Gigas002
Copy link
Owner Author

Nice! I can see, that Gdal.Warp methods is now... well, Warp, not wrapper_GDALWarpDestName. I like it, even though I don't understand why does it take an array of Datasets.
Tests on my local windows machine passed, pushing to the github to see linux's test result.

Gigas002 pushed a commit that referenced this issue Dec 14, 2020
@Gigas002
Copy link
Owner Author

@MaxRev-Dev Weird, that doesn't seem to fix an issue. I'll check this out on my ubuntu VM as well tomorrow. For now, judjing by ci output, I can see, that the projString is still empty.

@MaxRev-Dev
Copy link

MaxRev-Dev commented Dec 14, 2020

@Gigas002 I see that did not helped.
But linux bindings are fine now, that test with proj string is passing (in WSL CentOS7).

Screenshot

image

@Gigas002
Copy link
Owner Author

Gigas002 commented Dec 15, 2020

@MaxRev-Dev Nope, that little test with projString still doesn't work under ubuntu 20.04, don't know why. Gdal seems to be configured well and the created Dataset works fine. What additional info can I provide to you?

I've tested the previous (3.1.2.110) version of core once again just to check out if I'm not wrong and yes, that one works as expected.

@MaxRev-Dev
Copy link

Yeah, that's weird, projString test works fine on CentOS7. Ok, I will try this on Ubuntu 20.04 in WSL.

@MaxRev-Dev
Copy link

Just installed a clean distro. Can't repro with my packages.
Can you make a minimal workable sample or test of this, and maybe make a PR in main repo?

Logs

image

@Gigas002
Copy link
Owner Author

Gigas002 commented Dec 15, 2020

@MaxRev-Dev Not sure, why your test is passing, but I have a guess: you're using Assert.NotNull(projString); in the end, and the string is actually not null -- it's just an empty string. It would be better to write something like Assert.False(string.IsNullOrWhiteSpace(projString)) .
I'm running the app as console app. Here's my .csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <Platforms>x64</Platforms>
    <Configurations>Debug;Release</Configurations>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MaxRev.Gdal.Core" Version="3.2.0.110" />
    <PackageReference Include="MaxRev.Gdal.LinuxRuntime.Minimal" Version="3.2.0.100" />
  </ItemGroup>

</Project>

And code in Program.cs:

using System;
using MaxRev.Gdal.Core;
using OSGeo.GDAL;
using OSGeo.OSR;

namespace GdalTest
{
    class Program
    {
        public static void Main(string[] args)
        {
            var inputFile = "/home/gigas002/dotnet-tests/Input4326.tif";
            var projString = GetProjString(inputFile);
            Console.WriteLine($"projstring:{projString}");
        }

         public static string GetProjString(string inputFilePath)
        {
            GdalBase.ConfigureAll();

            using Dataset dataset = Gdal.Open(inputFilePath, Access.GA_ReadOnly);

            string wkt = dataset.GetProjection();

            Console.WriteLine($"wkt:{wkt}");

            using SpatialReference spatialReference = new SpatialReference(wkt);

            spatialReference.ExportToProj4(out string projString);

            return projString;
        }
    }
}

@MaxRev-Dev
Copy link

MaxRev-Dev commented Dec 15, 2020

Assert.NotNull(projString);

Thanks for pointing on this, that makes sense. Did not expected that return value from bindings, thought it should be a null ref.
But currently, It does not bring to me any information, what did happened on linux in gdal320.

@MaxRev-Dev
Copy link

That's interesting. But updated test does not passing now, at all. Even on windows, even with previous packages.

Windows Logs

image

@MaxRev-Dev
Copy link

I think, I figured out what the problem is, so we are very close to solution.
That should be a shared proj.db between both runtimes.
Going to investigate this further tomorrow.
Thank you for you help.

@MaxRev-Dev
Copy link

@Gigas002 I had already rebuilt packages. Please, checkout the latest version.

@Gigas002
Copy link
Owner Author

@MaxRev-Dev Sorry, I didn't have a chance to answer and run tests sooner. I've run that test of getting string from proj and it worked, but still not all tests have passed for my app (17 failed, was 22). Some tests throw System.ApplicationException: PROJ: proj_create_from_database: Cannot find proj.db, and some fail on GdalWarp. Here's an example of failing GdalInfo method with above excpetion:

        public static string GdalInfo(string inputFilePath, string[] options = null)
        {
            GdalBase.ConfigureAll();

            using Dataset inputDataset = Gdal.Open(inputFilePath, Access.GA_ReadOnly);

            return Gdal.GDALInfo(inputDataset, new GDALInfoOptions(options));
        }

@MaxRev-Dev
Copy link

@Gigas002 Thanks for new info. I had adjusted tests and rewrote proj.db search algorithm.
Patch is already published as MaxRev.Gdal.Core.3.2.0.210

@Gigas002
Copy link
Owner Author

@MaxRev-Dev Seems to work correctly in WSL. Pushing to see the changes in CI.

@Gigas002
Copy link
Owner Author

Yes, all the tests have passed successfully. Thanks a lot for your help with this issue!

Core automation moved this from To do to Done Dec 17, 2020
@Gigas002 Gigas002 modified the milestones: Future, 2.0.0 Dec 17, 2020
@Gigas002 Gigas002 self-assigned this Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
Core
  
Done
Development

No branches or pull requests

2 participants