BeinerChes / gdalios

3 stars 1 forks source link

Build problem with jpeg-xl #3

Open e-rook opened 2 weeks ago

e-rook commented 2 weeks ago

Hello

Can you advice how to proceed with the problem? I have cloned repository and tried to build it using proposed command. After some time I was hit with compile error, was jpeg changed in meantime?

[ 63%] Building CXX object frmts/jpegxl/CMakeFiles/gdal_JPEGXL.dir/jpegxl.cpp.o /Users/pgawron/Documents/gdal_ios/src/gdal-3.8.5/frmts/jpegxl/jpegxl.cpp:617:36: error: no matching function for call to 'JxlDecoderGetColorAsEncodedProfile' if (JXL_DEC_SUCCESS == JxlDecoderGetColorAsEncodedProfile( ^~~~~~~~~~ /usr/local/Cellar/jpeg-xl/0.10.2/include/jxl/decode.h:764:29: note: candidate function not viable: requires 3 arguments, but 4 were provided JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsEncodedProfile( ^ /Users/pgawron/Documents/gdal_ios/src/gdal-3.8.5/frmts/jpegxl/jpegxl.cpp:666:21: error: no matching function for call to 'JxlDecoderGetICCProfileSize' JxlDecoderGetICCProfileSize(m_decoder.get(), ^~~~~~~ /usr/local/Cellar/jpeg-xl/0.10.2/include/jxl/decode.h:790:29: note: candidate function not viable: requires 3 arguments, but 4 were provided JXL_EXPORT JxlDecoderStatus JxlDecoderGetICCProfileSize( ^ /Users/pgawron/Documents/gdal_ios/src/gdal-3.8.5/frmts/jpegxl/jpegxl.cpp:674:44: error: no matching function for call to 'JxlDecoderGetColorAsICCProfile' if (JXL_DEC_SUCCESS == JxlDecoderGetColorAsICCProfile( ^~~~~~~~~~ /usr/local/Cellar/jpeg-xl/0.10.2/include/jxl/decode.h:808:29: note: candidate function not viable: requires 4 arguments, but 5 were provided JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsICCProfile( ^ 3 errors generated. make[2]: [frmts/jpegxl/CMakeFiles/gdal_JPEGXL.dir/jpegxl.cpp.o] Error 1 make[1]: [frmts/jpegxl/CMakeFiles/gdal_JPEGXL.dir/all] Error 2 make: *** [all] Error 2

Take care Piotr

e-rook commented 2 weeks ago

After removing jpeg-xl build has been completed. Now time to test

brew uninstall --ignore-dependencies jpeg-xl

e-rook commented 2 weeks ago

I am failing now with building or using the framework. I can see in gdal_ios/framework/gdal: ios-arm64 ios-x86_64-arm64-simulator libgdal.xcframework I can copy framework to my project unfortnatelly I am unable to import gdal nor libgdal. Can you share a few lines how to proceed with it?

e-rook commented 2 weeks ago

I have added missing dependencies and builds fine. I tried to load some S57 map but I get error. Tried with Python code and information from it is decoded (hopefully correctly)

 func readS57File(filePath: String, completion: @escaping ([MKPointAnnotation]) -> Void) {
        var points: [MKPointAnnotation] = []

        GDALAllRegister()
        guard let dataset = GDALOpen(filePath, GA_ReadOnly) else {
            print("Cannot open file: \(filePath)")
            completion(points)
            return
        }
        defer {
            GDALClose(dataset)
        }

        for i in 0..<GDALDatasetGetLayerCount(dataset) {
            guard let layer = GDALDatasetGetLayer(dataset, i) else { continue }

            var feature: OGRFeatureH? = OGR_L_GetNextFeature(layer)
            while feature != nil {
                if let geom = OGR_F_GetGeometryRef(feature) {
                    let geomType = OGR_G_GetGeometryType(geom)
                    if geomType == wkbPoint {
                        let x = OGR_G_GetX(geom, 0)
                        let y = OGR_G_GetY(geom, 0)
                        let coordinate = CLLocationCoordinate2D(latitude: y, longitude: x)
                        let annotation = MKPointAnnotation()
                        annotation.coordinate = coordinate
                        points.append(annotation)
                    }
                }
                OGR_F_Destroy(feature)
                feature = OGR_L_GetNextFeature(layer)
            }
        }
        completion(points)
    }

I think I have come to the wall now :)