ns_initparse linking 에러
제 문제와 동일한 문제가 포스팅 되어 있는게 있어서 그 내용을 올려놓겠습니다.
간단히 내용을 말씀드리면 ns_initparse 를 링크시에 찾지 못하는 건데요. 밑에 보시면 아시겠지만 분명히 libresolv 에 함수가 들어있는데도 이런 문제가 발생하네요. 그럼 많은 도움 부탁드리겠습니다. 감사합니다.
-------------------------------------------------------------------------------------
Can someone help me out with the following problem?
The problem is that when I try to compile a program which queries name servers, it fails at the linking stage with the message "undefined reference to `__ns_initparse'" and I cannot understand why. Here's the info:
[eric sirius gethostinfo]$ gcc -Wall -g -o gethostinfo gethostinfo.c -lresolv
/tmp/ccX1YbrX.o: In function `main':
/home/eric/src/gethostinfo/gethostinfo.c:41: undefined reference to `__ns_initparse'
collect2: ld returned 1 exit status
[eric sirius gethostinfo]$ strings --print-file-name /lib/*|grep ns_initparse
/lib/libresolv-2.2.4.so: __ns_initparse
/lib/libresolv-2.2.4.so: ;; ns_initparse: %s
/lib/libresolv.so.2: __ns_initparse
/lib/libresolv.so.2: ;; ns_initparse: %s
So... I am linking against the resolver library, according to what I see the ns_initparse function is in there and yet it cannot find it..... Same is the case for other functions like ns_parserr() etc. What's the catch here?
I'm using standard RedHat issue glibc-2.2.4-32 and gcc-2.96-112.7.2. Compiling using gcc version 3 (gcc3-3.0.4-1) gives exactly the same results:
[eric sirius gethostinfo]$ gcc3 -Wall -g -o gethostinfo gethostinfo.c -lresolv
/tmp/ccSWrvut.o: In function `main':
/home/eric/src/gethostinfo/gethostinfo.c:41: undefined reference to `__ns_initparse'
collect2: ld returned 1 exit status
I'm clueless, who knows what is going on here?
To make things complete, here's the source code, try for yourself:


댓글 달기