Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to legacy_stdio_definitions only when building with MSVC #777

Merged

Conversation

uilianries
Copy link
Contributor

@uilianries uilianries commented Jun 18, 2024

Hello!

We are packaging rebound in Conan and we noted it failed to build using Clang on Linux. The complete failed build log can be found here

The error occurred because the Linux environment was not capable to find the library legacy_stdio_definitions.lib. That library is exclusive for Visual Studio environments:

https://learn.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp?view=msvc-170

To provide partial link compatibility with object files (and libraries) compiled with older versions of the Microsoft C Runtime headers, we provide a library, legacy_stdio_definitions.lib, with Visual Studio 2015 and later. This library provides compatibility symbols for most of the functions and data exports that were removed from the Universal CRT. The set of compatibility symbols provided by legacy_stdio_definitions.lib is sufficient to satisfy most dependencies, including all of the dependencies in libraries included in the Windows SDK.

This pull request adds a condition to link that library only when building on Windows and using Visual Studio, avoiding linkage errors in Linux.

/cc @RubenRBS

@hannorein
Copy link
Owner

Thanks for this! Strange that this didn't come up before. I guess it's not an issue for gcc/icc on Linux?

@hannorein hannorein merged commit 67b629d into hannorein:main Jun 18, 2024
28 checks passed
@uilianries
Copy link
Contributor Author

Thanks for this! Strange that this didn't come up before. I guess it's not an issue for gcc/icc on Linux?

It didn't fail for me on Linux + GCC. But there is difference depending how you installed your Clang in Linux. In my case, I built it from source, using minimal flags. However, using Clang version distributed via Ubuntu APT there is no such error. Anyway, it should be a feature for Windows only.

Thank for reviewing and accepting it quickly.

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