libretro / beetle-ngp-libretro

Standalone port of Mednafen NGP to the libretro API, itself a fork of Neopop.
GNU General Public License v2.0
11 stars 43 forks source link

vs2003 build problems - compile notes #87

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello everyone. I think after the 1.23.0 update, this core no longer builds. Hoping that we can figure this out together.

One problem so far is libretro.cpp is missing vsnprintf.

We can add this at the top of mednafen.h

#ifdef _MSC_VER
   #include "compat\msvc.h"
#endif

Which means we need this file also https://raw.githubusercontent.com/libretro/libretro-common/master/compat/compat_snprintf.c

$(LIBRETRO_COMM_DIR)/compat/compat_snprintf.c \

I haven't had time to see how far it compiles now, or if this affects other platform targets (???). But I wanted to leave this here for now in case someone else picks it up. Maybe I'l get another chance to look at it again later today or later this week.

Thanks for any help getting this working with latest upstream!

ghost commented 4 years ago

Final piece needed is this for: https://github.com/libretro/beetle-ngp-libretro/blob/master/libretro-common/include/compat/msvc.h

#define _strtoui64(x, y, z) (_atoi64(x))

==>

#define _strtoui64(x, y, z) _atoi64(x)

The () brackets is messing up VS2003 templates. Played for awhile and no problems noticed! Will toss a PR this way when I get a chance.

ghost commented 4 years ago

rpi was also broken before vs2003 fix I tested. Needs static INLINE everywhere in state.h.

inactive123 commented 4 years ago

I'm going to be redoing this entire core, starting over again before the commit that updated it, and then carefully applying backports. Going to do the same for vb and wswan too.

inactive123 commented 4 years ago

For now, I backed up the repos' current state to libretro-fork organization. https://github.com/libretro-fork

ghost commented 4 years ago

I've also got a copy here, with 2003 and rpi build fixes. https://github.com/trioan/beetle-ngp-libretro/commits/vs2003

Tested building lots of other platforms and mostly okay. Did not test 2005 or 2010 yet. OSX is giving me some problem with clang11 clang: error: unsupported option '-static-libgcc'

edit: Okay. Backed up those 2 repos too. :octocat:

ghost commented 4 years ago

Just for notation, 2005 hit me with this one:

c:\vc8/Include\stdio.h(333) : error C2375: 'c99_vsnprintf_retro__' : redefinition; different linkage
        ./libretro-common/include\compat\msvc.h(49) : see declaration of 'c99_vsnprintf_retro__'

Full block is this:

/* Pre-MSVC 2010 compilers don't implement vsnprintf in a cross-platform manner? Not sure about this one. */
#if _MSC_VER < 1600
   #include <stdarg.h>
   #include <stdlib.h>
   #ifndef vsnprintf
      #define vsnprintf c99_vsnprintf_retro__
   #endif
   int c99_vsnprintf_retro__(char *outBuf, size_t size, const char *format, va_list ap);
#endif

I don't get that one at all. What a mess. I'm afraid to try 2010 now. 😆

ghost commented 4 years ago

Got VS2005 working. We need to add this here to avoid dependency problems:

#include <stdio.h> https://github.com/libretro/libretro-common/blob/master/include/compat/msvc.h#L34 https://github.com/libretro/libretro-common/blob/master/include/compat/msvc.h#L44