0

How do I setup ECW support for QGIS in Linux?

In windows it's super easy, due to the OSGeo4W installer, but I can't get it running in linux.

I tried a lot of topics from gis.stackexchange like these:

or other blogs like this one: 3

The main problem is, that the AUR package for libecwj2 isn't online anymore and I'm still new to compiling software in linux. So somehow the compilation, which is described in the first two links, always fails.

@SamTux replied but I still can't get it running.

The archgeotux-repository did work so far, but I somehow I got the following error: link
I wasn't able to open qgis anymore and it looks like a lot of more trouble. So I thought this can't be the answer.

I could install the libecwj2 AUR package (YUHUUU!), but got stuck with the recompilation of gdal. I found it also strange why it's not possible to edit PKGBUILD of the gdal but for the gdal-filegdb package?

When I do the recompile of gdal-filegdb the package "libkml" fails: build-log

Another question, when I upgrade in the future to a newer version of gdal, do I always have to edit the PKGBUILD do ensure the ecw support?

  • maybe describe where it is failing? – Stev_k Nov 2 '18 at 17:00
  • As per the Tour there should be only one question asked per question. – PolyGeo Nov 4 '18 at 20:24
  • Note that ECW v3.3 / libecwj2 was released in 2006, is completely out of date and does not support more recent ECW files. It's also extremely buggy. If you just want to read ECW, build the GDAL driver against an up to date ECW SDK. – user2856 Nov 4 '18 at 23:39
1

Finally, I managed to open ECW files with the help of a self-compiled GDAL library. Due to many difficult to understand instructions all around the web, I'll try to summarizing what was necessary to get it running. I decided to create a community wiki, because I certainly didn't find the best solution and so other people can simplify this solution for all interested people.

Prerequisites:
- Manjaro with QGIS installed from the official repositories
- Due to QGIS installation, the gdal-lib should be already installed as well

How to set up the ECW support for QGIS on Manjaro Linux

  1. First install the libecwj2 libary.

Luckiley it is online again, so it is possible to install it easily by the Manjaro built in package manager. The lib is listed in the AUR repository, so the support of the AUR needs to be activated.

  1. Downloaded latest gdal-sources from here: https://trac.osgeo.org/gdal/wiki/DownloadSource
  2. Unzip the file and open a terminal
  3. Change directory: cd into/the/path/of/your/unzipped/gdal-folder
  4. Configure to create the makefile-file with the ecw option ./configure --with-ecw

    If you need more options just add them. Here you can find more infos.

  5. Compile gdal make
  6. Install gdal sudo make install
  7. Now somehow the installation didn't work as expected. I think at this point my knowledge about compilation is still limited. So due to the installation the new compiled gdal was installed in /usr/local-path instead of /usr-path.. so what I copied manually all gdal-files from /usr/local-path to /usr-path..

After this last manual step I was able to open ecw files in qgis.

  • In step 8, do you mean copy all file from /usr/local/bin/ to /usr/bin/ ? – mega Apr 12 at 10:35
  • @mega: No, not all, just the gdal-files. – basto Apr 18 at 17:41
0

Effectively the link source to the libecwj2 AUR package is broken. However you can make the following change in the PKGBUILD and it works correctly.

source=(${pkgname}.zip::"https://github.com/meteogrid/libecwj2/archive/${pkgver}.zip"
        'libecwj2-3.3-nolcms.patch'
        'libecwj2-3.3-3245a.patch'
        'libecwj2-3.3-3245b.patch'
        'libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch'
        'libecwj2-3.3-2593.patch'
        'libecwj2-3.3-wcharfix.patch')
md5sums=('0a4f733b8699f0a8cd060d43ae5e209a'
         'e4c4cde42a8910650fe665bf7c9bbde3'
         '7871632c8d52ceb0ac02589deaa3c347'
         'cf23c8fbb0009905185886708d1c6de4'
         '3018aa1e84ca64e0026c4f3d3481cac1'
         '3ebdc31fa456f47aba6e1a3295f690d3'
         'd0bf5fa7e6ba62ef5a138b5b22364b4e')

However, you must recompile GDAL with ECW support. For that follow the ECW compilation link in Arch Linux.

For ease of installation you can add the following unofficial repository called ArchGeoTux:

https://archgeotux.sourceforge.io

And install with:

# pacman -S gdal-ecw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.