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

build script fails on newer version of MacOS #38

Open
tustin2121 opened this issue Jan 23, 2021 · 17 comments
Open

build script fails on newer version of MacOS #38

tustin2121 opened this issue Jan 23, 2021 · 17 comments

Comments

@tustin2121
Copy link

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.

@luckytyphlosion
Copy link
Member

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.

@luckytyphlosion
Copy link
Member

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?

@luckytyphlosion
Copy link
Member

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)

@luckytyphlosion
Copy link
Member

(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.

@Manurocker95
Copy link

Manurocker95 commented Mar 12, 2021

Facing same issues on Macbook Pro M1 (Apple Silicon) with Big Sur 11.2.1, any updates?

@LucaBGt
Copy link

LucaBGt commented Mar 12, 2021

MacBook Pro with Big Sur 11.2.2 here, same issue.

@pizza2004
Copy link

pizza2004@870e987

This commit makes it build, but it catches somewhere else and I cannot figure out why.

pizza2004 added a commit to pizza2004/agbcc that referenced this issue Mar 19, 2021
@Manurocker95
Copy link

pizza2004@870e987

This commit makes it build, but it catches somewhere else and I cannot figure out why.

Not working for me:

image

@pizza2004
Copy link

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.

@Manurocker95
Copy link

Manurocker95 commented Mar 29, 2021

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

@pizza2004
Copy link

I'm not sure, I just know that's what luckytyphlosion was talking about on the Discord.

@Manurocker95
Copy link

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 :/

@luckytyphlosion
Copy link
Member

I am lazy and busy, ask in 3-4 weeks when I'll have more time :trollface:

@Manurocker95
Copy link

I am lazy and busy, ask in 3-4 weeks when I'll have more time :trollface:

what about now (?)

@luckytyphlosion
Copy link
Member

Join the Discord (check any one of the decompilation readmes) and I can help resolve the macOS problem.

@TGFbSMAD
Copy link

TGFbSMAD commented Jul 7, 2021

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)

@rawr51919
Copy link

Fixed in #39

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

7 participants