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

[microsoft-signalr] Fix build error on Linux #14872

Merged

Conversation

NancyLi1013
Copy link
Contributor

@NancyLi1013 NancyLi1013 commented Dec 1, 2020

Describe the pull request

When building on Linux, it will fail due to this error:

error: cannot use typeid with -fno-rtti

There are two reasons to fix this problem:

  1. -fno-rtti is only for non windows Platform.
  2. typeid is an RTTI-feature. So turning off RTTI (-fno-rtti) also disables features like typeid.

-fno-rtti should not be added here https://github.com/aspnet/SignalR-Client-Cpp/blob/master/src/signalrclient/CMakeLists.txt#L63.

So I make a patch to remove these codes.

    # GCC on OSX has a bug with exceptions and no-rtti that can cause crashes
    if(NOT APPLE)
        target_compile_options(signalrclient PRIVATE -fno-rtti)
    endif()

Please see the references:

[1] https://scc.ustc.edu.cn/zlsc/tc4600/intel/2017.0.098/compiler_c/common/core/GUID-BA6071E9-2409-4118-84B5-8E1ABE0C2B72.html
[2] https://stackoverflow.com/questions/8723702/error-cannot-use-typeid-with-fno-rtti

Note: No need to test features.

@NancyLi1013 NancyLi1013 added category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team. labels Dec 1, 2020
@PhoebeHui PhoebeHui added the info:reviewed Pull Request changes follow basic guidelines label Dec 2, 2020
@BillyONeal BillyONeal merged commit ecba240 into microsoft:master Dec 3, 2020
@BillyONeal
Copy link
Member

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team. info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[microsoft-signalr] Build failure
4 participants