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

Compiling Qgis with ECW in flatpak #229

Open
spartero opened this issue Sep 16, 2022 · 5 comments
Open

Compiling Qgis with ECW in flatpak #229

spartero opened this issue Sep 16, 2022 · 5 comments

Comments

@spartero
Copy link

Good afternoon, I work from a linux machine and need to use QGIS with ECW support. Watch how to compile GDAL with ECW. Since I am using flatpak packages, I decided to create my own QGIS faltpak with ECW.

The first thing I did was download the org.qgis.qgis.json file, which, to compile QGIS, without ECW.
To include ECW in Gdal, inside the json file, in the Gdal module add:

"--with-ecw=/app/lib/hexagon",

Run flatpak-builder and while checking the files and downloading the different source code, add the source files by hand, which correspond to ECW and leave them in the corresponding folder.

When it comes to compile the Gdal module, initially, it does not give me any error, after spending 10 minutes compiling the module, I get the following error:

/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: warning: libNCSEcw.so.5.5.0, needed by /run/build/gdal/.libs/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: warning: libNCSEcw.so.5.5.0, needed by /run/build/gdal/.libs/libgdal.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: warning: libNCSEcw.so.5.5.0, needed by /run/build/gdal/.libs/libgdal.so, not found (try using -rpath or -rpath-link)
/bin/sh /run/build/gdal/libtool --mode=link --silent g++ -L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed  gdalwarp_bin.lo  /run/build/gdal/libgdal.la -o gdalwarp
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: /run/build/gdal/.libs/libgdal.so: undefined reference to `NCSFreeMetaData'
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: /run/build/gdal/.libs/libgdal.so: undefined reference to `NCS::CIOStream::GetOptions()'
/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: /run/build/gdal/.libs/libgdal.so: undefined reference to `NCS::CView::GetDefaultRGBBandList(std::vector<unsigned int, std::allocator<unsigned int> >&)'
...

From what I interpret, it does not find the libgdal.so library, but if I check the directory, where everything is being cooked, the file does exist.

how can you solve this problem?

@aleixpol
Copy link
Collaborator

Please create a merge request with your changes so we can look into them

@spartero
Copy link
Author

Thank you very much for answering. I don't know how to do what you are telling me. I am attaching a link to the modified json file.

https://drive.google.com/file/d/10lZ2FmMX-bKRvjmPyDoVlvYIdAWTuUUZ/view?usp=sharing

As I have indicated before, the ECW source code and libraries, I copy them by hand inside the build file, inside the "lib" folder

@spartero
Copy link
Author

Good morning, I have found the error, it was my mistake in interpreting the error. The error is that GDAL does not find the ECW library. As I have been able to interpret, in the ./configure of GDAL, the "ECW_LIBS" parameter must be added.

I have carried out several tests, with direct routes and the error continues.

The hexagon directory structure is (in the release folder, that's where the libraries are):

  • hexagon
    • lib
      • cpp11abi
        • x64
          • release
      • x64
        • release

what would be the path, to put in ECW_LIBS?

ECW_LIBS=/app/lib/hexagon/????

Thanks for the help

@spartero
Copy link
Author

spartero commented Oct 9, 2022

Good morning, I haven't had much time to dedicate to this. But I have seen how to fix it. No matter how much I directed the path to where the compiled libraries were in the hexagon directory, it always gives an error. So I did a test, copy the libraries directly to the lib folder, modify the path of the libraries and it compiled perfectly.

In summary

In the qgis.qgis.org file, in the gdal module, we will add the following compiler parameters:

"name": "gdal",
                    "config-opts": [
                        "--with-ecw=/app/lib/hexagon",
                        "ECW_LIBS=/app",
                        

We downloaded the ECW libraries from the official Hexagon website. Of everything that is downloaded to us, we can delete all, except the folders:

  • include
  • lib
  • redistributable

Once the folders, which are useless, have been cleaned, we will have a directory called hexagon, with the three previous folders.

When running the flatpak-builder command, to start the build, we headed to the folder

/build/files/lib/

And we paste the hexagon folder in lib

We copy all the libraries that the folder contains:

/hexagon/lib/cpp11abi/x64/release/

And we paste them in the folder

/build/files/lib/

And now we just have to wait for the compilation. In my laptop with Intel i7-4700HQ 8 threads, it has taken me about 5 hours and has also consumed up to 10 Gb RAM at various times.

Can someone with more experience with flatpak add all of the above to Qgis.
From my point of view:

  • instead of downloading the ECW libraries, from the official page. It should be hosted on a site, a zip, with the libraries, ready to copy and paste in /lib
  • add a new module to download the libraries and paste them in lib
  • Modify gdal compile options

@spartero
Copy link
Author

spartero commented Oct 9, 2022

I leave Qgis with ECW support

Qgis-ECW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants