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

Add -lresolv on Darwin #695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add -lresolv on Darwin #695

wants to merge 1 commit into from

Conversation

cptaffe
Copy link
Contributor

@cptaffe cptaffe commented Feb 4, 2025

On macOS 15.2, -lresolv is required to resolve symbols like _res_9_dn_expand:

; cd src/cmd/upas
; mk install
for i in common smtp alias fs ned q send marshal vf misc
do
	(cd $i; echo cd `pwd`';' mk $MKFLAGS install; mk $MKFLAGS install)
done
cd /Users/cptaffe/src/plan9port/src/cmd/upas/common; mk install
mk: 'install' is up to date
cd /Users/cptaffe/src/plan9port/src/cmd/upas/smtp; mk install
for i in smtp smtpd
do
	mk $MKFLAGS $i.install
done
9c -I../common -DSPOOL="/Users/cptaffe/src/plan9port/mail" rfc822.tab.c
9l -o o.smtp rfc822.tab.o mxdial.o smtp.o ../common/libcommon.a
Undefined symbols for architecture arm64:
  "_res_9_dn_expand", referenced from:
      _doquery in libndb.a[18](sysdnsquery.o)
      _doquery in libndb.a[18](sysdnsquery.o)
      _rrunpack in libndb.a[18](sysdnsquery.o)
  "_res_9_search", referenced from:
      _doquery in libndb.a[18](sysdnsquery.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mk: 9l -o o.smtp ...  : exit status=exit(1)
mk: for i in ...  : exit status=exit(1)
mk: for i in ...  : exit status=exit(1)

On macOS 15.2, -lresolv is required to resolve symbols like `_res_9_dn_expand`
@@ -31,6 +31,7 @@ case "$tag" in
;;
*Darwin*)
ld="${CC9:-gcc} -m64 $CC9FLAGS"
extralibs="-lresolv"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cause any unintended side effects on earlier versions of macOS?

Copy link
Contributor Author

@cptaffe cptaffe Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, I don't have a machine running an older version. Is it possible to branch based on version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like -lresolv has been in use as far back as OS X 10.6, to fix this exact linker error, see here.

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 this pull request may close these issues.

2 participants