VS2015 compiling effort to stop all the breakage.
#1
I started out to try the build process on the new tool chain. And also the same effort to reduce all the warnings by making code more explicit. (like casts or type mismatches)

Now I have solved most issues, but one issue remains.

Severity Code Description Project File Line Suppression State
Error C2664 'void CHTTPPythonWsgiInvoker::addWsgiEnvironment(HTTPPythonRequest *,void **(__cdecl *)(void))': cannot convert argument 2 from 'PyObject *' to 'void **(__cdecl *)(void)' Kodi ..\xbmc\network\httprequesthandler\python\HTTPPythonWsgiInvoker.cpp 208

It seems about putting a PyObject* into a void **(*_p_environ)() [which seems to be a function pointer type?] and that does not work, becaue a PyObject is basically a pointer to a _object struct. I might be missing something here but isn't environ (and _environ by extension due to CRT_V12_LEGACY_FUNCTIONALITY) supposed to be the narrow environment table? It feels weird that that should come out of a Python object.

I hope to be able to get this last error "fixed", so that when the time comes to upgrade to v140 toolkit. It is near painless.

While fixing many int and long casting warnings, I noticed the mixing of unsigned short, short, int, long, int64_t, uint64_t, size_t and many casts between them. For the 64-bit build this might give some issues (and hard to test for errors and edge cases)

Still many warnings about the "safeness" of the printf family of functions and their printf_s counterparts, but that is just Windows/MS fuckery IIRC.


Branch is here: https://github.com/EraYaN/xbmc/tree/small-fixes-vs2015 (I did not push the upgraded project files)

EDIT: words and some [notes]
Reply
#2
The signature of CHTTPPythonWsgiInvoker::addWsgiEnvironment is
Code:
void addWsgiEnvironment(HTTPPythonRequest* request, void* environ)
so I'm not sure where your void **(__cdecl *)(void)) is coming from?

The only reason why addWsgiEnvironment takes a void pointer is because I didn't want to have to include Python.h in HTTPPythonWsgiInvoker.h to get access to PyObject. Another approach would be to not define addWsgiEnvironment as a static class method but just as a static method in HTTPPythonWsgiInvoker.cpp in which case the casting wouldn't be necessary.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
VS2015 recognizes void* environ as void **(__cdecl *)(void).

And if you "follow" the environ definition trail, you end up with

environ -> _environ -> (*__p__environ())

and __p__environ() is defined as

_DCRTIMP char*** __cdecl __p__environ (void); in stdlib.h

I'm not sure why it does not want the cast to happen a pointer should be completely valid.

It could be that something messed some configuration up while retargeting projects

Scratch everything above this. Wink

Ooh environ is a reserved name, I changed it to environ2 and now it's working, I was already wondering why it was purple (and not argument-name white).

Well that part builds now.

