hholtmann/smcFanControl

Cannot build smc.c on Monterey

Opened this issue · 0 comments

I have this error when I tried to build smc.c

Michaels-iMac:smc michael$ make
gcc -c smc.c
smc.c:37:1: warning: 'OSSpinLock' is deprecated: first deprecated in macOS 10.12
- Use os_unfair_lock() from <os/lock.h> instead
[-Wdeprecated-declarations]
OSSpinLock g_keyInfoSpinLock = 0;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSSpinLockDeprecated.h:79:17: note:
'OSSpinLock' has been explicitly marked deprecated here
typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
^
smc.c:335:5: warning: 'OSSpinLockLock' is deprecated: first deprecated in macOS
10.12 - Use os_unfair_lock_lock() from <os/lock.h> instead
[-Wdeprecated-declarations]
OSSpinLockLock(&g_keyInfoSpinLock);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSSpinLockDeprecated.h:99:9: note:
'OSSpinLockLock' has been explicitly marked deprecated here
void OSSpinLockLock( volatile OSSpinLock *__lock );
^
smc.c:368:5: warning: 'OSSpinLockUnlock' is deprecated: first deprecated in
macOS 10.12 - Use os_unfair_lock_unlock() from <os/lock.h> instead
[-Wdeprecated-declarations]
OSSpinLockUnlock(&g_keyInfoSpinLock);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libkern/OSSpinLockDeprecated.h:105:9: note:
'OSSpinLockUnlock' has been explicitly marked deprecated here
void OSSpinLockUnlock( volatile OSSpinLock *__lock );
^
smc.c:384:23: warning: format string is not a string literal
(potentially insecure) [-Wformat-security]
sprintf(val->key, key);
^~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note:
expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), VA_ARGS)
^~~~~~~~~~~
smc.c:384:23: note: treat the string as an argument to avoid this
sprintf(val->key, key);
^
"%s",
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:47:56: note:
expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), VA_ARGS)
^
4 warnings generated.
gcc -mmacosx-version-min=10.4 -Wall -g -framework IOKit -o smc smc.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
__start in crt1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [smc] Error 1
Michaels-iMac:smc michael$