Bug 45683

Summary: Add fallback implementation to compile with glibc that lacks CPU_COUNT
Product: [Mono] Runtime Reporter: stefan.michel
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: miguel, mono-bugs+mono, mono-bugs+runtime, stefan.michel
Priority: ---    
Version: 4.6.0 (C8)   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Add fallback implementation for CPU_COUNT

Description stefan.michel 2016-10-19 08:00:21 UTC
mono/utils/mono-proclib.c does not compile on CentOS release 6.6:

	../../doltcompile i686-cp-linux-gnu-gcc -m32 -mtune=i686 --sysroot=/opt/WR/WindRiverLinux-5.0-160520/sysroots/i686-cp-linux -DHAVE_CONFIG_H -I. -I../..  -I../.. -I../../mono -I../../libgc/include -I../../eglib/src -I../../eglib/src -fvisibility=hidden -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -D_FILE_OFFSET_BITS=64 -DUSE_COMPILER_TLS  -O2 -pipe -g -std=gnu99 -fno-strict-aliasing -fwrapv -DMONO_DLL_EXPORT -Wno-unused-but-set-variable -g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes -Werror-implicit-function-declaration -MT mono-proclib.lo -MD -MP -MF $depbase.Tpo -c -o mono-proclib.lo mono-proclib.c &&\
	mv -f $depbase.Tpo $depbase.Plo
mono-proclib.c: In function 'mono_cpu_count':
mono-proclib.c:746:4: error: implicit declaration of function 'CPU_COUNT' [-Werror=implicit-function-declaration]
Comment 1 stefan.michel 2016-10-19 08:39:50 UTC
Created attachment 18118 [details]
Add fallback implementation for CPU_COUNT
Comment 2 stefan.michel 2016-10-19 09:16:29 UTC
the same patch needs to be applied to mono/profiler/proflog.c: 
proflog.c: In function 'mono_cpu_count':
proflog.c:2902:4: error: implicit declaration of function 'CPU_COUNT'
Comment 3 Miguel de Icaza [MSFT] 2016-11-28 03:04:53 UTC
Pull request with additional tests, as it is not clear that an #ifdef check for CPU_COUNT is correct

https://github.com/mono/mono/pull/4032
Comment 4 Miguel de Icaza [MSFT] 2016-12-03 02:27:06 UTC
Mergerd