Samsung / netcoredbg

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

Make fails with error: conflicting types for 'wait' #143

Closed Invercargill closed 8 months ago

Invercargill commented 8 months ago

linux Description: CentOS Linux release 7.6.1810

The error is:

[ 56%] Building CXX object src/CMakeFiles/netcoredbg.dir/debugger/waitpid.cpp.o /home/cypz/rpms/netcoredbg/netcoredbg-master/src/debugger/waitpid.cpp:187:18: error: conflicting types for 'wait' 187 | extern "C" pid_t wait(int *status) | ^ /usr/include/sys/wait.h:114:16: note: previous declaration is here 114 | extern pid_t wait (__WAIT_STATUS stat_loc); | ^ 1 error generated. make[2]: [src/CMakeFiles/netcoredbg.dir/debugger/waitpid.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [src/CMakeFiles/netcoredbg.dir/all] Error 2 make: [all] Error 2

Please help~

gbalykov commented 8 months ago

Please share your cmake command

Invercargill commented 8 months ago

CC=clang CXX=clang++ cmake -DDOTNET_DIR=/usr/share/dotnet -DCORECLR_DIR=/home/cypz/rpms/runtime/src/coreclr -DCMAKE_INSTALL_PREFIX=$PWD/../bin ..

Is it right? Thanks for answer~

viewizard commented 8 months ago

This looks like you have eglibc with wait(void *status) in headers instead of wait(int *status). Not sure we will support eglibc (I thought this one is dead about 10 years already).

Invercargill commented 8 months ago

This file(/usr/include/sys/wait.h) have note: "POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h>",MayBe part of POSIX Threads.

And How can I solve this problem,I want to build and install. If possible, please give me some suggestions.

Invercargill commented 8 months ago

Just rename this function( pid_t wait(int *status)), and the problem will be solved.

viewizard commented 8 months ago

This file(/usr/include/sys/wait.h) have note: "POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h>",MayBe part of POSIX Threads.

extern __pid_t wait (__WAIT_STATUS __stat_loc) is part of eglibc sources - http://www.staroceans.org/myprojects/eglibc/posix/sys/wait.h

Just rename this function( pid_t wait(int *status)), and the problem will be solved.

Debugger have proper declaration according to man wait - https://linux.die.net/man/2/wait Why we need rename this function in order to solve your build with eglibc headers and broke all others?

gbalykov commented 8 months ago

Just rename this function( pid_t wait(int *status)), and the problem will be solved.

For your local build you can do that, but such change can't be merged, because it will break glibc builds. You can also check for some defines, that will allow to distinguish eglibc and glibc, then build of both will be supported. But I do not think it is worth supporting eglibc in master, because eglibc itself is discontinued since 2014.

Invercargill commented 8 months ago

Yes, you are right, I understand now.