Autogenerated code and makefile compile error - No supported target architecture

66 Views Asked by At

I'm programming on MS Windows, which is new to me. I've got some C code, makefile, and compile .bat script all autogenerated by Matlab's Simulink package on a Windows Server x64 architecture machine. Upon running the autogenerated .bat script, a 'cl' compile command is run that initially couldn't find some .h files (like stlib.h). After adding some appropriate-looking include directories in the makefile (see below), I hit the following error, which I tried to fix by adding the -DTARGET=x86_64 you'll see below.

cl  -c -nologo -GS -W4 -DWIN32 -D_MT -MT -D_CRT_SECURE_NO_WARNINGS  /Od /Oy-  -Zi -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMAT_FILE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTARGET=x86_64 -DTID01EQ=0 -DMODEL=TestSim2 -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DRT -DUSE_RTMODEL @TestSim2_comp.rsp -Fo"DAHostLib_Network.obj" "G:\toolbox\shared\spc\src_ml\extern\src\DAHostLib_Network.c"
DAHostLib_Network.c
D:\Program Files\MSYS2\mingw64\include\excpt.h(87): warning C4115: '_EXCEPTION_RECORD': named type definition in parentheses
D:\Program Files\MSYS2\mingw64\include\excpt.h(87): warning C4115: '_CONTEXT': named type definition in parentheses
D:\Program Files\MSYS2\mingw64\include\winnt.h(137): fatal error C1189: #error:  No supported target architecture.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.EXE"' : return code '0x2'

However the 'No supported target arch' still occurs. Any ideas? The makefile lines I modified in my makefile (which is named TestSim.mk) are:

###########################################################################
## INCLUDE PATHS
###########################################################################

# jr added this include, it was previously blank
INCLUDES_BUILDINFO = 'C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.23.Sdk.win-x64\6.0.15\tools\emscripten\system\lib\libc\musl\include;D:\Program Files\MSYS2\mingw64\include'

INCLUDES = $(INCLUDES_BUILDINFO)

###########################################################################
## DEFINES
###########################################################################

DEFINES_BUILD_ARGS = -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DMAT_FILE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0

# jr added this target - maybe also use  -DWIN32_LEAN_AND_MEAN
DEFINES_CUSTOM = -DTARGET=x86_64

This doesn't seem to be related to windows.h (which is a common culprit when searching for this error) as that file isn't called anywhere in this code, afaict.

Matlab also generated a setup_msvc.bat file, maybe I need to be doing all this from MSVC and not the command line?

0

There are 0 best solutions below