Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build smc.c on Monterey #136

Open
mwkchan opened this issue Feb 27, 2022 · 0 comments
Open

Cannot build smc.c on Monterey #136

mwkchan opened this issue Feb 27, 2022 · 0 comments

Comments

@mwkchan
Copy link

mwkchan commented Feb 27, 2022

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$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant