leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
450 stars 50 forks source link

make fails, on OS X, with use of sigtimedwait in filter.c #27

Closed larryhynes closed 7 years ago

larryhynes commented 7 years ago

With the addition of sigtimedwait to filter.c, make fails on OS X:

cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o maddr.o maddr.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o blaze822.o blaze822.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mymemmem.o mymemmem.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mytimegm.o mytimegm.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o seq.o seq.c
seq.c:518:38: warning: missing field 'cur' initializer [-Wmissing-field-initializers]
        struct blaze822_seq_iter iter = { 0 };
                                            ^
1 warning generated.
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o slurp.o slurp.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o rfc2047.o rfc2047.c
cc   maddr.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o rfc2047.o  -L/usr/local/lib -liconv -o maddr
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o magrep.o magrep.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o rfc2045.o rfc2045.c
cc   magrep.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o rfc2047.o rfc2045.o  -L/usr/local/lib -liconv -o magrep
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mdate.o mdate.c
cc   mdate.o  -L/usr/local/lib -liconv -o mdate
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mdeliver.o mdeliver.c
mdeliver.c:82:16: warning: format specifies type 'long' but the argument has type '__darwin_suseconds_t' (aka 'int') [-Wformat]
                         tv.tv_sec, tv.tv_usec, (long)getpid(), delivery, host);
                                    ^~~~~~~~~~
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
1 warning generated.
cc   mdeliver.o blaze822.o mymemmem.o mytimegm.o  -L/usr/local/lib -liconv -o mdeliver
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mdirs.o mdirs.c
cc   mdirs.o  -L/usr/local/lib -liconv -o mdirs
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mexport.o mexport.c
cc   mexport.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o  -L/usr/local/lib -liconv -o mexport
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mflag.o mflag.c
cc   mflag.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o  -L/usr/local/lib -liconv -o mflag
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mgenmid.o mgenmid.c
cc   mgenmid.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o  -L/usr/local/lib -liconv -o mgenmid
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mhdr.o mhdr.c
cc   mhdr.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o rfc2047.o  -L/usr/local/lib -liconv -o mhdr
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o minc.o minc.c
cc   minc.o  -L/usr/local/lib -liconv -o minc
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mlist.o mlist.c
cc   mlist.o seq.o slurp.o  -L/usr/local/lib -liconv -o mlist
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mmime.o mmime.c
cc   mmime.o slurp.o  -L/usr/local/lib -liconv -o mmime
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mpick.o mpick.c
mpick.c:523:21: warning: missing field 'tm_min' initializer [-Wmissing-field-initializers]
        struct tm tm = { 0 };
                           ^
1 warning generated.
cc   mpick.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o rfc2047.o  -L/usr/local/lib -liconv -o mpick
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mscan.o mscan.c
cc   mscan.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o rfc2047.o  -L/usr/local/lib -liconv -o mscan
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o msed.o msed.c
cc   msed.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o  -L/usr/local/lib -liconv -o msed
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mseq.o mseq.c
mseq.c:311:38: warning: missing field 'cur' initializer [-Wmissing-field-initializers]
        struct blaze822_seq_iter iter = { 0 };
                                            ^
1 warning generated.
cc   mseq.o seq.o slurp.o  -L/usr/local/lib -liconv -o mseq
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o mshow.o mshow.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o filter.o filter.c
filter.c:108:2: warning: implicit declaration of function 'sigtimedwait' is invalid in C99 [-Wimplicit-function-declaration]
        sigtimedwait(&mask, 0, &immediately);
        ^
1 warning generated.
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o safe_u8putstr.o safe_u8putstr.c
cc -g -O2 -Wall -Wno-switch -Wextra -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include   -c -o rfc2231.o rfc2231.c
cc   mshow.o blaze822.o mymemmem.o mytimegm.o seq.o slurp.o rfc2047.o rfc2045.o filter.o safe_u8putstr.o rfc2231.o  -L/usr/local/lib -liconv -o mshow
Undefined symbols for architecture x86_64:
  "_sigtimedwait", referenced from:
      _filter in filter.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mshow] Error 1
leahneukirchen commented 7 years ago

Which OS X did you use again?

larryhynes commented 7 years ago

10.10.5 (Yosemite) AKA the most recent least awful one. ;^)

leahneukirchen commented 7 years ago

I guess we could hack around it using sigpending. Can you verify you have man 2 sigpending?

larryhynes commented 7 years ago

Yup, do have. (Sorry about this!)

leahneukirchen commented 7 years ago

Try the lastest commit.

larryhynes commented 7 years ago

It builds! 'xcellent, thanks, sorry for being a thorn in your side.

leahneukirchen commented 7 years ago

more importantly, does it work? ;)

larryhynes commented 7 years ago

Well, on my most recent 'complicated' received email, filter seems to be doing its thing perfectly:

--- --- --- 5: image/jpeg size=48430 render="gm identify -format "%m %b %q-bit %Gpx %Qquality %C" -" ---
JPEG 47.3Ki 8-bit 1229x283px 70quality JPEG
--- --- 6: application/pdf size=802387 render="file -b -" ---
PDF document, version 1.4
--- --- 7: application/pdf size=454921 render="file -b -" ---
PDF document, version 1.4
--- --- 8: application/pdf size=89255 render="file -b -" ---
PDF document, version 1.4
--- --- 9: application/postscript size=1390 render="file -b -" ---
PostScript document text
--- --- 10: image/png size=1090 render="gm identify -format "%m %b %q-bit %Gpx %Qquality %C" -" ---
PNG 1.1Ki 8-bit 305x121px 75quality Zip
--- --- 11: application/postscript size=1398 render="file -b -" ---
PostScript document text
--- --- 12: image/png size=1107 render="gm identify -format "%m %b %q-bit %Gpx %Qquality %C" -" ---
PNG 1.1Ki 8-bit 305x121px 75quality Zip

That is with an admittedly modest ~/.mblaze/filter of:

text/html: lynx -dump -stdin -nomargins -width=60 ${PIPE_CHARSET:+-assume_charset $PIPE_CHARSET}
image: gm identify -format "%m %b %q-bit %Gpx %Qquality %C" -
application: file -b -
leahneukirchen commented 7 years ago

Good, thanks. file will trigger the SIGPIPE case.