mozilla / application-services

Firefox Application Services
https://mozilla.github.io/application-services/
Other
608 stars 224 forks source link

sqlite-related build failures on Rust 1.50 #3810

Closed rfk closed 3 years ago

rfk commented 3 years ago

I noticed this from a CircleCI failure log but it can be reproduced locally using cargo +beta test:

$> cargo +beta test
[...]
   Compiling logins v0.1.0 (/Users/rfk/repos/mozilla/application-services/components/logins)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/rfk/.rustup/toolchains/beta-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/rfk/repos/mozilla/application-services/target/debug/deps/autofill-929815e762053b1a.12a985zwopqh7c70.rcgu.o" [...tons of other files here...] "/Users/rfk/.rustup/toolchains/beta-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-d920b5b3bda8066e.rlib" "-lsqlcipher" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: Undefined symbols for architecture x86_64:
            "_PK11_Decrypt", referenced from:
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_PBEKeyGen", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_PK11_GetKeyData", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_SECOID_DestroyAlgorithmID", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_NSS_GetVersion", referenced from:
                _sqlcipher_nss_get_provider_version in libsqlcipher.a(sqlite3.o)
            "_PK11_DigestFinal", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_CreateContextBySymKey", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_DigestBegin", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_CreatePBEV2AlgorithmID", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_PK11_DestroyContext", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_Encrypt", referenced from:
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_GenerateRandom", referenced from:
                _sqlcipher_nss_random in libsqlcipher.a(sqlite3.o)
            "_PK11_GetInternalSlot", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_ImportSymKey", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_ExtractKeyValue", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_PK11_DigestOp", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_FreeSymKey", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_FreeSlot", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_NSS_ShutdownContext", referenced from:
                _sqlcipher_nss_deactivate in libsqlcipher.a(sqlite3.o)
            "_NSS_InitContext", referenced from:
                _sqlcipher_nss_activate in libsqlcipher.a(sqlite3.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

Doesn't seem to reproduce when using stable Rust.

┆Issue is synchronized with this Jira Task ┆Epic: Sync Maintainability Focus ┆Sprint: SYNC - 2021-03-12

rfk commented 3 years ago

Strangely, if I test individual packages then it all seems to work fine:

$>  cargo +beta test -p webext-storage
   Compiling dirs v1.0.5
   Compiling serde_json v1.0.59
   Compiling bstr v0.2.14
   Compiling term v0.5.2
   Compiling csv v1.1.4
   Compiling rusqlite v0.24.2
   Compiling prettytable-rs v0.8.0
   Compiling sync-guid v0.1.0 (/Users/rfk/repos/mozilla/application-services/components/support/guid)
   Compiling sql-support v0.1.0 (/Users/rfk/repos/mozilla/application-services/components/support/sql)
   Compiling sync15-traits v0.1.0 (/Users/rfk/repos/mozilla/application-services/components/support/sync15-traits)
   Compiling webext-storage v0.1.0 (/Users/rfk/repos/mozilla/application-services/components/webext-storage)
    Finished test [unoptimized + debuginfo] target(s) in 7.62s
     Running target/debug/deps/webext_storage-9a7a3c8b5dde1a26

running 52 tests
test api::tests::test_serialize_storage_changes ... ok
[...]
test api::tests::test_quota_maxitems ... ok

test result: ok. 52 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.91s

   Doc-tests webext-storage

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

So, not entirely sure what's going on here...

rfk commented 3 years ago

The failing version of Rust is now in stable release, and in fact is the default experience for new devs setting up to build this repo. So, this probably becomes more urgent.

rfk commented 3 years ago

@dmose has been working on a fix here, so assigning him the issue for visibility.

dmose commented 3 years ago

https://github.com/mozilla/application-services/commit/d789b75a406af725beef60a01e4ef2e51b38c0b5 fixed the problem for many/all folks seeing it at that time. I've got a new report of it on M1, though...

boek commented 3 years ago

Can confirm, getting a similar error when trying to run cargo test on an M1

Compiling sql-support v0.1.0 (/Users/boek/git/mozilla/application-services/components/support/sql)
   Compiling nimbus-sdk v0.10.0 (/Users/boek/git/mozilla/application-services/components/nimbus)
   Compiling crashtest v0.1.0 (/Users/boek/git/mozilla/application-services/components/crashtest)
   Compiling autofill v0.1.0 (/Users/boek/git/mozilla/application-services/components/autofill)
   Compiling sync_manager v0.1.0 (/Users/boek/git/mozilla/application-services/components/sync_manager)
   Compiling cli-support v0.1.0 (/Users/boek/git/mozilla/application-services/examples/cli-support)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-arch" "arm64" "-L" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.12ra2pry9vee6j1p.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.1465pmnnx3wze12z.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.15fs8jd6v83837fq.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.18oxu6k38eql70gk.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.1j0ebbdbfxeeqtro.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.1oxobnozudxojp0l.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.1y504l57xli2kw4h.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.251nn8om0xef7525.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.25lq5705sarsn0fg.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.26d0o34u9bvs084j.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2dsg7duogaz7ql2f.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2jg663arkeq9sspw.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2kziuby3u2krthhi.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2qysy5nz256902zk.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2whuwjedsoegqlwt.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2wtql8r134wwzgec.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2x5iq3i84gr63qew.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.2zvyzr9uryo9ao4g.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.3b86cuklbkhpafxo.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.3fde7v1cf03tblqa.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.3ir58fbyltrfsqcl.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.3k0nqzngm4wag3we.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.3mooqw3kde4vhd6k.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.3z6siqkukohlj2yk.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.41jc17nyd4yo71i5.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.43xomp69qk9r57ha.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.44nyjzshwfr31jfc.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4ajzx1446uyw24mv.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4dehrn8d2zcqnr3a.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4dfdbwyus4ojbl62.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4efx32aoju74djnx.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4i0iotyp3ckowg47.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4n72srip8qeq7zf0.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4s1yclks60758mtq.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.4ushcrz0tkyp4aju.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.50ofaknokmx6r0e5.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.51c17ofpld2om6up.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.547ogs7il61um0k8.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.54dmv0g1sw1w3u86.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.56pd5x7vlzkdln3f.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.56sjty8vpmqj5im2.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.59ky49cf3bpuwpej.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.5f960yjs34s4pvod.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.5gcwu8nw0v92x0l8.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.7bciit4pbwdkzgg.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.izc24stio214cpy.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.klf8hmca251i4jn.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.nchj1fg9eu9tuvs.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.okl3933bcn7fzga.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.rgzb5kgpa0943q6.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.sd17vqn94693i22.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.u92oda5imlrp6cq.rcgu.o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.zn7i981oi6jxfwh.rcgu.o" "-o" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709" "/Users/boek/git/mozilla/application-services/target/debug/deps/sql_support-656a129ec4e87709.20cuc5soapub3fed.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/boek/git/mozilla/application-services/target/debug/deps" "-L" "/Users/boek/git/mozilla/application-services/libs/desktop/darwin/sqlcipher/lib" "-L" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libtest-303cd3b318b4e4a8.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libterm-3f6cf2b65e1d5137.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgetopts-cdbb8ee08cb4697a.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunicode_width-2aabc9ba124dc5f6.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_std-0aff6172f95dea7d.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libinterrupt_support-046ecd87a5dbf049.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libffi_support-f80a10ec15f2237d.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/liblog-a07b5a70b9ae3207.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libcfg_if-c64ee5e9237a32fe.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/liblazy_static-3d78c4120713bc41.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/librusqlite-764ca3575fed1a39.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libbitflags-c4d6018c8c3d5b8d.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libsmallvec-0e602304815e7bdd.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libserde_json-4f328a4068816caa.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libryu-b45f5b7d32e296e9.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libitoa-7a07d187424cae99.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libserde-c8811cb1431a720f.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libfallible_streaming_iterator-0a60c6e14b6ae7ab.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libfallible_iterator-8298f942c03fb5ed.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libhashlink-2d97eef2818dd33e.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libhashbrown-4c383b6187e9ead9.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/libahash-b750afa95ede2c43.rlib" "/Users/boek/git/mozilla/application-services/target/debug/deps/liblibsqlite3_sys-fd7a0aa9d16cceb5.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-f6f9eec1635e636a.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-07bfff44bf62cf3f.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-e3809bc8b111425e.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-33d64533e0aadcef.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-31e2a1400703b71d.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-71c15ba138da3496.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-2204c7cc9a01ef25.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-d6e5ece9c771a842.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-565bb23bb41bc8f6.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-8895b042fd9d6a9d.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-cacf286c763defc4.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-348755f31f5f7b8f.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-00b1c5d56c8c46f3.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-59ed52fd3946b1c5.rlib" "/Users/boek/.rustup/toolchains/1.50.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-d11cefe128d6b458.rlib" "-lsqlcipher" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: Undefined symbols for architecture arm64:
            "_PK11_Decrypt", referenced from:
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_PBEKeyGen", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_PK11_GetKeyData", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_SECOID_DestroyAlgorithmID", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_NSS_GetVersion", referenced from:
                _sqlcipher_nss_get_provider_version in libsqlcipher.a(sqlite3.o)
            "_PK11_DigestFinal", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_CreateContextBySymKey", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_DigestBegin", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_CreatePBEV2AlgorithmID", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_PK11_DestroyContext", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_Encrypt", referenced from:
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_GenerateRandom", referenced from:
                _sqlcipher_nss_random in libsqlcipher.a(sqlite3.o)
            "_PK11_GetInternalSlot", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_ImportSymKey", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_ExtractKeyValue", referenced from:
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
            "_PK11_DigestOp", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
            "_PK11_FreeSymKey", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_PK11_FreeSlot", referenced from:
                _sqlcipher_nss_hmac in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_kdf in libsqlcipher.a(sqlite3.o)
                _sqlcipher_nss_cipher in libsqlcipher.a(sqlite3.o)
            "_NSS_ShutdownContext", referenced from:
                _sqlcipher_nss_deactivate in libsqlcipher.a(sqlite3.o)
            "_NSS_InitContext", referenced from:
                _sqlcipher_nss_activate in libsqlcipher.a(sqlite3.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
rfk commented 3 years ago

/cc @skhamis, who IIUC has been working on application-services on an M1 ^

skhamis commented 3 years ago

hiya! Unfortunately I was only able to get this working on the nightly toolchain with command: cargo +nightly test EDIT: seems to work too with cargo +stable test

rfk commented 3 years ago

Trimming the names of the object files from the failing command, it's doing:

"cc" "-arch" "arm64" [...lots of files to link...] "-lsqlcipher" "-lSystem" "-lresolv" "-lc" "-lm"

So it's listing sqlcipher to link against, but not any of the NSS libraries, which might explain failing to link NSS-related symbols.

I wonder if something is going wrong in the logic for nss_build_common, which is supposed to inspect the target platform and emit linker flags to find the correctly NSS libraries. Perhaps not being called, or not outputting the correct libraries.

@boek if switching to nightly doesn't work for you, please try:

I'm hoping this may print out some more helpful diagnostic information, or at least a different obscure error that we can pull on to follow the thread.

boek commented 3 years ago

@rfk it built and ran tests with cargo +stable test. Wild.

rfk commented 3 years ago

Ref https://github.com/mozilla/application-services/issues/4140 for further followups on building with M1, seems to be because we're behind current stable Rust.