Next issues that popped up were some more back_inserter issues (Fixed on Windows with #include <Iterator>)

Next hurdle is in cores/DllLoader/exports/emu_msvcrt.cpp

_ptr is not a member of _iobuf L:1600
_filbuf identifier not found L: 2249
_flsbuf identifier not found L: 2280

Seems like stdio.h had changes? Or at least google tells me they should be related to stdio.

EDIT: fixed path

EDIT: stdio does define it but the definition in corecrt_wstdio.h seems to "win".


EDIT: The include tree.
Code:
emu_msvcrt.cpp
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\math.h
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\io.h
2>  Note: including file:  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\corecrt_io.h
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\direct.h
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\process.h
2>  Note: including file:  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\corecrt_startup.h
2>  Note: including file:   C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\math.h
2>  Note: including file:   C:\program files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime_startup.h
2>  Note: including file:    C:\program files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime.h
2>  Note: including file:    C:\program files (x86)\Microsoft Visual Studio 14.0\VC\include\stdbool.h
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\sys/timeb.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\system.h
2>  Note: including file:  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um\mmsystem.h
2>  Note: including file:  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um\DInput.h
2>  Note: including file:  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um\DSound.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\win32\PlatformInclude.h
2>  Note: including file:   f:\users\erwin\documents\github\xbmc\xbmc\win32\PlatformDefs.h
2>  Note: including file:    C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\inttypes.h
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\fcntl.h
2>  Note: including file: C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\signal.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\Util.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\MediaSource.h
2>  Note: including file:   f:\users\erwin\documents\github\xbmc\xbmc\GUIPassword.h
2>  Note: including file:    f:\users\erwin\documents\github\xbmc\xbmc\settings/lib/ISettingCallback.h
2>  Note: including file:    f:\users\erwin\documents\github\xbmc\xbmc\settings/lib/Setting.h
2>  Note: including file:     C:\program files (x86)\Microsoft Visual Studio 14.0\VC\include\set
2>  Note: including file:     f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\ISetting.h
2>  Note: including file:      f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\SettingRequirement.h
2>  Note: including file:       f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\SettingConditions.h
2>  Note: including file:        f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\SettingDefinitions.h
2>  Note: including file:        f:\users\erwin\documents\github\xbmc\xbmc\utils/BooleanLogic.h
2>  Note: including file:         f:\users\erwin\documents\github\xbmc\xbmc\utils/IXmlDeserializable.h
2>  Note: including file:     f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\ISettingControl.h
2>  Note: including file:     f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\SettingDependency.h
2>  Note: including file:      C:\program files (x86)\Microsoft Visual Studio 14.0\VC\include\list
2>  Note: including file:     f:\users\erwin\documents\github\xbmc\xbmc\settings\lib\SettingUpdate.h
2>  Note: including file:     f:\users\erwin\documents\github\xbmc\xbmc\threads/SharedSection.h
2>  Note: including file:      f:\users\erwin\documents\github\xbmc\xbmc\threads/Condition.h
2>  Note: including file:       f:\users\erwin\documents\github\xbmc\xbmc\threads/platform/Condition.h
2>  Note: including file:        f:\users\erwin\documents\github\xbmc\xbmc\threads/platform/win/Condition.h
2>  Note: including file:         f:\users\erwin\documents\github\xbmc\xbmc\threads/SingleLock.h
2>  Note: including file:          f:\users\erwin\documents\github\xbmc\xbmc\threads/CriticalSection.h
2>  Note: including file:           f:\users\erwin\documents\github\xbmc\xbmc\threads/platform/CriticalSection.h
2>  Note: including file:            f:\users\erwin\documents\github\xbmc\xbmc\threads/platform/win/CriticalSection.h
2>  Note: including file:             f:\users\erwin\documents\github\xbmc\xbmc\threads/Lockables.h
2>  Note: including file:              f:\users\erwin\documents\github\xbmc\xbmc\threads/Helpers.h
2>  Note: including file:       f:\users\erwin\documents\github\xbmc\xbmc\threads/SystemClock.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\filesystem/SpecialProtocol.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\URL.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\utils/UrlOptions.h
2>  Note: including file:   f:\users\erwin\documents\github\xbmc\xbmc\utils/Variant.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\filesystem/File.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/auto_buffer.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\filesystem\IFileTypes.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\settings/Settings.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\settings/SettingControl.h
2>  Note: including file:   F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\settings/lib/ISettingControlCreator.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\settings/SettingCreator.h
2>  Note: including file:   F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\settings/lib/ISettingCreator.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\FileItem.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\guilib/GUIListItem.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\utils/IArchivable.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\utils/ISerializable.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\utils/ISortable.h
2>  Note: including file:   f:\users\erwin\documents\github\xbmc\xbmc\utils\SortUtils.h
2>  Note: including file:    f:\users\erwin\documents\github\xbmc\xbmc\utils\DatabaseUtils.h
2>  Note: including file:     f:\users\erwin\documents\github\xbmc\xbmc\media/MediaType.h
2>  Note: including file:    f:\users\erwin\documents\github\xbmc\xbmc\SortFileItem.h
2>  Note: including file:    f:\users\erwin\documents\github\xbmc\xbmc\utils\LabelFormatter.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\XBDateTime.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\filesystem/Directory.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\filesystem\IDirectory.h
2>  Note: including file: f:\users\erwin\documents\github\xbmc\xbmc\cores\dllloader\exports\emu_msvcrt.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\win32/dirent.h
2>  Note: including file: f:\users\erwin\documents\github\xbmc\xbmc\cores\dllloader\exports\emu_dummy.h
2>  Note: including file: f:\users\erwin\documents\github\xbmc\xbmc\cores\dllloader\exports\emu_kernel32.h
2>  Note: including file: f:\users\erwin\documents\github\xbmc\xbmc\cores\dllloader\exports\util/EmuFileWrapper.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/log.h
2>  Note: including file:  f:\users\erwin\documents\github\xbmc\xbmc\utils\win32/Win32InterfaceForCLog.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\commons/ilog.h
2>  Note: including file:   F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/params_check_macros.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/GlobalsHandling.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/CharsetConverter.h
2>  Note: including file:  F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/uXstrings.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/URIUtils.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/Environment.h
2>  Note: including file: F:\Users\Erwin\Documents\GitHub\xbmc\xbmc\utils/StringUtils.h
2>..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.cpp(1600): error C2039: '_ptr': is not a member of '_iobuf'
2>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt\corecrt_wstdio.h(26): note: see declaration of '_iobuf'
2>..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.cpp(2249): error C3861: '_filbuf': identifier not found
2>..\..\xbmc\cores\DllLoader\exports\emu_msvcrt.cpp(2280): error C3861: '_flsbuf': identifier not found

It seems to refuse to include stdio.h because it is defined in there.

Perl has the same bug: https://rt.perl.org/Public/Bug/Display.html?id=125714 I think using FILE struct internals is no longer okay in the newer SDK

_iobuf is now defined as
Code:
typedef struct _iobuf
{
    void* _Placeholder;
} FILE;

Good perl5-porters mailing list thread: http://www.nntp.perl.org/group/perl.perl...27727.html

And there is the problem: https://msdn.microsoft.com/en-us/library/bb531344.aspx (search for FILE Encapsulation)

So basically this is just a lesson of let's not use undocumented members/functionality.

Paxxi already started this a while ago: https://github.com/Paxxi/xbmc/commit/647...bd76f6aa9d

Both that code and mine won't compile due to dependencies not being ready for VS2015 (and some won't recompile, like mysqlclient.lib)
Reply
#4
I did some work here with this http://forum.kodi.tv/showthread.php?tid=237246

