[gdal-dev] Compiling ECW 3.3 on MacOSX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Compiling ECW 3.3 on MacOSX

Jeremy Palmer-3
I'm trying to compile ECW support for GDAL using the older 3.3 SDK for MacOSX 10.13. I downloaded the source for libecwj2-3.3-2006-09-06.zip and applied the cumulative patch : ​https://trac.osgeo.org/gdal/attachment/wiki/ECW/libecwj2-3.3.patch. I then ran the following standard build commands:

./configure
make

But I get the following error:

/Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSDefs.h:430:28: error: static declaration of 'wcsdup' follows non-static declaration
static NCS_INLINE wchar_t *wcsdup(const wchar_t *s1)
                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/wchar.h:199:10: note: previous declaration is
      here
wchar_t *wcsdup(const wchar_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
         ^
In file included from ../C/NCSEcw/NCSJP2/NCSJP2.cpp:24:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSEcw.h:73:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/ECW.h:137:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSUtil.h:86:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSPrefs.h:131:

Does anyone have any experience building on MacOSX, or have a handy patch that fixes this?

Thanks :)
Jeremy


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compiling ECW 3.3 on MacOSX

John Daniel-2
Sorry if this is a dupe. I tend to screw up my From: address when responding to the list...

Hello Jeremy,
I do have a handy patch for this library. I will send it to you in a private e-mail. It isn’t a small patch so I don’t think I should put it on the mailing list.

I just tested it on High Sierra and it seems to build correctly. I just built the library. I didn’t try to use it or link it with GDAL. That brings me to my next question. Why do you want this old thing? It is hard to build, has questionable licensing, and there are better alternatives available. If you just need JPEG-2000 support, I would recommend the OpenJPEG project. 

I have a set of Mac-specific build scripts at: (https://github.com/etresoft/OS-GIS). I haven’t run them for a while, but I will soon be getting back into this project. ECW is not included in this project. 

John Daniel
Etresoft, Inc.

On Jan 3, 2018, at 11:42 PM, Jeremy Palmer <[hidden email]> wrote:

I'm trying to compile ECW support for GDAL using the older 3.3 SDK for MacOSX 10.13. I downloaded the source for libecwj2-3.3-2006-09-06.zip and applied the cumulative patch : ​https://trac.osgeo.org/gdal/attachment/wiki/ECW/libecwj2-3.3.patch. I then ran the following standard build commands:

./configure
make

But I get the following error:

/Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSDefs.h:430:28: error: static declaration of 'wcsdup' follows non-static declaration
static NCS_INLINE wchar_t *wcsdup(const wchar_t *s1)
                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/wchar.h:199:10: note: previous declaration is
      here
wchar_t *wcsdup(const wchar_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
         ^
In file included from ../C/NCSEcw/NCSJP2/NCSJP2.cpp:24:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSEcw.h:73:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/ECW.h:137:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSUtil.h:86:
In file included from /Users/jpalmer/Documents/Development/libecwj2/Source/include/NCSPrefs.h:131:

Does anyone have any experience building on MacOSX, or have a handy patch that fixes this?

Thanks :)
Jeremy

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



John Daniel
Etresoft, Inc.


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compiling ECW 3.3 on MacOSX

Jeremy Palmer-3
In reply to this post by Jeremy Palmer-3
Hi John,

On Fri, Jan 5, 2018 at 5:22 AM, John Daniel <[hidden email]> wrote:
Hello Jeremy,
I do have a handy patch for this library. I will send it to you in a private e-mail. It isn’t a small patch so I don’t think I should put it on the mailing list.

Thanks so much for the patch. For reference I have placed the patch here: https://gist.github.com/palmerj/54fa389c4e60fa7b9f1d5ceea7ac3359
 

I just tested it on High Sierra and it seems to build correctly. I just built the library. I didn’t try to use it or link it with GDAL. That brings me to my next question. Why do you want this old thing? It is hard to build, has questionable licensing, and there are better alternatives available. If you just need JPEG-2000 support, I would recommend the OpenJPEG project. 

We have a need to read and write ECW files for a few small dev tasks. If it was a read only task then I would use the newer version of the read only ECW libs. I agree that open source JPEG-2000 options are becoming much better, and would rather not touch the ECW format. In time I think we can move to this.

Cheers,
Jeremy



_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compiling ECW 3.3 on MacOSX

Even Rouault-2

Hi Jeremy,

 

> https://gist.github.com/palmerj/54fa389c4e60fa7b9f1d5ceea7ac3359

 

Note that https://trac.osgeo.org/gdal/wiki/ECW references

https://trac.osgeo.org/gdal/attachment/wiki/ECW/libecwj2-3.3.patch which is the cumlated patch of a number of patches that have been collected over the years (for Linux builds)

 

I see that your gist has some of the fixes of libecwj2-3.3.patch, and a lot more (but some are not so obvious without digging more in the code)

 

This ECW situation is such a mess. Sigh

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compiling ECW 3.3 on MacOSX

John Daniel-2
As I explained to Jeremy in an e-mail, I made those changes years ago. I don’t remember the exact details. I do know that those are all specific to OS X, and specifically to OS X and the Xcode toolchain circa 2011 (maybe?). Things are much different today. I must have needed those changes to make it work on the Mac. I did use this code to process a fair amount of JPEG2000-encoded NITF data. It seemed to work fine at the time.

However, I never applied these changes to any production Linux builds. They were only for the Mac and I only used the Mac for development. I would not recommend using this patch for any real data.

As soon as OpenJPEG became viable, I switched to that. Plus that ECW code has questionable licensing - real mess. Unfortunately, Jeremy has actual ECW files. I never had any of those.

However, you could use this patch to get a functional GDAL build with ECW and run tests. Then try to back out some of the more mysterious changes. That is always easier to do when you have it running and testable.

John Daniel
Etresoft, Inc.

On Jan 5, 2018, at 8:12 AM, Even Rouault <[hidden email]> wrote:

Hi Jeremy,

 

 

https://trac.osgeo.org/gdal/attachment/wiki/ECW/libecwj2-3.3.patch which is the cumlated patch of a number of patches that have been collected over the years (for Linux builds)

 

I see that your gist has some of the fixes of libecwj2-3.3.patch, and a lot more (but some are not so obvious without digging more in the code)

 

This ECW situation is such a mess. Sigh

 

Even

 

--
Spatialys - Geospatial professional services
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compiling ECW 3.3 on MacOSX

Jeremy Palmer-3
In reply to this post by Even Rouault-2
Hi Even,

Happy New Year :)

