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

Maybe necessary to link with tinfo? #35

Open
larsbrinkhoff opened this issue Aug 7, 2024 · 4 comments · May be fixed by #36
Open

Maybe necessary to link with tinfo? #35

larsbrinkhoff opened this issue Aug 7, 2024 · 4 comments · May be fixed by #36

Comments

@larsbrinkhoff
Copy link
Member

larsbrinkhoff commented Aug 7, 2024

@ams and @drforbin, please continue discussion here. I'm curious why -ltinfo would be needed now, when it was not the case before. Please elaborate.

See also: PDP-10/its#2322

@johnsonjh
Copy link
Contributor

Depending on the way nurses was compiled, linking libtinfo may be necessary. If you use pkg-config to get the libraries to link, it does usually include tinfo:

$ pkg-config --libs ncurses
-lncurses -ltinfo
$ pkg-config --libs ncursesw
-lncursesw -ltinfo

@johnsonjh
Copy link
Contributor

Instead of using -lncurses you could do something like:

diff --git a/Makefile b/Makefile
index a2941f5..6d17b53 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,13 @@
 # Makefile for the supdup server and client.

+SHELL = /bin/sh
 PREFIX ?= /usr/local

 OS_NAME = $(shell uname)
 ifeq ($(OS_NAME), Darwin)
 OS = OSX
 endif

 CC = cc
 CFLAGS = -g -Wall
 LDFLAGS = -g
@@ -14,21 +15,21 @@ LDFLAGS = -g
 # Mac OSX
 ifeq ($(OS), OSX)
 LDFLAGS = -L/opt/local/lib
 endif

 # The server isn't ready for prime time.
 all:   supdup

 SUPDUP_OBJS = supdup.o charmap.o tcp.o chaos.o
 supdup: $(SUPDUP_OBJS)
-       $(CC) $(LDFLAGS) -o $@ $(SUPDUP_OBJS) -lncurses
+       $(CC) $(LDFLAGS) -o $@ $(SUPDUP_OBJS) $(shell pkg-config --libs ncurses 2> /dev/null || echo '-lncurses')

 SUPDUPD_OBJS = supdupd.o
 supdupd: $(SUPDUPD_OBJS)
        $(CC) $(LDFLAGS) -o $@ $(SUPDUPD_OBJS)

 install: supdup
        install -m 0755 supdup $(PREFIX)/bin
        test -x supdupd && install -m 0755 supdupd $(PREFIX)/bin

 clean:

This is GNU syntax, but that should be fine, as the Makefile doesn't work under bmake currently anyway.

@johnsonjh
Copy link
Contributor

johnsonjh commented Aug 7, 2024

I made a PR at #36

Linux/musl, NetBSD, OpenBSD, AIX, and Haiku now work; they didn't before.

@ams
Copy link
Contributor

ams commented Aug 8, 2024

I cannot explain why things changed, but historically -lcurses also needs -ltinfo for various stupid reasons to just be sure -- sometimes even -ltermcap. It has always been a hit and miss.

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

Successfully merging a pull request may close this issue.

3 participants