I did not check anything in. As I considered it mostly a hack.

I just did a cast and to get it to compile for now. It is one crazy compiler error. I did not want to mess around with it too much and just did a cast. I will give what you said a shot and see if that is a better fix.

I also spent quite a decent amount of time recompiling a few of the libs. Most were fairly straight forward. MySQL Connector on the other hand was a pain. I ended up with a mashed up version from the main MySQL project and connector. The mysqlclient.lib bit you talked about. As they have actually fixed it in the upstream main project already and connector just has not caught up.

I ran headlong straight into the same issue you did with FILE it seems to be contained in that one file though. Which is where I stopped. I can see what it is trying to do. Basically the first '50' or so file handles are reserved for the virtual filespace I think. This probably should be done with a hashtable lookup and break the two apart into separate spaces instead of trying to treat them as the same one. Unfortunatly this may cause the interface to change a bit. It probably means std::map and a good way of deciding if a FILE is real or not. But it is a fairly major change for that one file.

In the end I got it to compile. But could not run it because of that emu layer which the system relies on. I just commented it out for now.
Reply
#5
A buildable and "usable" version can be found here
https://github.com/Paxxi/xbmc/tree/vs2015

The libraries that needed updates contain a .diff in the package for anyone interested in the changes. Code is still a proof of concept so it's quite ugly and hacky in places in order to get it running and testable.
Only steps that should be needed is to checkout the branch and run downloadbuilddeps.bat before building with vs2015.

edit: sorry if I'm stepping on someone's toes, didn't check the forum before doing the work so wasn't aware that people had some fixes ready
The janitor, cleaner of cruft, defender of style. Also known as the unfunny guy that doesn't understand signatures.
Reply

Logout Mark Read Team Forum Stats Members Help
VS2015 compiling effort to stop all the breakage.0