Samsung / netcoredbg

NetCoreDbg is a managed code debugger with MI interface for CoreCLR.
MIT License
825 stars 104 forks source link

Build Issues - src/debugger/frames.cpp - third_party/catch2/catch.hpp - CMakeLists.txt:CLR6.0(ok?) #88

Closed vindicatorr closed 2 years ago

vindicatorr commented 2 years ago

"frames.cpp" solution: https://stackoverflow.com/questions/68167789/cin-ignorestdnumeric-limitsstdstreamsizemax-n-gives-me-an-error

$ CC=clang CXX=clang++ cmake -DDOTNET_DIR=/<pathTo>/dotnet/ -DCORECLR_DIR=/<pathTo>/runtime/src/coreclr/ ..
$ make
//Success, after correcting "frames.cpp"
$ CC=clang CXX=clang++ cmake -DDOTNET_DIR=/<pathTo>/dotnet/ -DCORECLR_DIR=/<pathTo>/runtime/src/coreclr/ -DCMAKE_INSTALL_PREFIX="%cd%\..\bin" -DBUILD_TESTING=ON ..
$ make
//Fail
/<pathTo>/third_party/catch2/catch.hpp:8525:{34,58}: error: constexpr variable 'sigStackSize' must be initialized by a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
/usr/include/bits/sigstksz.h:32:22: note: expanded from macro 'MINSIGSTKSZ'
# define MINSIGSTKSZ SIGSTKSZ
                     ^
/usr/include/bits/sigstksz.h:28:19: note: expanded from macro 'SIGSTKSZ'
# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
                  ^
/usr/include/unistd.h:640:17: note: declared here
extern long int sysconf (int __name) __THROW;
                ^
In file included from /<pathTo>/src/unittests/Catch2.cpp:6:
/<pathTo>/third_party/catch2/catch.hpp:8584:33: error: variable length array declaration not allowed at file scope
    char FatalConditionHandler::altStackMem[sigStackSize] = {};

"catch.hpp" solution?: https://github.com/catchorg/Catch2/issues/2178

CMakeLists.txt

Note, since 5.0 src are broken and will not build netcoredbg without patch, stay with 3.1 for now.

Build succeeded (except for "tests") using runtime(/coreclr) 6.0 instead of 3.1. I don't know if breakage will occur further down the line since I didn't get to "tests" yet, but that comment did specify the "build" aspect, and for me that worked with 6.0.

alpencolt commented 2 years ago

@vindicatorr what's clang version do you use?

vindicatorr commented 2 years ago

13.0.1

alpencolt commented 2 years ago

There is another issue with new gcc https://github.com/Samsung/netcoredbg/pull/86 We're going to check it soon

vindicatorr commented 2 years ago

Yeah, I know about that one, but it only coincided with the first issue I mentioned (frames.cpp), and not with the catch.hpp issue(s).

viewizard commented 2 years ago

Tested on Ubuntu 22.04 with Clang 13.0.1 and Clang 14.0.0, can't reproduce issue with catch2. @vindicatorr could you please share more info about your build environment?

vindicatorr commented 2 years ago

Arch Linux

