aligrudi / neatroff_make

Neatroff top-level makefile
50 stars 15 forks source link

Cannot make due to issues with `pic` #2

Closed remorse closed 5 years ago

remorse commented 5 years ago

Hi! I'm on Mac OS X 10.13. When I try to make the tools, I get an error when it's trying to compile picy.c. I'm afraid I don't know enough C to understand what is going on, but it looks might be a conflict of some sort with the OS version of sprintf? (I've included the output below, as well as the version of the compiler.) Please let me know if I can help fix this?

Thanks, Ricky

$ git clone https://github.com/aligrudi/neatroff_make.git
...
$ cd neatroff_make
$ make init
...
$ make neat
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" roff.c
roff.c:34:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stderr, msg);
                        ^~~
roff.c:34:18: note: treat the string as an argument to avoid this
        fprintf(stderr, msg);
                        ^
                        "%s",
1 warning generated.
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" dev.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" font.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" in.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" cp.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" tr.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" ren.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" out.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" reg.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" sbuf.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" fmt.c
fmt.c:454:15: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int'
      which may cause truncation of value [-Wabsolute-value]
        long ratio = abs((llen - lwid) * 100l / (swid ? swid : 1));
                     ^
fmt.c:454:15: note: use function 'labs' instead
        long ratio = abs((llen - lwid) * 100l / (swid ? swid : 1));
                     ^~~
                     labs
1 warning generated.
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" eval.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" draw.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" wb.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" hyph.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" map.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" clr.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" char.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" dict.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" iset.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" "-DTROFFMDIR=\"/Users/rem16/git/neatroff_make/tmac\"" dir.c
cc -o roff roff.o dev.o font.o in.o cp.o tr.o ren.o out.o reg.o sbuf.o fmt.o eval.o draw.o wb.o hyph.o map.o clr.o char.o dict.o iset.o dir.o
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" post.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" ps.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" font.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" dev.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" clr.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" dict.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" iset.c
cc -o post post.o ps.o font.o dev.o clr.o dict.o iset.o
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" pdf.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" pdfext.c
cc -c -Wall -O2 "-DTROFFFDIR=\"/Users/rem16/git/neatroff_make/\"" sbuf.c
cc -o pdf post.o pdf.o pdfext.o font.o dev.o clr.o dict.o iset.o sbuf.o
cc -c -Wall -O2 eqn.c
eqn.c:530:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
        fprintf(stderr, msg);
                        ^~~
eqn.c:530:18: note: treat the string as an argument to avoid this
        fprintf(stderr, msg);
                        ^
                        "%s",
1 warning generated.
cc -c -Wall -O2 tok.c
cc -c -Wall -O2 src.c
cc -c -Wall -O2 def.c
cc -c -Wall -O2 box.c
cc -c -Wall -O2 reg.c
cc -c -Wall -O2 sbuf.c
cc -o eqn eqn.o tok.o src.o def.o box.o reg.o sbuf.o
cc -c -O2 -Wall mkfn.c
cc -c -O2 -Wall trfn.c
cc -c -O2 -Wall sbuf.c
cc -c -O2 -Wall tab.c
cc -c -O2 -Wall afm.c
cc -c -O2 -Wall otf.c
cc -o mkfn mkfn.o trfn.o sbuf.o tab.o afm.o otf.o
cc -c -Wall -O2 refer.c
cc -o refer refer.o
cc -c -Wall -O2 picy.c
picy.c:795:3: error: unterminated function-like macro invocation
{ ERROR "syntax error" WARNING; } break;
  ^
./pic.h:13:15: note: expanded from macro 'ERROR'
#define ERROR   sprintf(errbuf,
                ^
/usr/include/secure/_stdio.h:46:9: note: macro 'sprintf' defined here
#define sprintf(str, ...) \
        ^
picy.c:1094:2: error: expected '}'
}
 ^
picy.c:795:1: note: to match this '{'
{ ERROR "syntax error" WARNING; } break;
^
picy.c:1094:2: error: expected '}'
}
 ^
picy.c:792:14: note: to match this '{'
        switch(yym) {
                    ^
picy.c:1094:2: error: expected '}'
}
 ^
picy.c:641:1: note: to match this '{'
{
^
picy.c:662:9: warning: array index -1 is before the beginning of the array [-Warray-bounds]
        yyp = &yys[-1];
               ^   ~~
picy.c:642:2: note: array 'yys' declared here
        struct
        ^
1 warning and 4 errors generated.
make[1]: *** [picy.o] Error 1
make: *** [neat] Error 2
$
$ cc --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
aligrudi commented 5 years ago

Ricky Morse notifications@github.com wrote:

Hi! I'm on Mac OS X 10.13. When I try to make the tools, I get an error when it's trying to compile picy.c. I'm afraid I don't know enough C to understand what is going on, but it looks might be a conflict of some sort with the OS version of sprintf? (I've included the output below, as well as the version of the compiler.) Please let me know if I can help fix this?

The pic preprocessor that neatroff_make builds is a port of Plan 9 pic, which does not seem to work with the LLVM compiler. The main problem seems to be the ERROR macro. I have removed it; please try again.

Ali
remorse commented 5 years ago

Thanks! That made it work! (There are still a lot of warnings, but most of those don't seem to be concerning...)