imagej / imagej/imagej2

Clean up native platform naming across ImageJ2 components

Open
#305 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
350
PR merge metrics
No merged PRs in 30d

Description

There are at least four different places where platform naming comes into play:

1. **Bare native libraries for ImageJ/ImageJ2/Fiji.** The [ImageJ Launcher](https://imagej.net/learn/launcher) detects the platform, and sets `java.library.path` to include a folder `lib/`, which currently supports five values: `lib/win32`, `lib/win64`, `lib/macosx`, `lib/linux`, and `lib/linux-amd64`. [Here is the logic](https://github.com/imagej/imagej-launcher/blob/a1b5432d6601690faca4e0aa196201e1f69d7f19/src/main/c/java.c#L398-L423) where that is defined.

2. **Native libraries wrapped in JAR files.** The [ImageJ Updater](https://imagej.net/plugins/updater) names the platforms slightly differently: `jars/win32`, `jars/win64`, `jars/macosx`, `jars/linux32`, and `jars/linux64` (there is also `tiger`, for long-obsolete old versions of Mac OS X). [Definitions are here](https://github.com/imagej/imagej-updater/blob/36ff0fb16431a6fcfee85fba3e6b936e5856b2eb/src/main/java/net/imagej/updater/util/UpdaterUtil.java#L107-L108), used in various places around the Updater code. The Updater selects the appropriate platform, marking files automatically as suitable only for the matching platform, for things in the correct `lib` or `jars` subdirectory.

3. **Naming of native classifier JARs.** For example, `jogl-all-2.3.2-natives-linux-i586.jar`. Highly inconsistent across projects in the wild. See [here](https://github.com/scijava/pom-scijava-base/pull/29#issuecomment-1027112987) and [here](https://github.com/scijava/pom-scijava-base/pull/29#issuecomment-1028336669) and [here](https://github.com/scijava/pom-scijava-base/issues/30) for more discussion. One detail of note is that pom-scijava-base defines a property `scijava.platform.arch` which is generally equal to Java's `os.arch` except that for x86-compatible architectures (e.g. `x86_64`, `amd64`) it simplifies it down to simply the number (e.g. `64`). But for non-x86 e.g. Mac M1's ARM 64-bit architecture it will be the full `os.arch` value e.g. `arm64`.

4. **Subdirectory naming convention for native-lib-loader.** The [native-lib-loader](https://github.com/scijava/native-lib-loader) project enables dynamic loading of native libraries from inside JAR files, so that the JARs describe above in (3) can have their wrapped natives loaded easily. We use it in projects like [FLIMLib](https://github.com/flimlib/flimlib) to easily utilize native code from Java. Unfortunately, it has [its own incompatible naming convention](https://github.com/scijava/native-lib-loader/#package-native-libraries) as well, distinct from (1), (2), and (3) above.

I dislike the inconsistency in naming across these four areas, and would prefer to reconcile and standardize the naming where possible, particularly now that Mac M1 machines are in the wild using ARM architecture.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the platform logic in the ImageJ Launcher’s src/main/c/java.c, UpdaterUtil.java in ImageJ Updater, the scijava.platform.arch property in pom-scijava-base, and native-lib-loader’s package-native-libraries convention. Define the scope and compatibility requirements for reconciling these naming schemes, including ARM-based Macs; done requires an agreed consistent convention across the affected components.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, java
Domain
build-system, devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.