2011-02-06 23 views
12

Tôi đang xây dựng một ứng dụng C++, sử dụng Netbeans 6.9 làm IDE của tôi. có một thư viện C++ mà là một wrapper xung quanh một thư viện C tinh khiết/usr/bin/ld: cảnh báo: abc.so, cần thiết bởi xyz.so không tìm thấy (thử sử dụng -rpath hoặc -rpath-link) "

tôi đã thêm một cách chính xác các tập tin vào dự án (sử dụng Thêm tùy chọn file Library) đây là kết quả sản xuất bởi g ++ và mối liên kết:..

g++ -o dist/Debug/GNU-Linux-x86/testluaembed build/Debug/GNU-Linux-x86/src/main.o build/Debug/GNU-Linux-x86/src/LuaBinding.o -L../../mainline/tanlib_core/dist/Debug/GNU-Linux-x86 -L../../mainline/tanlib++/dist/Debug/GNU-Linux-x86 -L/usr/lib ../../mainline/tanlib_core/dist/Debug/GNU-Linux-x86/libtanlib_core.so ../../mainline/tanlib++/dist/Debug/GNU-Linux-x86/libtanlibpp.so /usr/lib/liblua5.1.a /usr/lib/libtolua++5.1.a /usr/local/boost_1_45_0/stage/lib/libboost_filesystem.a /usr/local/boost_1_45_0/stage/lib/libboost_system.a 
/usr/bin/ld: warning: libtanlib_core.so, needed by ../../mainline/tanlib++/dist/Debug/GNU-Linux-x86/libtanlibpp.so, not found (try using -rpath or -rpath-link) 
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc': 
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc': 
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc': 
/usr/lib/liblua5.1.a(loadlib.o): In function `ll_loadfunc': 
/usr/lib/liblua5.1.a(loadlib.o): In function `gctm': 
collect2: ld returned 1 exit status 
make[2]: *** [dist/Debug/GNU-Linux-x86/testluaembed] Error 1 
make[1]: *** [.build-conf] Error 2 
make: *** [.build-impl] Error 2 

tôi chạy ldd trên thư viện wrapper C++ và có sản lượng này:

$ldd libtanlibpp.so 
    linux-vdso.so.1 => (0x00007fff123c0000) 
    libtanlib_core.so => not found 
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fe4f0fde000) 
    libm.so.6 => /lib/libm.so.6 (0x00007fe4f0d5a000) 
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fe4f0b43000) 
    libc.so.6 => /lib/libc.so.6 (0x00007fe4f07c0000) 
    /lib64/ld-linux-x86-64.so.2 (0x00007fe4f15ee000) 

Vì vậy, mặc dù các tập tin tồn tại trên máy tính của tôi, nó xuất hiện nó không phải là trong bộ nhớ cache thư viện của tôi. Tôi đã thử bằng cách sử dụng ldconfig, nhưng vấn đề vẫn còn. Bất kỳ ý tưởng về cách giải quyết này?

Trả lời

6

Đảm bảo thư mục nơi libtanlib_core.so được đặt được định cấu hình trong /etc/ld.so.conf (hoặc /etc/ld.so.conf.d/) - nếu không ldconfig sẽ không tìm thấy.

+0

Tôi nghi ngờ đây là sự cố cấu hình. Làm thế nào để "Hãy chắc chắn rằng thư mục nơi libtanlib_core.so được đặt được cấu hình trong /etc/ld.so.conf" ?. Bạn có thể giải thích làm thế nào tôi sẽ đặt thư mục đó trong ld.so.conf ?. Tôi chỉ cần chỉnh sửa thủ công tệp hoặc tôi có cần sử dụng công cụ không? – oompahloompah

+0

@oompahloompah Chỉnh sửa thủ công sẽ thực hiện công việc –

+0

Cảm ơn bạn. Tôi đã thử nó và nó đã hoạt động. – oompahloompah

Các vấn đề liên quan