NikitaIvanovV / ctpv

Image previews for lf file manager
https://www.nikitaivanov.com/man1/ctpv
MIT License
264 stars 24 forks source link

error: use of undeclared identifier 'SIG_ERR' #29

Closed wisonye closed 1 year ago

wisonye commented 1 year ago

Fail to compile in FreebSD:

doas gmake install

# cc -o src/config.o src/config.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# gmake -C embed
# gmake[1]: Entering directory '/usr/home/wison/temp/ctpv/embed'
# cc     embed.c   -o embed
# gmake[1]: Leaving directory '/usr/home/wison/temp/ctpv/embed'
# mkdir -p gen
# embed/embed -p prev_scr_ sh/prev/any.sh sh/prev/atool.sh sh/prev/audio.sh sh/prev/bat.sh sh/prev/cat.sh sh/prev/colordiff.sh sh/prev/delta.sh sh/prev/diff_so_fancy.sh sh/prev/elinks.sh sh/prev/font.sh sh/prev/gpg.sh sh/prev/highlight.sh sh/prev/image.sh sh/prev/jq.sh sh/prev/libreoffice.sh sh/prev/ls.sh sh/prev/lynx.sh sh/prev/mdcat.sh sh/prev/pdf.sh sh/prev/source_highlight.sh sh/prev/svg.sh sh/prev/symlink.sh sh/prev/torrent.sh sh/prev/video.sh sh/prev/w3m.sh > gen/previews.h
# cc -o src/ctpv.o src/ctpv.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# cc -o src/error.o src/error.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# cc -o src/lexer.o src/lexer.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# cc -o src/preview.o src/preview.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# embed/embed -p scr_ sh/clear.sh sh/end.sh > gen/server.h
# cc -o src/server.o src/server.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# embed/embed -p scr_ sh/helpers.sh > gen/helpers.h
# cc -o src/shell.o src/shell.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# cc -o src/ulist.o src/ulist.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# cc -o src/utils.o src/utils.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
# src/utils.c:165:20: warning: implicit declaration of function 'signal' is invalid in C99 [-Wimplicit-function-declaration]
#     ERRCHK_RET_ERN(signal(sig, handler) == SIG_ERR);
#                    ^
# src/utils.c:165:44: error: use of undeclared identifier 'SIG_ERR'
#     ERRCHK_RET_ERN(signal(sig, handler) == SIG_ERR);
#                                            ^
# 1 warning and 1 error generated.
# gmake: *** [Makefile:55: src/utils.o] Error 1


Then I try search in the whole source files:

rg SIG_ERR

# src/utils.c
# 165:    ERRCHK_RET_ERN(signal(sig, handler) == SIG_ERR);

Is it the SIG_ERR defines in OS source code somehow like a constant? or you just miss it ? :)

OS version:

uname -a

# FreeBSD my-bsd 13.1-RELEASE-p3 FreeBSD 13.1-RELEASE-p3 GENERIC amd64


NikitaIvanovV commented 1 year ago

I've just pushed a fix, could you please test it?

wisonye commented 1 year ago

I've just pushed a fix, could you please test it?

Hi, thanks for the quick fix, yup, it compiles without any problem 👍

But It still doesn't work: No image preview in lf

I setup a new issue with details and close this one, as this one only focus on compiling issue:) Thanks for your help:)