Skip to content

Compatibility with Solaris standard C library#6

Merged
msteinert merged 1 commit into
msteinert:mainfrom
rdmark:solaris-compile
Jul 19, 2025
Merged

Compatibility with Solaris standard C library#6
msteinert merged 1 commit into
msteinert:mainfrom
rdmark:solaris-compile

Conversation

@rdmark

@rdmark rdmark commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator

The Solaris standard C library defines a bgets symbol in libgen.h which conflicts with this library

https://docs.oracle.com/cd/E36784_01/html/E36877/bgets-3gen.html

This changeset introduces a build system check for this symbol and wraps a workaround in preprocessor macros

You can also force the workaround with -Dforce-bgets-workaround=true

@rdmark

rdmark commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator Author

In the vendored version of bstring that we ship with netatalk, we have renamed the bgets symbol to bgetstream to solve the same problem, but I was thinking that we don't want to break the ABI in this library. What do you think about this approach for Solaris support?

Edit: And I should note here that the symbol naming conflict doesn't rear its ugly head when building bstring by itself, but you run into it when linking with an application like netatalk that pulls in more of the Solaris standard C library headers.

@msteinert

Copy link
Copy Markdown
Owner

I recall thinking it would have been nice if the entire API had a bstr_ prefix or similar. I agree it would be a shame to break backward compatibility.

How about a meson option to enable the name change? Enable it automatically if the setup script detects that symbol on Solaris?

@rdmark rdmark force-pushed the solaris-compile branch from 1a94fd9 to a7cfeea Compare July 18, 2025 21:33
The Solaris standard C library defines a bgets symbol
in libgen.h which conflicts with this library

https://docs.oracle.com/cd/E36784_01/html/E36877/bgets-3gen.html

This changeset introduces a build system check for this symbol
and wraps a workaround in preprocessor macros

You can also force the workaround with -Dforce-bgets-workaround=true
@rdmark rdmark force-pushed the solaris-compile branch from a7cfeea to dfc06e7 Compare July 18, 2025 22:21
@rdmark

rdmark commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator Author

Sure, I guess it could be handy to have an override just in case: Updated the PR with option -Dforce-bgets-workaround=true

@msteinert msteinert merged commit c94539a into msteinert:main Jul 19, 2025
12 checks passed
@rdmark rdmark deleted the solaris-compile branch July 19, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants