SNAP headless on ARM

Hi Marco

I’m trying to set up SNAP on an Ubuntu 22.04 ARM instance in AWS for running gpt headlessly.

The installation fails with:

user@ip-172-31-4-181:~$ ./esa-snap_sentinel_unix_9_0_0.sh -c
Unpacking JRE …
Starting Installer …
./esa-snap_sentinel_unix_9_0_0.sh: 600: /home/user/esa-snap_sentinel_unix_9_0_0.sh.725251.dir/jre/bin/java: Exec format error

I suspect this is a result of it being built for an x86 architecture.

I don’t see anything architecture specific on the download page, and cannot seem to find information regarding building this for ARM from source. There’s lots of snap-engine and snap-desktop info, and I’ve successfully retrieved and built those, and all the toolboxes, however I cannot seem to find where gpt resides, nor how to invoke it.

Hello Charles,

Yes, the installers are made for the x86 architecture. There is no installer available for ARM as it wasn’t necessary in the past. We need to consider this for the next version.

Till then, the easiest solution for you would be to

  • Install SNAP on a x86 system and copy the installation directory to the ARM system.
  • Replace the jre folder with JAVA jre v8 for ARM.

Afterwards it should work.
But still you will run into issues. For example, the GDAL readers and writers will not work and the netcdf format will not work as the native libs are not available.

Thanks for the update, Marco. I’ll try as you suggest, but if you say the GDAL readers and writers will not work, that suggests to me that gpt will not work. I’ll post the result of my attempt regardless.

Yup, for the record, gpt will not load using the above method:

root@ip-172-31-4-181:/home/ubuntu# /usr/local/snap/bin/gpt --help
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Incompatible GDAL 3.4.1 found on system. Internal GDAL 3.2.1 from distribution will be used.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Incompatible GDAL 3.4.1 found on system. Internal GDAL 3.2.1 from distribution will be used.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Internal GDAL 3.2.1 set to be used by SNAP.
SEVERE: org.esa.s2tbx.dataio.gdal.GDALLoader: Failed to initialize GDAL native drivers. GDAL readers and writers were disabled./root/.snap/auxdata/gdal/libenvironment-variables.so: /root/.snap/auxdata/gdal/libenvironment-variables.so: cannot open shared object file: No such file or directory (Possible cause: can’t load AMD 64-bit .so on a AARCH64-bit platform)
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.

Is it possible to run this in a Docker container? Would that still have the inherent issue with the GDAL readers and writers?

In a docker it should work.

But I wonder why GDAL stops the whole GPT.
Other readers and writer should work only GDAL should be disabled.

@oana_hogoiu can you have a look at this?
An error during the init of GDAL should only show a message but should not stop SNAP or gpt.

I actually did not try to process a graph. Giving that a go now

Hi Carlos,

Regarding your issue, the log provides the following details:

SNAP found an installed GDAL distribution on your system, but it’s incompatible because it doesn’t contain drivers for versions between 2.1.x and 3.2.x, so it will try to use the internal SNAP distribution (3.2.1).

SNAP fails to load the internal GDAL distribution because the native libraries are compiled for AMD 64-bit (they contain instructions for AMD processors) and cannot be loaded and executed on your platform, which is AARCH64-bit (ARM).

In future, we consider to compile the internal GDAL distribution also for AARCH64-bit platform.

You can try to install a compatible GDAL distribution for SNAP, a version between 2.1.x and 3.2.x.

The error which occurs at loading GDAL native libraries should not have an impact on GPT processing or other SNAP components, excepting GDAL readers and writers, which will be disabled.

Regards
Adrian

JIRA ticket SNAP-3440 created, for considering in future to compile GDAL distribution also for AARCH64-bit platform.

Ok, I had to do some re–jigging of our error hander (the error text contains ‘SEVERE’, so we stop processing), but I can confirm that gpt is successfully continues and does process our graphs.

1 Like

Correction here. SNAP is unable to write the resulting DIM file in the graph’s write operation. We have reverted to x86 until there is an ARM version that has the correct Java VM and read/write issues with GDAL resolved.

1 Like