On Sat, Jan 6, 2018 at 2:12 AM, Even Rouault <[hidden email]> wrote:

Hi Jeremy,

 

I see that your gist has some of the fixes of libecwj2-3.3.patch, and a lot more (but some are not so obvious without digging more in the code)


I now have an internal git repo with both the libecwj2-3.3.patch and a selection of the MacOSX fixes provided by John. Once I have done further real world testing I can provide a new accumulative patch. 

Also do you think https://trac.osgeo.org/gdal/browser/branches/2.2/autotest/gdrivers/ecw.py is setup to test the 3.3 SDK nicely? If so I can verify the patch on LINUX and MacOSX with that.

Cheers
Jeremy


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Compiling ECW 3.3 on MacOSX

Even Rouault-2

> Also do you think

> https://trac.osgeo.org/gdal/browser/branches/2.2/autotest/gdrivers/ecw.py

> is setup to test the 3.3 SDK nicely? If so I can verify the patch on LINUX

> and MacOSX with that.

 

The tests pass fine (*) for me on Linux with ECW SDK 3.3 + libecwj2-3.3.patch. No idea on Mac

 

(*) some are skipped since testing features / fixes of later SDK versions

 

Here's the output I get:

 

$ python ecw.py

TEST: ecw_init ... success

TEST: ecw_1 ... success

TEST: ecw_2 ... success

TEST: ecw_3 ... success

TEST: ecw_4 ... success

TEST: ecw_5 ... success

TEST: ecw_6 ... success

TEST: ecw_7 ... Warning 6: NITF only supports WGS84 geographic and UTM projections.

 

success

TEST: ecw_8 ... success

TEST: ecw_9 ... success

TEST: ecw_10 ... success

TEST: ecw_11 ... success

TEST: ecw_12 ... success

TEST: ecw_13 ... success

TEST: ecw_14 ... success

TEST: ecw_15 ... success

TEST: ecw_16 ... success

TEST: ecw_17 ... Diff at pixel (0, 0) : -5.000000

Diff at pixel (1, 0) : 1.000000

Diff at pixel (2, 0) : -2.000000

Diff at pixel (3, 0) : -1.000000

Diff at pixel (4, 0) : -3.000000

Diff at pixel (5, 0) : -3.000000

Diff at pixel (6, 0) : -1.000000

Diff at pixel (9, 0) : 2.000000

Diff at pixel (10, 0) : -3.000000

Diff at pixel (13, 7) : -6.000000

Max diff : 6

Number of diffs : 302

success

TEST: ecw_18 ... success

TEST: ecw_19 ... success

TEST: ecw_20 ... success

TEST: ecw_21 ... success

TEST: ecw_22 ... success

TEST: ecw_23 ... success

TEST: ecw_24 ... success

TEST: ecw_25 ... success

TEST: ecw_26 ... success

TEST: ecw_27 ... success

TEST: ecw_28 ... success

TEST: ecw_29 ... success

TEST: ecw_30 ... success

TEST: ecw_31 ... skip

TEST: ecw_32 ... success

TEST: ecw_33 ... success

TEST: ecw_33_bis ... success

TEST: ecw_34 ... skip

TEST: ecw_35 ... success

TEST: ecw_36 ... skip

TEST: ecw_37 ... skip

TEST: ecw_38 ... skip

TEST: ecw_39 ... skip

TEST: ecw_40 ... ERROR 1: An error has occurred: Error 86 "File is invalid or corrupt" file "" line 0

ERROR 1: Cannot open data/stefan_full_rgba_ecwv3_meta.ecw which looks like a ECW format v3 file, that requires ECW SDK 5.0 or later

skip

TEST: ecw_41 ... skip

TEST: ecw_42 ... skip

TEST: ecw_43 ... success

TEST: ecw_44 ... skip

TEST: ecw_45 ... success

TEST: ecw_46 ... success

TEST: ecw_47 ... skip

TEST: ecw_48 ... success

TEST: ecw_49 ... success

TEST: ecw_online_1 ... success

TEST: ecw_online_2 ... success

TEST: ecw_online_4 ... As GDAL_DOWNLOAD_TEST_DATA environment variable is not defined, some tests relying on data to downloaded from the Web will be skipped

skip

TEST: ecw_online_5 ... success

TEST: ecw_online_6 ... success

TEST: ecw_online_7 ... success

TEST: ecw_cleanup ... success

 

Test Script: ecw

Succeeded: 46

Failed: 0 (0 blew exceptions)

Skipped: 12

Expected fail:0

Duration: 13.19s

As GDAL_DOWNLOAD_TEST_DATA environment variable is not defined, 1 tests relying on data to downloaded from the Web have been skipped

 

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev