capstone icon indicating copy to clipboard operation
capstone copied to clipboard

Build failure on Windows with MSVC \ capstone_static.vcxproj

Open arkup opened this issue 1 year ago • 4 comments

Hi, it seems like the build on Windows is broken. I just tried to compile \capstone-next\msvc\capstone_static\capstone_static.vcxproj with Visual Studio Community 2019 using the provided MSVC project (as I always do), but this time I'm getting a bunch of errors.

capstone-next\arch\ARM\ARMAddressingModes.h(274,32): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(277,38): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(278,12): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6047,28): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6048,37): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6153,10): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6518,1): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6519,1): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6520,1): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6522,3): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6523,4): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMDisassembler.c(6524,1): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(274,32): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(277,38): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(278,12): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(274,32): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(277,38): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMAddressingModes.h(278,12): error C4146: unary minus operator applied to unsigned type, result still unsigned
capstone-next\arch\ARM\ARMMapping.c(2080,61): error C4146: unary minus operator applied to unsigned type, result still unsigned

Work environment

Questions Answers
OS/arch/bits Windows
Architecture x64
Source of Capstone git clone next branch
Version/git commit cda40c6

arkup avatar Apr 08 '24 20:04 arkup

I'll fix those with the LLVM 18 update. Until than, please disable the warnings. It doesn't have an impact on the disassembly quality.

Rot127 avatar Apr 09 '24 07:04 Rot127

I'll fix those with the LLVM 18 update. Until than, please disable the warnings. It doesn't have an impact on the disassembly quality.

Thanks, I disable the errors (Project / Properties / C/C++ / General / SDL Checks - No) and capstone_static build succeeded. However, when I attempted to build capstone_dll immediately after, it failed with other issues

1>   Creating library capstone-next\msvc\x64\Release\capstone_dll.lib and object capstone-next\msvc\x64\Release\capstone_dll.exp

1>AArch64BaseInfo.obj : error LNK2001: unresolved external symbol binsearch_IndexTypeStrEncoding
1>AArch64BaseInfo.obj : error LNK2001: unresolved external symbol binsearch_IndexTypeEncoding
1>AArch64Disassembler.obj : error LNK2001: unresolved external symbol AArch64_testFeatureList
1>AArch64Disassembler.obj : error LNK2001: unresolved external symbol AArch64_getFeatureBits
1>AArch64InstPrinter.obj : error LNK2001: unresolved external symbol AArch64_add_cs_detail
1>AArch64InstPrinter.obj : error LNK2001: unresolved external symbol AArch64_set_detail_op_imm
1>AArch64InstPrinter.obj : error LNK2001: unresolved external symbol AArch64_set_detail_op_reg
1>AArch64InstPrinter.obj : error LNK2001: unresolved external symbol markup
1>AArch64InstPrinter.obj : error LNK2001: unresolved external symbol getUseMarkup
1>AArch64InstPrinter.obj : error LNK2001: unresolved external symbol matchAliasPatterns
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol isValidCoprocessorNumber
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol VPTBlock_getVPTPred
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ITBlock_instrLastInITBlock
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol Check
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ARM_getFeatureBits
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol isVPTOpcode
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ARM_isCDECoproc
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol VPTBlock_instrInVPTBlock
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ITBlock_advanceITState
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ARM_isVpred
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ITBlock_instrInITBlock
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ITBlock_setITState
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol VPTBlock_setVPTState
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol ITBlock_getITCC
1>ARMDisassembler.obj : error LNK2001: unresolved external symbol VPTBlock_advanceVPTState
1>ARMInstPrinter.obj : error LNK2001: unresolved external symbol ARMSysReg_lookupMClassSysRegBy12bitSYSmValue
1>ARMInstPrinter.obj : error LNK2001: unresolved external symbol ARMSysReg_lookupMClassSysRegBy8bitSYSmValue
1>ARMInstPrinter.obj : error LNK2001: unresolved external symbol ARMSysReg_lookupMClassSysRegAPSRNonDeprecated
1>ARMMapping.obj : error LNK2001: unresolved external symbol ARMSysReg_lookupMClassSysRegByEncoding
1> \capstone-next\msvc\x64\Release\capstone.dll : fatal error LNK1120: 29 unresolved externals
1>Done building project "capstone_dll.vcxproj" -- FAILED.

any idea what could be the issue here?

arkup avatar Apr 09 '24 08:04 arkup

Actually, I wasn't aware of the msvc dir. Can you use the cmake to generate it again? It should work like this (sorry, can't test it myself, because I currently don't have a Windows VM set up to check it quickly).

Rot127 avatar Apr 10 '24 08:04 Rot127

Actually, I wasn't aware of the msvc dir. Can you use the cmake to generate it again? It should work like this (sorry, can't test it myself, because I currently don't have a Windows VM set up to check it quickly).

thx I tried it, but capstone_dll is not in CMakePredefinedTargets (or I don't know how to create/add it). Only capstone_static (.lib) and tests (/tests*/cstool) will be created. Anyway, for now, I took an older Capstone-5 version, MSVC was working there.

arkup avatar Apr 10 '24 09:04 arkup

@arkup Not yet merged but I updated the build instructions for Windows here: https://github.com/capstone-engine/capstone/pull/2476/commits/4baa9331b32cb2e076f6ce8dde3b1e71e60cff75

Rot127 avatar Sep 10 '24 08:09 Rot127