[CDRIVER-3225] Static libraries produced by cmake builds on Linux cannot be used without modification Created: 09/Jul/19 Updated: 28/Oct/23 Resolved: 25/Feb/20 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | Build |
| Affects Version/s: | 1.14.0 |
| Fix Version/s: | 1.17.0-beta, 1.17.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Emanuel Birge | Assignee: | Roberto Sanchez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 16.04/18.04, quite possibly Linux in general |
||
| Description |
|
It's possible that I simply don't understand the required intricacies of building with CMake. If so I apologise. What am I doing Problem 1 (I consider this as being slightly broken)
The offending symbols are
And the symptom of which is multiple definition errors when linking libmongoc and libbson against my artifact(s).
Problem 2 (minor, but annoying)
The workaround I used here was to simply set CFLAGS=-fPIC CXXFLAGS=-fPIC, but it would be nice if there was a proper build flag for setting them. Like ENABLE_PIC or something along those lines. Problem 3 (confusing) The workaround for problem 1 seems overly hackish just to be able to use the static libraries. I'm not sure how you'd fix it in a proper manner since I'm not very familiar with mongoc's CMake setup. Is there to your knowledge a better way to achieve this than my current workaround? Would it be possible to get it fixed at your end so that I don't have to feel so dirty using objcopy? Thanks! |
| Comments |
| Comment by Githook User [ 27/Feb/20 ] |
|
Author: {'username': 'rcsanchez97', 'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com'}Message: |
| Comment by Roberto Sanchez [ 25/Feb/20 ] |
|
emanuel.birge, the two commits I just pushed address your first two concerns. The symbol collisions have been fixed by prefixing them using the pre-processor, depending on which library they are being compiled for. PIC can be enabled for the static library components using a new option, as requested. We have discussed your third concern internally and we are considering how to proceed. Keep in mind that the "1.0" in the name of libmongoc and libbson (and their associated CMake and pkg-config packages) is not the ABI version. The ABI of libmongoc and libbson has not been bumped from "0" in the history of either library, as neither has experienced an ABI-breaking change. It is not immediately clear that there would be much benefit from incrementing the minor or patch versions of the ABI. If there are specific use cases of which we should be aware that would benefit from more precise ABI versioning, please let us know. |
| Comment by Githook User [ 25/Feb/20 ] |
|
Author: {'username': 'rcsanchez97', 'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com'}Message: |
| Comment by Githook User [ 25/Feb/20 ] |
|
Author: {'username': 'rcsanchez97', 'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com'}Message: |
| Comment by Kevin Albertson [ 23/Jul/19 ] |
|
Hi emanuel.birge, thank you for the detailed report! We will investigate this after our 1.15.0 release. |