Daml start doesn't work on MacBook Pro M1 with daml version 1.16.0

I see below exception on running command “daml start” in MacBook Pro M1, the version i am using is 1.16. Is there a way to override the underlying postgres jdbc driver to get this to work?

12:38:58.092 [program-resource-pool-2] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.

java.sql.SQLException: Error opening connection

at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:239)

at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)

at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)

at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)

at org.sqlite.JDBC.createConnection(JDBC.java:115)

at org.sqlite.JDBC.connect(JDBC.java:90)

at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:119)

at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369)

at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)

at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)

at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)

at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)

at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)

at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)

at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80)

at org.flywaydb.core.Flyway.execute(Flyway.java:453)

at org.flywaydb.core.Flyway.migrate(Flyway.java:158)

at com.daml.ledger.on.sql.Database$UninitializedDatabase.migrate(Database.scala:226)

at com.daml.ledger.on.sql.SqlLedgerReaderWriter$Owner.$anonfun$acquire$1(SqlLedgerReaderWriter.scala:109)

at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:431)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:829)

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 org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:335)

at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)

at org.sqlite.core.NativeDB.load(NativeDB.java:63)

at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)

... 22 common frames omitted

12:38:58.140 [scala-execution-context-global-33] ERROR com.daml.resources.ProgramResource - Shutting down because of an initialization error.

org.flywaydb.core.internal.exception.FlywaySqlException:

Unable to obtain connection from database: Error opening connection

-------------------------------------------------------------------

SQL State : null

Error Code : 0

Message : Error opening connection

at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:65)

at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80)

at org.flywaydb.core.Flyway.execute(Flyway.java:453)

at org.flywaydb.core.Flyway.migrate(Flyway.java:158)

at com.daml.ledger.on.sql.Database$UninitializedDatabase.migrate(Database.scala:226)

at com.daml.ledger.on.sql.SqlLedgerReaderWriter$Owner.$anonfun$acquire$1(SqlLedgerReaderWriter.scala:109)

at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:431)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at java.base/java.lang.Thread.run(Thread.java:829)

Caused by: java.sql.SQLException: Error opening connection

at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:239)

at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:61)

at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)

at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:21)

at org.sqlite.JDBC.createConnection(JDBC.java:115)

at org.sqlite.JDBC.connect(JDBC.java:90)

at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:119)

at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369)

at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)

at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)

at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)

at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)

at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)

at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)

... 9 common frames omitted

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 org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:335)

at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:64)

at org.sqlite.core.NativeDB.load(NativeDB.java:63)

at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:235)

... 22 common frames omitted

Hi @nagendra,

We do not currently support running Daml on M1 macs. As far as I know, recent versions of Daml run fine under Rosetta, though.

Any reason why you’re still using 1.16? It’s pretty ancient at this point, so I’d strongly encourage you to upgrade to at least 1.18.3 (where the upgrade path should be painless), but really 2.4.0 (there may be a bit more work for the 1.x->2.x transition, but my understanding is it’s fairly minimal).

Beyond that, I can’t give you anything more specific without more details on what you’re doing. In this case, a public GitHub repo with the Daml project you are trying to run daml start in would be a good starting point. (Or a minimal reproduction repo, if the original is too large / confidential.)

I believe that the issue is caused by Navigator. You could try daml start --start-navigator=false.

Hi @Gary_Verhaegen,

Thanks for quick response. I’ve been hired into a project which [unfortunately] uses 1.16. Do you mean that 1.18.3 will work on M1 macs[with or without rosetta]?

Hello @cocreature, tried and i still see the same error.

Anecdotally, on my M1 machine, this fails with the same error as yours:

$ cd $(mktemp -d)
$ export DAML_SDK_VERSION=1.16.0
$ daml new t
Created a new project in "t" based on the template "skeleton".
$ cd t
$ cat daml.yaml | grep sdk
sdk-version: 1.16.0
$ daml start

while this succeeds:

$ cd $(mktemp -d)
$ export DAML_SDK_VERSION=1.18.3
$ daml new t
Created a new project in "t" based on the template "skeleton".
$ cd t
$ cat daml.yaml | grep sdk
sdk-version: 1.18.3
$ daml start

Though, again, this should not be construed as meaning that 1.18.3 is supported on M1.

The error seems to be due to the sqlite-jdbc driver being unable to find the native library to connect to Sqlite. The first version of sqlite-jdbc to support ARM-powered Macs seems to be 3.32.3.3 (according to this comment on the library’s repository). It looks like we updated our dependency on Sqlite in this PR which first landed in 1.17.0, which explains the error that @nagendra is experiencing.

Does this workaround help?

1.18.3 works for me too, rosetta was no good for 1.16. 1.17 is working as well, i guess i’ll have to persuade my team to upgrade to 1.17 at the least. Thanks a lot for the support.

The workaround didn’t work, upgrade to 1.17 works though. Thank you, the contents of your post helped a lot.