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

How to compile this program on Big Sur? #8

Open
prRZ5F4LXZ opened this issue Jun 29, 2021 · 1 comment
Open

How to compile this program on Big Sur? #8

prRZ5F4LXZ opened this issue Jun 29, 2021 · 1 comment

Comments

@prRZ5F4LXZ
Copy link

My OS is Big Sur. I got the following error. Does anybody know how to fix it?

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ make
cd awka; make
make[1]: Entering directory '/tmp/awka/awka'
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o translate.o translate.c
translate.c:111:11: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
  while(c = *p++){
        ~~^~~~~~
translate.c:111:11: note: place parentheses around the assignment to silence this warning
  while(c = *p++){
          ^
        (       )
translate.c:111:11: note: use '==' to turn this assignment into an equality comparison
  while(c = *p++){
          ^
          ==
1 warning generated.
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o awka.o awka.c
expect 8 shift/reduce conflicts
bison -y  -d parse.y
parse.y: warning: 8 shift/reduce conflicts [-Wconflicts-sr]
parse.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
mv y.tab.c parse.c
if cmp -s y.tab.h parse.h ;\
then rm y.tab.h ;\
else mv y.tab.h parse.h ; fi
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o parse.o parse.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o scan.o scan.c
scan.c:1128:19: warning: initializing 'unsigned char *' with an expression of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
   unsigned char *s = e_flag ? rm_escape(string_buff) : string_buff ;
                  ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scan.c:1130:34: warning: passing 'unsigned char *' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
   yylval.ptr = (PTR) new_STRING(s);
                                 ^
./memory.h:35:33: note: passing argument to parameter here
STRING *PROTO(new_STRING, (char*)) ;
                                ^
2 warnings generated.
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o memory.o memory.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o hash.o hash.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o code.o code.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o bi_funct.o bi_funct.c
bi_funct.c:164:27: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
            while (target = strchr(target, k))
                   ~~~~~~~^~~~~~~~~~~~~~~~~~~
bi_funct.c:164:27: note: place parentheses around the assignment to silence this warning
            while (target = strchr(target, k))
                          ^
                   (                         )
bi_funct.c:164:27: note: use '==' to turn this assignment into an equality comparison
            while (target = strchr(target, k))
                          ^
                          ==
bi_funct.c:172:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
   while (target = strchr(target, k))
          ~~~~~~~^~~~~~~~~~~~~~~~~~~
bi_funct.c:172:18: note: place parentheses around the assignment to silence this warning
   while (target = strchr(target, k))
                 ^
          (                         )
bi_funct.c:172:18: note: use '==' to turn this assignment into an equality comparison
   while (target = strchr(target, k))
                 ^
                 ==
2 warnings generated.
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o da.o da.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o error.o error.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o init.o init.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o bi_vars.o bi_vars.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o cast.o cast.c
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\"   -c -o print.o print.c
print.c:52:11: error: expected parameter declarator
int PROTO(sprintf, (char *, const char *,...)) ;
          ^
print.c:52:11: error: expected ')'
print.c:52:11: note: to match this '('
print.c:52:11: error: conflicting types for '__builtin___sprintf_chk'
int PROTO(sprintf, (char *, const char *,...)) ;
          ^
print.c:52:11: note: '__builtin___sprintf_chk' is a builtin with type 'int (char *, int, unsigned long, const char *, ...)'
3 errors generated.
make[1]: *** [<builtin>: print.o] Error 1
make[1]: Leaving directory '/tmp/awka/awka'
make: *** [Makefile:48: awka_exe] Error 2
@prRZ5F4LXZ
Copy link
Author

On MacOS, the lines 48-53 in awka/print.c can be commented out like this to make the compilation successful. It seems that the current configure file has trouble to deal with stdio.h on MacOS. But I am not sure what is the best way to fix this problem. Somebody who is more familar with configure may have a better fix.

48 //#ifdef NO_FPRINTF_IN_STDIO
49 //int PROTO(fprintf, (FILE *, const char *,...)) ;
50 //#endif
51 //#ifdef NO_SPRINTF_IN_STDIO
52 //int PROTO(sprintf, (char *, const char *,...)) ;
53 //#endif

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