Building CXX object src/unittests/CMakeFiles/testsuite.dir/Catch2.cpp.o
cd <pathTo>/netcoredbg/build/src/unittests && /usr/bin/clang++ -DAMD64 -DBIT64=1 -DDBG_TARGET_64BIT=1 -DDBG_TARGET_AMD64=1 -DDBG_TARGET_AMD64_UNIX -DDBG_TARGET_WIN64=1 -DDEBUGGING_SUPPORTED -DDISABLE_CONTRACTS -DDO_NOT_USE_WMAIN=1 -DFEATURE_APPDOMAIN_RESOURCE_MONITORING -DFEATURE_ARRAYSTUB_AS_IL -DFEATURE_CODE_VERSIONING -DFEATURE_COLLECTIBLE_TYPES -DFEATURE_CORECLR -DFEATURE_COREFX_GLOBALIZATION -DFEATURE_CORESYSTEM -DFEATURE_CORRUPTING_EXCEPTIONS -DFEATURE_DBGIPC_TRANSPORT_DI -DFEATURE_DBGIPC_TRANSPORT_VM -DFEATURE_DEFAULT_INTERFACES=1 -DFEATURE_EVENTSOURCE_XPLAT=1 -DFEATURE_EVENT_TRACE=1 -DFEATURE_HIJACK -DFEATURE_ICASTABLE -DFEATURE_ISYM_READER -DFEATURE_JUMPSTAMP -DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL -DFEATURE_LOADER_OPTIMIZATION -DFEATURE_MANAGED_ETW -DFEATURE_MANAGED_ETW_CHANNELS -DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES -DFEATURE_MULTICASTSTUB_AS_IL -DFEATURE_MULTICOREJIT -DFEATURE_MULTIREG_RETURN -DFEATURE_PAL -DFEATURE_PAL_ANSI -DFEATURE_PAL_SXS -DFEATURE_PERFMAP -DFEATURE_PERFTRACING=1 -DFEATURE_PREJIT -DFEATURE_READYTORUN -DFEATURE_REJIT -DFEATURE_STANDALONE_SN -DFEATURE_STRONGNAME_DELAY_SIGNING_ALLOWED -DFEATURE_STRONGNAME_MIGRATION -DFEATURE_STUBS_AS_IL -DFEATURE_SVR_GC -DFEATURE_SYMDIFF -DFEATURE_TIERED_COMPILATION -DFEATURE_USE_ASM_GC_WRITE_BARRIERS -DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP -DFEATURE_WINDOWSPHONE -DFEATURE_WINMD_RESILIENT -DHOST_64BIT=1 -DLINUX64 -DLOG_TAG=\"NETCOREDBG\" -DPAL_STDCPP_COMPAT -DPLATFORM_UNIX=1 -DPROFILING_SUPPORTED -DUNICODE -DUNIX_AMD64_ABI -DUNIX_AMD64_ABI_ITF -D_AMD64_ -D_BLD_CLR -D_SECURE_SCL=0 -D_TARGET_64BIT_=1 -D_TARGET_AMD64_=1 -D_UNICODE -D_WIN64 -I<pathTo>/runtime/src/coreclr/pal/prebuilt/inc -I<pathTo>/netcoredbg/src/coreclr -I<pathTo>/runtime/src/coreclr -I<pathTo>/runtime/src/coreclr/debug/shim -I<pathTo>/runtime/src/coreclr/dlls/dbgshim -I<pathTo>/runtime/src/coreclr/coreclr/hosts/inc -I<pathTo>/runtime/src/coreclr/hosts/inc -I<pathTo>/netcoredbg/third_party -I<pathTo>/netcoredbg/third_party/linenoise-ng/include -I<pathTo>/netcoredbg/src -I<pathTo>/netcoredbg/build/generated -I<pathTo>/netcoredbg/src/windows -I<pathTo>/netcoredbg/src/unix -std=c++11 -O3 -DNDEBUG -fno-omit-frame-pointer -fms-extensions -fwrapv -fstack-protector-strong -ferror-limit=4096 -Wno-microsoft -Wno-constant-logical-operand -Wno-pragma-pack -Wno-unknown-warning-option -Wno-incompatible-ms-struct -fsigned-char -Wall -Wextra -Walign-cast -Wstrict-aliasing -Wno-unused-parameter -Wnarrowing -Wno-extra-tokens -D_MIDL_USE_GUIDDEF_ -MD -MT src/unittests/CMakeFiles/testsuite.dir/Catch2.cpp.o -MF CMakeFiles/testsuite.dir/Catch2.cpp.o.d -o CMakeFiles/testsuite.dir/Catch2.cpp.o -c <pathTo>/netcoredbg/src/unittests/Catch2.cpp
In file included from <pathTo>/netcoredbg/src/unittests/Catch2.cpp:6:
<pathTo>/netcoredbg/third_party/catch2/catch.hpp:8525:34: error: constexpr variable 'sigStackSize' must be initialized by a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
viewizard commented 2 years ago

@vindicatorr, thanks! We will update Catch2 to v2.13.9 (no reason fix only this issue), will be in public repo at next sync

viewizard commented 2 years ago

Fixed in upstream.