SDL-Hercules-390 / hyperion

The SDL Hercules 4.x Hyperion version of the System/370, ESA/390, and z/Architecture Emulator
Other
246 stars 92 forks source link

MSVC VS2022 clang-cl Build Problem with current development branch #679

Closed Peter-J-Jansen closed 2 months ago

Peter-J-Jansen commented 2 months ago

The MSVC clang-cl under Windows 11 23H2 (all current up-to-date) build stops with this error:

In file included from assist.c:29:
./inline.h(307,35): error: call to undeclared function '_mm_shuffle_epi8'; ISO C99 and later do not support implicit
      function declarations [-Wimplicit-function-declaration]
  307 |     _mm_storeu_si128( &swapped.v, _mm_shuffle_epi8( _mm_loadu_si128( &work ), swapmask ));
      |                                   ^
./inline.h(307,35): error: passing 'int' to parameter of incompatible type '__m128i' (vector of 2 'long long' values)
  307 |     _mm_storeu_si128( &swapped.v, _mm_shuffle_epi8( _mm_loadu_si128( &work ), swapmask ));
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\lib\clang\17\include\emmintrin.h(3819,68): note:
      passing argument to parameter '__b' here
 3819 |                                                            __m128i __b) {
      |                                                                    ^
2 errors generated.
NMAKE : fatal error U1077: 'clang-cl /O2 /GL /D NDEBUG /Zi  -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -DWIN32 -D_WIN32 -W3 -D_WINNT -D_WIN32_WINNT=0x0600 -DNTDDI_VERSION=0x06000000 -D_WIN32_IE=0x0700 -DWINVER=0x0600 -DHAVE_SOCKLEN_T -D_AMD64_=1 -DWIN64 -D_WIN64 /D HAVE_ZLIB /D HAVE_ZLIB_H /I"\Qsync\Packages\zlib-1.2.5\x64/include" /D HAVE_BZLIB_H /I"\Qsync\Packages\bzip2-1.0.6\x64" /D HAVE_PCRE /I"\Qsync\Packages\pcre-8.20\inc" /D PCRE_INCNAME=\"pcreposix.h\"  /D HAVE_OBJECT_REXX /I"C:\Program Files\ooRexx\api" /D HAVE_REXX_H /D HAVE_OOREXXAPI_H  /D ENABLE_IPV6 /we4702 /WX  /D _MSVC_ /D MAX_CPU_ENGS=16  /D CUSTOM_BUILD_STRING=\""TXF_BACKOUT_METHOD (Peter Jansen)"\" /D HOST_ARCH=AMD64 -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE /wd4172 /wd4312 /wd4996 /w14296 /we4101 /we4102 /MP /favor:INTEL64  /D FD_SETSIZE=1024  -D VERSION=\""4.8.0.11301-SDL-DEV-g16fda7da"\" -D VERS_MAJ=4 -D VERS_INT=8 -D VERS_MIN=0 -D VERS_BLD=11301 /I. /Fp"msvc.AMD64.obj\\build_pch.pch" /Yu"hstdinc.h" -D_MT -D_DLL -MD /Fo"msvc.AMD64.obj\\" /Fd"msvc.AMD64.obj\\" archlvl.c assist.c bldcfg.c script.c cgibin.c channel.c chsc.c clock.c cmdtab.c cmpsc_2012.c cmpscdbg.c cmpscdct.c cmpscget.c cmpscmem.c cmpscput.c config.c control.c cpu.c crypto.c dat.c decimal.c dfp.c diagmssf.c diagnose.c dyn76.c ecpsvm.c esame.c external.c facility.c fillfnam.c float.c general1.c general2.c general3.c hbyteswp.c hconsole.c hdiagf18.c history.c hsccmd.c hscemode.c hscpufun.c hscloc.c hao.c hscmisc.c httpserv.c ieee.c impl.c inline.c io.c ipl.c loadmem.c loadparm.c losc.c machchk.c machdep.c nnpa.c opcode.c panel.c pfpo.c plo.c qdio.c mpc.c hRexx.c hRexx_o.c hRexx_r.c service.c scedasd.c scescsi.c sie.c skey.c sr.c stack.c tcpip.c timer.c trace.c transact.c vector.c vm.c vmd250.c vstore.c x75.c xstore.c zvector.c zvector2.c w32ctca.c ' : return code '0x1'
Stop.

The GCC build succeeds though.

Cheers,

Peter

Peter-J-Jansen commented 2 months ago

Sorry for replying to my own issue here, but I was able to solve the MSVC clang-cl problem, although I consider this pure luck, as I am certainly no MSVC clang-cl compiler expert. I discovered that MSVC clang-cl just needs a few target options, which I specified in the CL options, which now reads :

SET "CL=-mcx16 -msse4.1 -mpclmul -maes /w"

The issue as I reported it just required the first additional one, -msse4.1 , but then also the second one, -mpclmul , was needed later on. Amazingly, just adding also that one did not solve the problem. By pure luck I stumbled upon a blog where also -maes was mentioned following -mpclmul and only after that 3rd additional option did the MSVC clang-cl compile work.

Following the above CL setting, the nmakecommand worked without further errors.

I'll close the issue again.

wrljet commented 2 months ago

Peter,

The GCC build succeeds though.

You're actually using gcc on Windows under a VS2022 build framework?

Bill

Peter-J-Jansen commented 2 months ago

Hi Bill,

Sorry, I should not have said GCC, under VS2022 (or VS2019) it's just the regular MSVC C compiler I presume. The nmake output shows command name "cl", whereas with CLANG that's "clang-cl". Most of the time I work under Ubuntu Linux, and there the choice is CLANG vs. GCC, that's where my mistake came from. Does that make sense ?

But by now I can confirm the MSVC CLANG build works, the result is IPL-able just fine.

Cheers,

Peter