atextor / icat

icat (Image cat) outputs images in 256-color capable terminals.
152 stars 12 forks source link

Compilation failed on MacOS #18

Closed aerogus closed 1 year ago

aerogus commented 1 year ago

I had an error at compilation time with MacOS Ventura, Apple Silicon, homebrew with Imlib2 dependency installed.

% make
cc -c -Wall -pedantic -std=c99 -D_DEFAULT_SOURCE -I/opt/homebrew/include/X11 `pkg-config --cflags Imlib2` -o icat.o icat.c
In file included from icat.c:39:
/opt/homebrew/Cellar/imlib2/1.10.0/include/Imlib2.h:45:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^~~~~~~~~~~~
1 error generated.
make: *** [icat.o] Error 1

I modified the Makefile this way :

-       CFLAGS:=$(CFLAGS) -I/opt/X11/include `pkg-config --cflags Imlib2`
+       CFLAGS:=$(CFLAGS) -I/opt/homebrew/include `pkg-config --cflags Imlib2`

Now the compilation is ok 👍

% make
cc -c -Wall -pedantic -std=c99 -D_DEFAULT_SOURCE -I/opt/homebrew/include `pkg-config --cflags Imlib2` -o icat.o icat.c
cc -o icat icat.o  `pkg-config --libs Imlib2`

Hope it helps...

atextor commented 1 year ago

Hi @aerogus, thanks for the info. Is that the regular path that includes X11/Xlib.h on MacOS? Would pkg-config --cflags x11 output this path on the Mac?

aerogus commented 1 year ago

I can't reproduce the bug today but I've done some brew upgrade this week. Now with a fresh repo clone the compile is ok ...

% make
cc -c -Wall -pedantic -std=c99 -D_DEFAULT_SOURCE -I/opt/X11/include `pkg-config --cflags Imlib2` -o icat.o icat.c
cc -o icat icat.o  `pkg-config --libs Imlib2`

and the output of your command:

% pkg-config --cflags x11
-I/usr/local/Cellar/libx11/1.8.3/include -I/usr/local/Cellar/libxcb/1.15/include -I/usr/local/Cellar/libxau/1.0.11/include -I/usr/local/Cellar/libxdmcp/1.1.4/include -I/usr/local/Cellar/xorgproto/2022.2/include
atextor commented 1 year ago

Then I guess we can close this. Feel free to reopen again if needed.