ViRGIS-Team / gdal-upm

Unity Package for GDAL
MIT License
15 stars 6 forks source link

DllNotFoundException for gdal_wrap in Unity with GDAL Package #24

Closed bensasl2 closed 10 months ago

bensasl2 commented 10 months ago

Environment:

Issue Description: I am encountering a DllNotFoundException when trying to use the GDAL package in Unity. The specific error is for gdal_wrap. This issue arises when attempting to initialize GDAL using Gdal.AllRegister(); in a C# script.

Error Message: DllNotFoundException: gdal_wrap assembly: type: member:(null) OSGeo.GDAL.GdalPINVOKE+SWIGExceptionHelper..cctor () (at ./Library/PackageCache/com.virgis.gdal@e85ead4664/Runtime/Scripts/gdal/GdalPINVOKE.cs:139) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. OSGeo.GDAL.GdalPINVOKE..cctor () (at ./Library/PackageCache/com.virgis.gdal@e85ead4664/Runtime/Scripts/gdal/GdalPINVOKE.cs:159) Rethrow as TypeInitializationException: The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception. OSGeo.GDAL.Gdal.AllRegister () (at ./Library/PackageCache/com.virgis.gdal@e85ead4664/Runtime/Scripts/gdal/Gdal.cs:861) S57Reader.Start () (at Assets/myscript.cs:10)

Steps to Reproduce:

  1. Installed the GDAL package in Unity via Unity Package Manager and the git link after adding scopedRegistries to manifest.json.
  2. Created a C# script to utilize GDAL functionalities.
  3. Encountered the error upon running the Unity scene with the script.

I would appreciate any guidance or suggestions to resolve this issue. Thank you!

bensasl2 commented 10 months ago

Update: Issue Resolved

I wanted to provide an update on this issue. After further investigation, I discovered that the problem was related to the Conda installation. Once I addressed the Conda setup, the DllNotFoundException for gdal_wrap was resolved.

runette commented 10 months ago

Thanks for the issue and the update. I was about to say that this issue is almost certainly due to the conda configuration.

Using Conda does introduce some complexity - but it solves even more problems with dependencies with GDAL and with updates so it is worth it :)

Thanks for using the package