-
Notifications
You must be signed in to change notification settings - Fork 7
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
UE4 Editor Linux with Cross-Compilation #15
Comments
Hmm that is quite the interesting issue. The C99 standard says that __STDC_FORMAT_MACROS must be defined before the header is included in order for the macros to be defined but the C++11 standard removed that restriction and always defines them. It appears that the compiler is not quite C++11 compliant... I'm not sure if it's possible for you to try and upgrade the compiler, travis does compile ACL and sjson-cpp with clang 5 but with the last stable release, not 5.0.0. Can you try to add this to the plugin C# file instead of your fix: |
If I add PublicDefinitions.Add("__STDC_FORMAT_MACROS"); and return writer.h to the original state all is working correctly. I am a little bit lost on this one, because that make no sense with what I have read inside the STL include in centos files. So I have simply add this one. ACLPlugin.Build.cs
I will debug a little bit more for seeing what is going on when the compilation is done. |
Oky after debugging directly the LinuxToolChain.cs and trying to understand what is going on.
I see that the version cinttypes inside the v11_clang-5.0.0-centos7 is never call. It use only the old C version in the end and look like the one use by unreal (LibCxx) is not correctly setup for be STL standard correct. cinttypes you can see that is no __STDC_FORMAT_MACROS defined. Maybe in normal time it is inside the __config file, I don't know. So yeah I simply do this fix in the end.
I change PublicDefinitions for PrivateDefinitions no need to spread this define on everywhere __STDC_FORMAT_MACROS, that can maybe in really rare case create conflict with other module. The only place that need to be define it is inside ACLStatsDumpCommandlet.cpp Thank for the help! Maybe you can add this inside your official UE4 ACL Plugin. |
Nice find! Thanks a lot for looking into this and reporting the issue. I will indeed add that same code along with a comment that describes why and points to this github issue) in the plugin to make sure others don't run into the problem (or you can submit it in a PR). I'll make sure to make a minor release for this next week since it's fairly important. |
@all-contributors add @Meradrin as bug reports |
I've put up a pull request to add @Meradrin! 🎉 |
I compile the UE4 Editor Linux v4.20 in Cross-Compilation on Windows with v11_clang-5.0.0-centos7.zip from https://docs.unrealengine.com/en-us/Platforms/Linux/GettingStarted.
Sadly this STL lib look to have a problem with all the definition for 64bit type in printf, like PRId64, PRIu64, PRIX64, etc... So SJSON create a compilation error.
If we look inside cinttypes for find where the inttypes.h is done. We can see the part that is supposed to do the include there...
_GLIBCXX_HAVE_INTTYPES_H is not defined. The inttypes.h header file exist in C. So in normal time this define defintion of _GLIBCXX_HAVE_INTTYPES_H will be done inside "C++config.h" and that will be add in include before everything by the compiler himself. For whatever reason Unreal don't include this, so result never define _GLIBCXX_HAVE_INTTYPES_H. So the result is cinttypes never include inttypes.h.
For doing a fix what I have done is directly define __STDC_FORMAT_MACROS and call the C version of the header <inttypes.h> and everything work fine.
Like this include/sjson/writer.h
Personally I don't like this solution, but that fix the compilation.
I write there for having your opinion about this problem.
Note: I simply add the Issues there, but maybe this issue will be need to be place inside the UE4 ACL plugin or ACL directly. But the compilation error is inside sjson.
The text was updated successfully, but these errors were encountered: