rover
rover copied to clipboard
Compilation error on OpenBSD
When running make, I get the following error:
Package ncursesw was not found in the pkg-config search path
I have plenty of other programs on my machine that use ncursesw and have compiled them before, so I'm not sure what the issue would be here.
The issue is that the Makefile relies on pkg-config to get the necessary compilation and linking flags for the ncurses library. This does not work on OpenBSD because there is no pkg-config metadata for ncurses on OpenBSD.
TLDR; Try running the following command:
cc -o rover rover.c -lcurses
Indeed, pkg-config is useless here. Use the following diff to edit Makefile:
diff --git a/Makefile b/Makefile
index c2890fe..d589e2c 100644
--- a/Makefile
+++ b/Makefile
@@ -8,13 +8,12 @@ CFLAGS ?= -O2
PKG_CONFIG ?= pkg-config
-CFLAGS_NCURSESW := `$(PKG_CONFIG) --cflags ncursesw`
-LIBS_NCURSESW := `$(PKG_CONFIG) --libs ncursesw`
+LIBS_NCURSESW := -lncursesw
all: rover
rover: rover.c config.h
- $(CC) $(CFLAGS) $(CFLAGS_NCURSESW) -o $@ $< $(LDFLAGS) $(LIBS_NCURSESW)
+ $(CC) $(CFLAGS) $(LIBS_NCURSESW) -o $@ $< $(LDFLAGS)
install: rover
rm -f $(DESTDIR)$(BINDIR)/rover