2015-04-05 32 views
14

Tôi đã cài đặt Qt5.4 bằng trình cài đặt trực tuyến (làm việc trên ubuntu 14). Tôi đang cố gắng để biên dịch c của tôi ++ nguồn và liên kết chống lại libQt5Core nhưng ld ném một lỗi:Liên kết với libQt5Core

make 
g++ -Wall test.o Party.o Communication.o FileParser.o PeerConnection.o ServerModule.o Utilities.o -o party -g -L/home/bush/Qt/5.4/gcc_64/lib -L/usr/lib/x86_64-linux-gnu/ -lQt5Core -lboost_system -lpthread 
/usr/bin/ld: warning: libicui18n.so.53, needed by /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link) 
/usr/bin/ld: warning: libicuuc.so.53, needed by /home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link) 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_setMillis_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_fromUnicode_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_get_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_inDaylightTime_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_open_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_countAvailable_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_countAliases_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_errorName_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openCountryTimeZones_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_strToUpper_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getDefaultName_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `uenum_next_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_strcoll_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getMaxCharSize_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getAvailableName_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_open_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getTimeZoneDisplayName_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_toUnicode_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `uenum_close_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_getSortKey_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getAlias_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_close_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_setAttribute_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_close_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openTimeZoneIDEnumeration_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_openTimeZones_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_getStandardName_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucol_close_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_compareNames_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_clone_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `u_strToLower_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getDefaultTimeZone_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_open_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucnv_setSubstChars_53' 
/home/bush/Qt/5.4/gcc_64/lib/libQt5Core.so: undefined reference to `ucal_getDSTSavings_53' 
collect2: error: ld returned 1 exit status 
make: *** [party] Error 1 

makefile của tôi là:

CPPFLAGS=-g -c --std=c++0x -I/usr/include -I/home/bush/Qt/5.4/gcc_64/include -I/home/bush/Qt/5.4/gcc_64/include/QtCore -I/usr/include/boost 
LDFLAGS=-g -L/home/bush/Qt/5.4/gcc_64/lib -L/usr/lib/x86_64-linux-gnu/ -lQt5Core -lboost_system -lpthread 

all:party 

party:test.o Party.o Communication.o FileParser.o PeerConnection.o ServerModule.o Utilities.o 
    g++ -Wall $^ -o party $(LDFLAGS) 

test.o:test.cpp 
    g++ $(CPPFLAGS) test.cpp 
Party.o:Party.cpp 
    g++ $(CPPFLAGS) Party.cpp 
Communication.o:Communication.cpp 
    g++ $(CPPFLAGS) Communication.cpp 
FileParser.o:FileParser.cpp 
    g++ -fPIC $(CPPFLAGS) FileParser.cpp 
PeerConnection.o:PeerConnection.cpp 
    g++ $(CPPFLAGS) PeerConnection.cpp 
ServerModule.o:ServerModule.cpp 
    g++ $(CPPFLAGS) ServerModule.cpp 
Utilities.o:Utilities.cpp 
    g++ $(CPPFLAGS) Utilities.cpp 
+0

OS không thể tìm thấy thư viện ICU v53 (qt có liên quan đối với phiên bản đó), kiểm tra cho 'libicui18n' trong'/usr/lib64' – gengisdave

+0

Không thư viện như vậy .. – Bush

+0

Bạn có thể giải quyết cài đặt nó, hoặc nếu bạn có một phiên bản khác của icu, giả mạo nó với một liên kết tượng trưng – gengisdave

Trả lời

-1

Cố gắng thêm -licuuc đến LDFLAGS của makefile.

sudo apt-get install libicu-dev
3

Trong trường hợp của tôi, nó hoạt động sau khi tôi tạo 3 liên kết tượng trưng. Các lib đã được cài đặt nhưng tôi đã có một phiên bản mới hơn (55) so với dự kiến ​​(54).

sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicui18n.so.54 /usr/lib/x86_64-linux-gnu/libicui18n.so.54 
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicuuc.so.54 /usr/lib/x86_64-linux-gnu/libicuuc.so.54 
sudo ln -s /usr/local/Qt/5.5/gcc_64/lib/libicudata.so.54 /usr/lib/x86_64-linux-gnu/libicudata.so.54 
0

Tôi gặp phải lỗi này khi tôi cố gắng xây dựng Iris dưới Ubuntu. Tôi đã giải quyết nó bằng cách xóa CONFIG + = static từ tệp .pro

11

Tôi gặp phải vấn đề tương tự. nhưng tôi tìm đường ra chỉ bằng mã này.

export LD_LIBRARY_PATH=/usr/local/Qt/5.5/gcc_64/lib:$LD_LIBRARY_PATH 
+1

hoặc bất kỳ đường dẫn nào bạn đã cài đặt Qt ... nhưng, có, công trình này và là câu trả lời đúng. –

+1

Có, đây là câu trả lời đúng nhưng sử dụng đường dẫn cài đặt cụ thể của bạn như đã đề cập trước đây. Tôi thấy rằng chạy "ldd libQt5Core.so.Tôi nghĩ rằng những gì đang xảy ra (chắc chắn đối với tôi) là khi thực thi chính được xây dựng runpath thư viện của elf được thiết lập để vị trí chính xác để libQt5Core được tìm thấy ok.Tuy nhiên, khi libQt5Core lần lượt cố gắng tìm SO ở trên nó không thành công vì nó không có đường dẫn chạy và không có LD_LIBRARY_PATH – mark

3

Tôi gặp lỗi như vậy khi cố gắng xây dựng dự án của mình dưới Debian 8 (với libicu52 từ kho chính thức) từ QtCreator. Tôi đã giải quyết nó bằng cách thay đổi 'Môi trường' cho Kit Qt (5.8.0) thành: LD_LIBRARY_PATH =/opt/Qt/5.8/gcc_64/lib: $ {LD_LIBRARY_PATH}.

Screenshot: Changes marked by red line