agbcc
agbcc copied to clipboard
build script fails on newer version of MacOS
On MacOS Catalina and above, builds of the agbcc project always fail. Several people have reported this problem in various places in the discord server, myself being one of them.
Symptoms generally include the build.sh script failing partway through with the following error:
gcc -MT toplev.o -MMD -MP -MF .d/toplev.Td -g -std=gnu11 -DOLD_COMPILER -I/usr/local/opt/qt/include -I. -I. -c toplev.c
toplev.c:1048:11: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
error(message);
^~~~~~~
toplev.c:1048:11: note: treat the string as an argument to avoid this
error(message);
^
"%s",
toplev.c:2382:13: error: implicit declaration of function 'unlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
unlink(aux_info_file_name);
^
toplev.c:2390:13: error: implicit declaration of function 'unlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
unlink(offset_info_file_name);
^
toplev.c:3486:14: warning: 'sizeof (indep_options)' will return the size of the pointer, not the array itself [-Wsizeof-pointer-div]
for (k = NUM_ELEM(indep_options); k--; )
^~~~~~~~~~~~~~~~~~~~~~~
toplev.c:728:34: note: expanded from macro 'NUM_ELEM'
#define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))
~~~~~~~~~~ ^
toplev.c:3441:32: note: pointer 'indep_options' declared here
lang_independent_options * indep_options;
^
2 warnings and 2 errors generated.
make: *** [toplev.o] Error 1
and/or attempt to call make
on one of pret's projects failing with the following error:
clang: error: unknown argument: '-Map'
The problem may lie in the fact that mac uses clang for its implementation of gcc, but simply installing gcc via homebrew does not fix the problem. Manually bypassing clang (by setting CC
to a specific version installed via homebrew like gcc-9
or gcc-10
) seems to function as a workaround in the meantime.
Ideally, the build script should deal with the potential problem and either fix or give instructions for fixing the problem. Failing that, some sort of documentation on how to set up agbcc on new MacOS would help greatly.
unlink
is supposed to be included in <unistd.h>
. Looking through the commit history, <unistd.h>
was never included in the first place, and I'm not sure why the gcc developers at the time didn't include it. Try including <unistd.h>
and see if that helps.
I tried installing Clang on WSL1 (both Clang 10 and Clang 12), and I didn't seem to get the error. Clang simply treated it as a warning. The only way I could get it to error is by explicitly setting -Werror-implicit-function-declaration
. I don't know why it's erroring for some users. Perhaps it has something to do with the default CFLAGS?
From: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes
Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)
(Should have posted in the above message <:masuda:544196054740893706>) So the solution is either to add -Wno-implicit-function-declaration
, or to actually fix the implicit function declarations. Vestaiden in Discord tried the immediate solution of #include <unistd.h>
but that only caused further issues.
Facing same issues on Macbook Pro M1 (Apple Silicon) with Big Sur 11.2.1, any updates?
MacBook Pro with Big Sur 11.2.2 here, same issue.
https://github.com/pizza2004/agbcc/commit/870e98780af6df3076d65d4c2af5251f0e4f5de2
This commit makes it build, but it catches somewhere else and I cannot figure out why.
This commit makes it build, but it catches somewhere else and I cannot figure out why.
Not working for me:

I never encountered anything like that and I'm not really equipped to tell you why it's happening either. Apparently downloading gmake and gcc will make it function like on other systems and it'll no longer be a problem, so I guess that's the solution now.
I never encountered anything like that and I'm not really equipped to tell you why it's happening either. Apparently downloading gmake and gcc will make it function like on other systems and it'll no longer be a problem, so I guess that's the solution now.
Any tutorial to how to configure them on macos?
Because I'm supposed to have GNU Make 3.81 and the latest gcc-arm-none-eabi
I'm not sure, I just know that's what luckytyphlosion was talking about on the Discord.
I'm not sure, I just know that's what luckytyphlosion was talking about on the Discord.
His repo doesn't allow issues and Pret hasn't updated this issue so I guess I'm stuck :/
I am lazy and busy, ask in 3-4 weeks when I'll have more time :trollface:
I am lazy and busy, ask in 3-4 weeks when I'll have more time :trollface:
what about now (?)
Join the Discord (check any one of the decompilation readmes) and I can help resolve the macOS problem.
Segfault seems to be specific to Macs with M1 Tried to ./build.sh on three differents macs running Big Sur 11.4, had no success with the M1 one (segfault 11)
Fixed in #39