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

Undefined reference to '__dn_expand' #1

Closed
victorhooi opened this issue Aug 24, 2012 · 3 comments
Closed

Undefined reference to '__dn_expand' #1

victorhooi opened this issue Aug 24, 2012 · 3 comments

Comments

@victorhooi
Copy link

Hi,

I'm attempting to compile sods on Ubuntu 11.10 (AMD64), and I am getting the following error:

~/sods/sods$ make
gcc -DHAVE_ERR -DHAVE_SEND -lresolv -g -Wall -o sods sods.c sods_handler.c sods_dns.c sods_io.c                 sods_q.c sods_sock.c sods_priv.c sods_err.c base32.c base64.c
/tmp/cc2CTnFv.o: In function `sds_dns_getdn':
/home/victorhooi/sods/sods/sods_dns.c:82: undefined reference to `__dn_expand'
collect2: ld returned 1 exit status
make: *** [all] Error 1

Any ideas?

Cheers,
Victor

@victorhooi
Copy link
Author

Hi,

Hmm, I found that manually adding "-lresolv" to the end of the GCC line in the Makefile works - however, "-lresolv" is already party of the LIB line, so I'm not sure why it didn't work there?

CC=gcc                                                                                                                                                                               
RM=rm                                                                                                                                                                                
APP=sods                                                                                                                                                                             

DEF=-DHAVE_ERR -DHAVE_SEND                                                                                                                                                           
LIB=-lresolv                                                                                                                                                                         

all:                                                                                                                                                                                 
    $(CC) $(DEF) $(LIB) -g -Wall -o sods sods.c sods_handler.c sods_dns.c sods_io.c         sods_q.c sods_sock.c sods_priv.c sods_err.c base32.c base64.c -lresolv                   

clean:                                                                                                                                                                               
    -@$(RM) sods *.o 

Cheers,
Victor

@msantos
Copy link
Owner

msantos commented Aug 24, 2012

Hey Victor! Try adding the path to libresolv.a. This works for me:

gcc -DHAVE_ERR -DHAVE_SEND -g -Wall -o sods sods.c sods_handler.c sods_dns.c sods_io.c sods_q.c sods_sock.c sods_priv.c sods_err.c base32.c base64.c /usr/lib/x86_64-linux-gnu/libresolv.a

@msantos
Copy link
Owner

msantos commented Aug 24, 2012

Just saw your update, thanks! That is even better! I will update the configure script.

@msantos msantos closed this as completed Aug 24, 2012
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

2 participants