Support Apple Silicon chips - Exception: No native library is found for os.name=Mac and os.arch=aarch64 - sqlite.jdbc

Hello!

I am using the DIAMOND+MEGAN pipeline and having troubles “meganizing” the .daa file with the AnnoTree mapping database.

I am using macOS Monterey 12.6 with a Apple M1 Pro chip with 32 GB.

For me it seems that the current build of MEGAN does not support Apple Silicon chips, because I get an Exception when running daa-meganizer that is related to the bundled sqlite.jdbc@3.30.1 library when opening the SQL database.
The exception occurs when running via commandline and also via the graphical user interface.

The error is related that MEGAN uses an old version of sqlite.jdbc (3.30.1) that does not support Apple Silicon chips (aarch64) yet.
I have found the Github issue “No native library found for darwin aarch64” on xerial / sqlite-jdbc that is related to this problem.

Command I used to run and the error message:

(base) bernhard@macbook megan-annoTree-db % /Applications/MEGAN-CE/tools/daa-meganizer -i sample_diamond_meganized.daa -mdb megan-mapping-annotree-June-2021.db --threads 10 --verbose
Meganizer - Prepares ('meganizes') a DIAMOND .daa file for use with MEGAN
Options:
Files
	--in: sample_diamond_meganized.daa
Mode
	--longReads: false
Parameters
	--classify: true
	--minScore: 50.0
	--maxExpected: 0.01
	--minPercentIdentity: 0.0
	--topPercent: 10.0
	--minSupportPercent: 0.01
	--minSupport: 0
	--minPercentReadCover: 0.0
	--minPercentReferenceCover: 0.0
	--minReadLength: 0
	--lcaAlgorithm: naive
	--lcaCoveragePercent: 100.0
	--readAssignmentMode: readCount
Classification support:
	--mapDB: megan-mapping-annotree-June-2021.db
Deprecated classification support:
	--parseTaxonNames: true
	--firstWordIsAccession: true
	--accessionTags: gb| ref|
Other:
	--threads: 10
	--tempStoreInMemory: false
	--propertiesFile: /Users/bernhard/Library/Preferences/MEGAN.def
	--verbose: true
Version   MEGAN Community Edition (version 6.24.2, built 24 Oct 2022)
Author(s) Daniel H. Huson
Copyright (C) 2022 Daniel H. Huson. This program comes with ABSOLUTELY NO WARRANTY.
Java version: 18.0.2.1
Loading ncbi.map: 2,396,736
Loading ncbi.tre: 2,396,740
Caught:
java.io.IOException: java.sql.SQLException: Error opening connection
	at megan/megan.classification.IdMapper.loadMappingFile(IdMapper.java:144)
	at megan/megan.tools.DAAMeganizer.run(DAAMeganizer.java:228)
	at megan/megan.tools.DAAMeganizer.main(DAAMeganizer.java:62)
Caused by: java.sql.SQLException: Error opening connection
	at sqlite.jdbc@3.30.1/org.sqlite.SQLiteConnection.open(SQLiteConnection.java:239)
	at sqlite.jdbc@3.30.1/org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)
	at sqlite.jdbc@3.30.1/org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
	at sqlite.jdbc@3.30.1/org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)
	at sqlite.jdbc@3.30.1/org.sqlite.JDBC.createConnection(JDBC.java:115)
	at sqlite.jdbc@3.30.1/org.sqlite.SQLiteConfig.createConnection(SQLiteConfig.java:101)
	at megan/megan.accessiondb.AccessAccessionMappingDatabase.<init>(AccessAccessionMappingDatabase.java:83)
	at megan/megan.accessiondb.AccessAccessionAdapter.<init>(AccessAccessionAdapter.java:44)
	at megan/megan.classification.IdMapper.loadMappingFile(IdMapper.java:139)
	... 2 more
Caused by: java.lang.Exception: No native library is found for os.name=Mac and os.arch=aarch64. path=/org/sqlite/native/Mac/aarch64
	at sqlite.jdbc@3.30.1/org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:335)
	at sqlite.jdbc@3.30.1/org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)
	at sqlite.jdbc@3.30.1/org.sqlite.core.NativeDB.load(NativeDB.java:63)
	at sqlite.jdbc@3.30.1/org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)
	... 10 more
(base) bernhard@macbook megan-annoTree-db % 

I would appreciate if you could release a new MEGAN version which supports Apple Silicon chips with regard to connecting to the mapping database.
I think it should be sufficient if you bundle MEGAN with a newer version of sqlite-jdbc built after June 27, 2021 (at least release 3.36.0), since the library supports Apple Silicon chips as of that date.

Thank you so much for your support and this great tool! :blush:

All the best,
Bernhard

Dear Bernhard, thank you for pointing out the problem, it has been fixed, please update to release 6.24.4.

@Daniel thank you for the fast fix and the new MEGAN release.
I have updated to the latest release and it works now also on Apple Silicon chips. :blush:

Best regards,
Bernhard