-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
There were three problems; more details below:
gccisclang, doesn't support nested functions.poptis missing.getrandom()doesn't exist.
gcc is clang
By default, gcc on macOS refers to clang, which doesn't support nested functions:
image.c:1067:4: error: function definition is not allowed here
1067 | { // Safe colour check of pixel
| ^
image.c:1079:14: error: call to undeclared function 'col'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1079 | if (col (x, y) != c)
| ^
image.c:1150:4: error: function definition is not allowed here
1150 | {
| ^
image.c:1163:7: error: call to undeclared function 'addcolour'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1163 | addcolour (0);
| ^
image.c:1172:10: error: call to undeclared function 'addcolour'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1172 | addcolour (c);
| ^
5 errors generated.
To fix this, I installed gcc 15, using brew install gcc. Unfortunately, this doesn't provide a gcc binary, so I couldn't just mess with $PATH. Instead I had to edit the Makefiles to reference $(CC) instead of gcc and then run it with CC=$(brew --prefix gcc)/bin/gcc-15 make.
popt is missing
To fix it:
brew install popt.- Edit the Makefiles to add
-I/opt/homebrew/opt/popt/include -L/opt/homebrew/opt/popt/lib. I'm unsure whether this could be done with an environment variable instead.
getrandom
There's no getrandom() function in <sys/random.h>.
So I stubbed it out at the top of the qr.c file with the following:
ssize_t
getrandom(void *buf, size_t buflen, unsigned int flags) {
return -1;
}
Metadata
Metadata
Assignees
Labels
No labels