rover icon indicating copy to clipboard operation
rover copied to clipboard

Compilation error on OpenBSD

Open swindlesmccoop opened this issue 3 years ago • 2 comments

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.

swindlesmccoop avatar Sep 05 '22 01:09 swindlesmccoop

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

thimc avatar Nov 03 '23 17:11 thimc

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

B4rb3rouss avatar Jul 04 '24 08:07 B4rb3rouss