-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Errors compiling on Windows with VS 2022 17.6 LTSC #1476
Comments
On an up-to-date Windows system, TSDuck tag v3.37-3670 compiles correctly. Executing The configuration is Windows 11 with Visual Studio 2022 Community Edition, version 17.10.3, containing MSVC 19.40.33811.00. I don't think that Windows 10 vs. 11 matters. But the MSVC compiler is very unstable. Over the years, I have seen many bugs being created, then fixed. Especially when it comes to cryptic overloading interpretations as seen in your error messages. When TSDuck version 3.37-3670 was built (official build), it used MSVC 19.39.33522.00 (see From Visual Studio, it is difficult to get the real compiler version. In your environment, get the value of the macro If your version is lower than 193933522, the version which was used to build TSDuck v3.37-3670, you probably have a compiler bug and you need to upgrade to the latest version. As a rule of thumb, I have seen so many bugs in MSVC that I recommend to always upgrade to the latest version. Except in the rare cases where the latest version introduces a new bug. It happens... Otherwise, the same TSDuck source code compiles quite well with all versions of clang and gcc versions 11 and higher (again, gcc versions 8 to 10 had bugs which prevented the compilation of recent versions of TSDuck). I remove the "bug" tag since this is not a TSDuck bug. |
For _MSC_FULL_VER, I get 193632544 for LTSC 17.6.11. Upgrading to the latest on LTSC, 17.6.16, yields 193632546 for _MSC_FULL_VER, so not much help. I have a requirement to stay on LTSC, so what do you suggest in this case? |
If you have the requirement to stay with a buggy compiler instead of one that works, there is nothing I can do for you. I have worked long enough in the industry to understand that such requirement may exist. It is difficult to make management understand that such decision is only counter-productive. At best, you could install an up-to-date compiler on some other PC, even a personal one, and build an installer (and portable one if you need it). And then install these installers on your dev systems. |
That could work, thanks for the idea, although another approach is to understand what exactly is the MS compiler missing and assist it. BTW, if I use the prebuilt x64 Release library from the installer, then I get this error when linking in a test app: |
Having the prebuilt TSDuck 3.37-3670 installed, I can link a sample test application which uses
So, the symbol is exported. I don't think that the compiler version is to blame since the right symbol is looked for. |
Try the |
Yes, it's there in the DLL:
However, I don't think the liker looks at the DLL, but only at the LIB. And for that, I get:
I'm actually not using CerrReport directly, but have only added a call to ts::IPInitialize(). |
I fully support the idea of understanding first, instead of trying something else. However, your have two distinct issues.
In the second case, you get the error while compiling TSDuck. If you rebuild it elsewhere with a good compiler and install it, you should be safe on the short term. However, the overload failure is on common classes of the TSDuck public API. There is still a risk that you run into a similar problem some day with your applications. From my experience, the MSVC compiler can be extremely dangerous. Over the years, I ran into multiple compilation bugs. When they are obvious, an error message and a failing compilation, as you get, it is not too dangerous because you see it. However, in at least one occurrence, I got a silent code generation bug. This is the developer's nightmare, your source code is correct, your binary works with other compilers and on other OS, but it fails on Windows. After I reported that bug, it took one year for MS to start working on it, and an additional year to get a fix. This is why I consider MSVC as a time bomb and I absolutely recommend to upgrade to the latest version. |
Good point. But, as you observed, the symbol is there and the linker should find it.
OK, but |
I think the compiler fails to determine the value of the template argument N from the
For the call:
_setLabels is TSPacketLabelSet, which is:
So if I change the call to the following, then at least IntelliSense is happy:
|
Interesting. So, I think we all agree to call that a "compiler bug", right ? |
I have a feeling that the CompactBitSet is missing something, because there are no issues with bitset, for example:
|
Or vice-versa actually, something in CompactBitSet that the compiler doesn't quite understand. For example, if I remove the following from the template definition, then the compiler is pleased:
|
There must be something different but I wouldn't say missing. The idea of TSDuck dev is to test on each push on 3 different OS, 3 compilers, 2 levels of C++ standard (17 and 20), 2 architectures (Intel and Arm), 32000 assertions in unit tests, 2000 high-level tests. So, when everything pass everywhere, we may have some confidence that the code is correct, both on a language and functional perspective. If you add that recent versions of MSVC have changed their behaviour and now correctly resolve the overloading, that clearly means that the component which has something missing is the compiler. Whether it is called "long term support contract" is just the demonstration that LTSC is just BS*** |
I tend to agree that this is probably a compiler bug after all, because the underlying cause seems to be the condition in the enable_if construct, |
Wow, I cannot believe how many bug reports are there for SFINAE / enable_if for MSVC. Case closed then. What about the issue with the singleton? Shall I create another issue for it, to discuss it further? |
😆😆😆 I told you, MSVC is crap...
Let's continue here.
|
Yes. I even tried with a local build, once I removed the problematic-for-my-compiler std::enable_if.
No, I'm just starting to use TSDuck, and stumbled upon that linker error.
I don't get
I'll try that evetually. |
Ah, hold on. It appears that _TSDUCKDLL_USE is not defined, despite having referenced "tsduck.props". Digging further... |
My bad - I haven't had "tsduck.props" referenced properly. With that addressed, the linker error(s) are gone. Thanks for all the help & patience! |
One last thing, hopefully, because maybe this is a known issue: as soon as I bring in "tsUString.h", indirectly, via "tsIPProtocols.h", I get this linker error:
It doesn't appear to be a case of different STL versions, given that the tsduck.dll dynamically links with msvcp140.dll. |
Did you follow the instructions from here? Namely, did you reference |
Yes, of course. Strangely, that error does not occur in Release|x86 with my local build of TSDuck, but only in Release|x64, with the library provided by the public installer. |
I am confused now by the timeline of messages in this thread, as if they were presented in the wrong order. What is the status now? Any remaining error with |
There are three items that we have discussed in this umbrella issue:
|
Is this the prebuilt binary for x64 vs. your build for x86? The two were built using different compilers (including a buggy one). Or are the two from your builds? In which case it is a platform issue, not a compiler issue. The important point is that the missing symbol of a private method in In my case, this is header I do not find any reference to a private method named You could probably look into your headers and you will probably find this private method. But that would mean a major runtime incompatibility between your compiler and subsequent versions. That would not be surprising (I told you it was crap). This recently emerged as a major breakage of the GitHub CI Windows runners (still not fixed), putting thousands of developers in trouble. The problem was a defective and inconsistent runner image by GitHub folks. But the upper root cause was a major incompatibility between versions of the MSVC runtime. |
My recommendations, in this order:
Probably not realistic in your case, but quite pragmatic. |
About the major GitHub runner breakage because of the mess which was created by incompatible versions of the C++ runtime, you may read the following reports: actions/runner-images#10004 Some of them were closed but the problem remains at least on JNI code (affecting TSDuck as well). You may also find hundredths of reports affecting that many repositories, which reference the issues above. The amount of lost troubleshooting time over hundredths of organizations is above several men x years. And the problem is not over yet. All because of the MSVC runtime crap... |
Tried with both the prebuilt x64, and also with my own x64 build - same deal. My x86 build is fine.
No, see above. But to confirm, my builds match the Platform Toolset and the Windows SDK Version for both the TSDuck library & the test application.
Mine is:
It looks like this on my end:
|
The test application's obj contains these symbols for the x64 build:
Notice how they all have |
Interesting. Your version of the compiler and its header files use a static method which is no longer used in subsequent versions. OK, why not. Since this is a template class, with template parameters in the profile of the method, the compiler is supposed to generate the code for that method alongside the application (but shall include only one instance in the link). The problem is that a header file declares and defines a template method and the corresponding instance is not generated. That is a compiler bug. That's all. I am not sure if the difference you noted on parameter types matters. The The other problem with other symbols is probably different. When the linker (or the linker-support part of the compiler) generates the template instance, it apparently forget to generate the missing method. The fact that you don't have the problem with x86 is also interesting. If you look at the gigantic mess of the Windows GitHub runners with the MSVC runtime (see links in my previous post), we see the same symptom: no problem with x86. It seems that there is no longer any change on x86 (quite understandable since this is an obsolete target) and that all changes occur on x64. With a very bad change management policy, since it creates a lot of mess. I can only have the same recommendation again: get away from that version of the compiler, use the latest version, and stay up-to-date all the time. Not only for TSDuck, for your own applications as well. |
Just for reference, that method was added here: microsoft/STL@72229ff and removed here: microsoft/STL@29fc1c9. |
And there is a bug in the compiler, failing to properly generate the instance code, at least in some cases. So, removing the static template may have have only hidden the compiler bug (unless an independent fix in the compiler was also added in the meantime). |
Bug description:
I'm getting errors while building-without-installer the default configuration in Windows.
How to reproduce:
Run .\build.ps1.
Expected behavior:
No errors.
Errors and logs:
Here's the first error that I get:
Environment:
Additional information:
Visual Studio Professional 2022 (64-bit) - LTSC 17.6.
The text was updated successfully, but these errors were encountered: