[CDRIVER-1343] Incorrect pkgconfig files produced when linking with static OpenSSL library Created: 23/Jun/16  Updated: 13/Jul/16  Resolved: 13/Jul/16

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.3.5
Fix Version/s: 1.4.0

Type: Bug Priority: Minor - P4
Reporter: Jonathan Wang Assignee: Hannes Magnusson
Resolution: Duplicate Votes: 0
Labels: driver
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux, clang


Issue Links:
Related
related to CDRIVER-1171 pkgconfig libmongoc-1.0.pc: fix order... Closed

 Description   

When building against a static OpenSSL library, the lib/pkgconfig/libmongoc-{1.0,priv}.pc files produced by the make install command contain the incorrect order for the libraries specified by the linker flags.

The Libs line of those files looks like this:

-L/usr/local/dy/openssl/lib -lssl -lcrypto -ldl   -lrt -L${libdir} -lmongoc-1.0

However, that link order is incorrect because `mongoc-1.0` requires symbols from the OpenSSL libraries, so the current ordering of the mongoDB library and the OpenSSL libraries is backwards. Therefore, the `Libs` line should look like this instead:

Libs: -L${libdir} -lmongoc-1.0 -L/usr/local/dy/openssl/lib -lssl -lcrypto -ldl -lrt



 Comments   
Comment by Hannes Magnusson [ 13/Jul/16 ]

This is actually a duplicate of CDRIVER-1171 which is already fixed in master.

Comment by Jonathan Wang [ 27/Jun/16 ]

When I tried to build the new C++ driver, it used those flags from the pkgconfig. That caused the C++ driver build to break on the linking steps.

Comment by Hannes Magnusson [ 27/Jun/16 ]

Out of curiosity, how did you discover this? Did it break something?

Comment by A. Jesse Jiryu Davis [ 23/Jun/16 ]

Thanks for the report; we'll fix in the next release.

Comment by Jonathan Wang [ 23/Jun/16 ]

Description with the correct formatting:

When building against a static OpenSSL library, the lib/pkgconfig/libmongoc-1.0.pc & lib/pkgconfig/libmongoc-priv.pc files produced by the make install command contain the incorrect order for the libraries specified by the linker flags.

The Libs line of the lib/pkgconfig/libmongoc-1.0.pc file looks like this:

Libs: -L/usr/local/dy/openssl/lib -lssl -lcrypto -ldl -lrt -L${libdir} -lmongoc-1.0

However, that link order is incorrect because mongoc-1.0 requires symbols from the OpenSSL libraries, so the current ordering of the mongoDB library and the OpenSSL libraries is backwards. Therefore, the Libs line should look like this instead:

Libs: -L${libdir} -lmongoc-1.0 -L/usr/local/dy/openssl/lib -lssl -lcrypto -ldl -lrt

The same goes for the lib/pkgconfig/libmongoc-priv.pc file as well, except with mongoc-priv instead of mongoc-1.0 in the Libs line.

Generated at Wed Feb 07 21:12:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.