2011-08-03 4 views
3

정말 오래된 소스 코드 (Red Hat에서 컴파일 됨)에서 작업하고 있습니다. lua-4.0.1을 설치하기 전에 최신 lua (lua-5.1.4)를 컴파일하고 이전 디렉토리와 동일한 디렉토리에 설치했습니다. 구현이 그리 크지 않기 때문에 몇 가지 함수 이름을 제외하고는 많이 변경하지 않고 컴파일하려면 "lauxlib.h"를 포함시켜야했습니다. 아무런 문제없이 컴파일되지만 이러한 연결 오류가 발생합니다.lua 4.0.1에서 5.1.4로 업그레이드 할 때 연결 오류가 발생했습니다.

/usr/local/lib/liblua.a(loadlib.o): In function `ll_load': 
loadlib.o(.text+0x19): undefined reference to `dlopen' 
loadlib.o(.text+0x2a): undefined reference to `dlerror' 
/usr/local/lib/liblua.a(loadlib.o): In function `ll_sym': 
loadlib.o(.text+0x52): undefined reference to `dlsym' 
loadlib.o(.text+0x63): undefined reference to `dlerror' 
/usr/local/lib/liblua.a(loadlib.o): In function `ll_unloadlib': 
loadlib.o(.text+0x8): undefined reference to `dlclose' 

기본적으로 모든 경로는 정확하지만 이전 플래그와 동일한 플래그를 사용합니다. makefile을 전혀 변경하지 않았습니다.

-static -lpthread -lnsl -lutil -ldl -lmysqlclient -llua -llualib -lz -lcppunit 

ldl 플래그가 이미 있습니다.

나는 시도할만한 것들을 알고 싶습니다. 모든 것이 인정됩니다. 이것은 나를 미치게 만든다.

답변

5

-ldl은 liner 명령의 끝에 있습니다. 순서가 중요합니다.

링커는 명령 줄에서 더 오른쪽에있는 libs에서만 참조되지 않은 심볼을 충족하는 라이브러리를 검색합니다. 새로운 liblua.a은 이제 dlopen 및 친구를 사용하지만 이전 버전은 사용하지 않았습니다. -ldl-llua이므로 링커는 lua 참조를 링크하는 데 libdl을 사용하지 않습니다.

관련 문제