Opened 5 years ago
#13308 new Bugs
Asio symbols are exported even when they should not
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.64.0 | Severity: | Showstopper |
Keywords: | asio mac macos symbols visibility | Cc: |
Description
Since the changeset 382804a4325b0e3b90d07f6563f5c6fd13a38052 (Use default visibility everywhere), the asio symbols are always exported on macOS even with visibility=hidden. I.e. contary what the changeset comment says. Not only it gives a bigger footprint (see ticket #12722), but it also has functional impliciations on macOS: When multiple modules export the same symbol, the macOS somehow randomly determines which instance of the symbol will be used by which module that needs it. I.e. when modules A and B export the same symbol, and module A needs to call it, then it can happen that the module A actually calls the symbol exported from B. Weird things begin to happen not only when A and B were built with different versions of boost. In practice, we are hitting this issue with our plugins for Adobe Illustrator. Illustrator itself was built with boost of some (unknown) version which is probably different in different releases of Illustrator. Our plugins are built with boost 1.59, 1.61, 1.64 and we are getting almost identical issues with all of them: the macOS decides to link our plugins to the boost symbols exported by Adobe Illustrator although our plugins carry all the required functions. The symptoms are that our plugins hang because some boost functions are called inside our plugin and some inside Illustrator itself leading to inconstistent state, esp. when different boost versions are used. The solution here is to really hide the boost asio symbols when building with visibility=hidden which is the way we build our plugins. In the attachment you can find a solution for the issue: the symbol visibility of asio now really follows the default visibility.
Patch for proper handling visibility with gcc and clang