[MONGOCRYPT-25] Unable to link against static libmongocrypt on OSX Created: 10/Jun/19  Updated: 27/Oct/23  Resolved: 10/Jun/19

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Matt Broadstone Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It seems like there are issues statically linking to libmongocrypt on OSX due to an inability to determine the architecture of the library. I get the following error message trying to link to it:

  c++ -bundle -undefined dynamic_lookup -Wl,-no_pie -Wl,-search_paths_first -mmacosx-version-min=10.7 -arch x86_64 -L./Release -stdlib=libc++  -o Release/mongocrypt.node Release/obj.target/mongocrypt/src/mongocrypt.o /Users/mbroadst/Development/mongo/libmongocrypt/bindings/node/deps/libmongocrypt/lib64/libmongocrypt-static.a
ld: warning: ignoring file /Users/mbroadst/Development/mongo/libmongocrypt/bindings/node/deps/libmongocrypt/lib64/libmongocrypt-static.a, file was built for archive which is not the architecture being linked (x86_64): /Users/mbroadst/Development/mongo/libmongocrypt/bindings/node/deps/libmongocrypt/lib64/libmongocrypt-static.a

the contents of the archive are:

[mbroadst@gorgor node (node-bindings ✗)]$ ar -t deps/libmongocrypt/lib64/libmongocrypt-static.a
/
//
/0
/23
/46
/68
/99
/125
/152
/175
/203
/231
/259
/279
/299
/326
/350
/370
/394
/415
/438
mongocrypt.c.o/
os_mutex.c.o/
os_once.c.o/
openssl.c.o/
kms_b64.c.o/
hexlify.c.o/
/468
/493
kms_kv_list.c.o/
kms_message.c.o/
kms_request.c.o/
/518
/539
/560
/578
sort.c.o/
/603

on linux things look as expected:

mbroadst@simulated-cell:~/test/lib$ ar -t libmongocrypt-static.a 
mongocrypt-binary.c.o
mongocrypt-buffer.c.o
mongocrypt-cache.c.o
mongocrypt-cache-collinfo.c.o
mongocrypt-cache-key.c.o
mongocrypt-ciphertext.c.o
mongocrypt-crypto.c.o
mongocrypt-ctx-datakey.c.o
mongocrypt-ctx-decrypt.c.o
mongocrypt-ctx-encrypt.c.o
mongocrypt-ctx.c.o
mongocrypt-key.c.o
mongocrypt-key-broker.c.o
mongocrypt-kms-ctx.c.o
mongocrypt-log.c.o
mongocrypt-marking.c.o
mongocrypt-opts.c.o
mongocrypt-status.c.o
mongocrypt-traverse-util.c.o
mongocrypt.c.o
os_mutex.c.o
os_once.c.o
openssl.c.o
kms_b64.c.o
hexlify.c.o
kms_decrypt_request.c.o
kms_encrypt_request.c.o
kms_kv_list.c.o
kms_message.c.o
kms_request.c.o
kms_request_opt.c.o
kms_request_str.c.o
kms_response.c.o
kms_response_parser.c.o
sort.c.o
kms_crypto_openssl.c.o



 Comments   
Comment by Matt Broadstone [ 10/Jun/19 ]

Looks like this was caused by a mistake in my script. It downloaded a tarball for Amazon Linux instead of OSX for this build!

Generated at Thu Feb 08 09:07:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.