Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error on OpenBSD #42

Open
swindlesmccoop opened this issue Sep 5, 2022 · 2 comments
Open

Compilation error on OpenBSD #42

swindlesmccoop opened this issue Sep 5, 2022 · 2 comments

Comments

@swindlesmccoop
Copy link

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.

@thimc
Copy link

thimc commented Nov 3, 2023

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

@B4rb3rouss
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants