[MONGOCRYPT-470] Build fails on FreeBSD. Error: Don't know how to get the module path on this platform Created: 09/Aug/22  Updated: 28/Oct/23  Resolved: 03/Nov/22

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: 1.5.0, 1.6.0
Fix Version/s: 1.7.0, 1.6.2, 1.7.0-alpha0

Type: Bug Priority: Unknown
Reporter: MGlaus N/A Assignee: Colby Pike
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-4465 Cannot build libmongoc with SRV suppo... Closed
related to MONGOCRYPT-497 os_dll.c fails to compile in Cygwin e... Backlog

 Description   

Build for version 1.5.0 (tested 1.6.0 too, and other version might be affected to) fails on FreeBSD with following message.

...
[ 22%] Building C object CMakeFiles/mongocrypt.dir/src/mongocrypt-opts.c.o
[ 22%] Building C object CMakeFiles/mongocrypt.dir/src/mongocrypt-status.c.o
[ 22%] Building C object CMakeFiles/mongocrypt.dir/src/mongocrypt-traverse-util.c.o
[ 22%] Building C object CMakeFiles/mongocrypt.dir/src/mongocrypt-util.c.o
/path/to/dir/mongo/libmongocrypt/src/mongocrypt-util.c:93:2: error: "Don't know how to get the module path on this platform"
#error "Don't know how to get the module path on this platform"
 ^
1 error generated.
*** Error code 1Stop.
make[2]: stopped in /path/to/dir/mongo/libmongocrypt/cmake-build
*** Error code 1Stop.
make[1]: stopped in /path/to/dir/mongo/libmongocrypt/cmake-build
*** Error code 1Stop.
make: stopped in /path/to/dir/mongo/libmongocrypt/cmake-build 

 

Fixing the issue with the following patch revealed an other issue, which i managed to solve in the same way. I know this patch is not suited for a release, but maybe it helps to get it fixed.

--- a/src/mongocrypt-util.c
+++ b/src/mongocrypt-util.c
@@ -78,7 +78,7 @@ current_module_path ()
       }
       free (path);
    }
-#elif defined(_GNU_SOURCE) || defined(_DARWIN_C_SOURCE)
+#elif 1 || defined(_GNU_SOURCE) || defined(_DARWIN_C_SOURCE)
    // Darwin/BSD/glibc define extensions for finding dynamic library info from
    // the address of a symbol.
    Dl_info info;
--- a/src/os_posix/os_dll.c
+++ b/src/os_posix/os_dll.c
@@ -105,7 +105,7 @@ mcr_dll_path (mcr_dll dll)
       .error_string = mstr_copy_cstr ("Handle not found in loaded modules")};
 }-#elif defined(__linux__)
+#elif 1 || defined(__linux__) #include <link.h> 

 

make test ran fine with this patch, but the following got skipped:

The following tests did not run:
      7 - test_kms_azure_online (Skipped)
      8 - test_kms_gcp_online (Skipped) 



 Comments   
Comment by Githook User [ 05/Dec/22 ]

Author:

{'name': 'vector-of-bool', 'email': 'vectorofbool@gmail.com', 'username': 'vector-of-bool'}

Message: MONGOCRYPT-470 Support SO path queries on FreeBSD (#485)

FreeBSD contains sufficient libc support for SO path loading
Branch: r1.6
https://github.com/mongodb/libmongocrypt/commit/eebb002b39d5fb7c3f330b5d2f1c23181f7e94b8

Comment by Githook User [ 03/Nov/22 ]

Author:

{'name': 'vector-of-bool', 'email': 'vectorofbool@gmail.com', 'username': 'vector-of-bool'}

Message: MONGOCRYPT-470 Support SO path queries on FreeBSD (#485)

FreeBSD contains sufficient libc support for SO path loading
Branch: master
https://github.com/mongodb/libmongocrypt/commit/d960d8b9a0b7224c77873d148a3009cccf3b773a

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