Open syjjj0826 opened 9 months ago
🤔 hmm, what gdal-warp-bindings version is used? for the 3.8.0 release we used release-1916-x64-gdal-3-8-1-mapserver-8-0-1-libs.zip
indeed so it looks like that's all good.
The error is related to the java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String;Z)V+0
meaning that the native library was not able to properly load. Could be various of reasons ~ bad dynamic lib paths / the lack of smth in the classapath / etc.
Have you tried to load the GDAL dll from the warp archive manually via System.load? It usually gives a more detailed error.
I also noticed a lot of java/lang/NoSuchMethodError
in the dump as well that are not related (?) to this issue.
Whats the purpose of org.gdal.ogr.ogr & org.gdal.gdal.gdal imports?
Does the regular gdal bindings lib (not this repo but the official gdal bindings) work on your system?
@pomadchin Thanks for your reply :)
I do using gdal-warp-bindings version==3.8.0
libraryDependencies += "com.azavea.geotrellis" % "gdal-warp-bindings" % "3.8.0"
added in my build.sbt
I have checked the dynamic libraries that the project depends on and tried to align the dependency versions as much as possible according to the Docker build environment control in the gdalwarp_bindings project. However, when my local project attempts to load gdalwarp_bindings-amd64.dll
, the program exits unexpectedly with the message
Process finished with exit code -1073741819 (0xC0000005)
I have also copied a duplicate of gdalwarp_bindings-amd64.dll
from the temporary files separately and attempted to load it using System.load()
, but the program still exited unexpectedly.
import geotrellis.raster.gdal._
object gdalwarpbindings_test extends App {
System.load("C:\\Users\\syj\\Desktop\\gdalwarp_bindings-amd64.dll")
val url = "D:\\Code\\IDEA\\sg_demo\\data\\LC80140322014139LGN00.tif"
val ds: GDALDataset = GDALDataset(url)
val meta = ds.getMetadataDomainList(1)
System.out.println(meta)
}
Process finished with exit code -1073741819 (0xC0000005)
Importing org.gdal.ogr.ogr
and org.gdal.gdal.gdal
is to get the error log, I found I can keep the log when I using ogr.RegisterAll()
.If not, I will just receive the simple message Process finished with exit code -1073741819 (0xC0000005)
.It's possible that my approach is incorrect.
Does the regular gdal bindings lib (not this repo but the official gdal bindings) work on your system? Regarding this issue, are you referring to some of the executable programs located in the "/bin/gdal/apps" directory of ''release-1916-x64-gdal-3-8-1-mapserver-8-0-1.zip'' archive? Such as
gdalinfo.exe
gdalwarp.exe
, if so, I have already verified their availability.I also noticed a lot of in the dump as well that are not related (?) to this issue.java/lang/NoSuchMethodError Regarding this error log, I am still investigating related errors. Thank you for pointing it out.
@syjjj0826 are you able to read tiffs via GDAL using official GDAL bindings without the use of geotrellis gdal-warp-bindings?
i.e. doing smth like
val ds = org.gdal.gdal.gdal.Open(filePath, org.gdal.gdalconst.gdalconstConstants.GA_ReadOnly)
val transform = ds.GetGeoTransform
val width = ds.GetRasterXSize
val height = ds.GetRasterYSize
The reason I ask -- want to check if that's an issue of our lib or not. + ogr.RegisterAll()
may conflict with our lib / double registering the same dllsthe dump by itself. So to reduce noise I want to ensure that its gdal-warp-bindings issue, not a general issue with GDAL.
@pomadchin I tried the example you provided, and it can achieve simple TIFF reading via GDAL
object test extends App{
org.gdal.ogr.ogr.RegisterAll()
val filePath = "D:\\Code\\IDEA\\sg_demo\\data\\LC80140322014139LGN00.tif"
val ds = org.gdal.gdal.gdal.Open(filePath, org.gdal.gdalconst.gdalconstConstants.GA_ReadOnly)
val transform = ds.GetGeoTransform
val width = ds.GetRasterXSize
val height = ds.GetRasterYSize
System.out.println("ok")
}
And I also attempted to remove the relevant gdal bindings lib from the project, only using gdal_warp_bindings. However, the result is still the same: after copying the gdalwarp_bindings-amd64.dll from gdal_warp_bindings:3.8.0.jar to a temporary file, it fails to proceed with the next loading step.
// cz.adamh.utils NativeUtils.java
...
NativeLibrary lib = new NativeLibrary(fromClass, name, isBuiltin);
nativeLibraryContext.push(lib);
try {
lib.load(name, isBuiltin);
}
...
Did I overlook adding any other dependencies?If it's convenient, could you provide a list of the basic development environment for me to check?
@syjjj0826 thanks for confirming that that's our bindings issue.
Ouf sadly we don't have any docs around building dlls for windows; crossbuild is used to build windows binaries.
There is indeed a solid chance it works under some specific circumstances only, Windows env is not really tested well.
However, that's the Makefile to build and test bindings. In the proper Windows env with slightly adjusted env variables its possible to test just using the Makefile commands.
An alternative can be to rebuild crossbuild docker image and try it on your local machine to see if its failing (i.e. could be a sepcific built and currently used in CI docker image failure).
Sorry for these sad news, will really appreciate if you're able to help with investigating the reasons of this failure. I'll try to find some time to spin it up on my Win machine as well.
@pomadchin Despite feeling somewhat helpless upon hearing this news, I will persist in trying to resolve the issue based on the suggestions you provided. If I make progress in addressing the problem, I will continue to comment here. Thank you for your responses over the past two days.
Hey there: I tried modifying some source code and compiled it into the usable binding files. I think this should be feasible for debugging projects solely in a Windows environment. 😃
Hi @syjjj0826, great news! Will be happy to see a PR against this repo to address build issues :+1:
Describe the bug
I want to use the geotrellis-gdal module in my project, and already import the relevant libraries.
when I run this code, throw an Exception:
When I debug step by step, I found the issue arises at these codes in file D:\Java\jdk1.8.0_202\src.zip!\java\lang\ClassLoader.java
When it reaches A during execution, the program exits abnormally.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Environment