2014-09-18 27 views
0

안녕하세요 저는 cmake로 프로그램을 컴파일하려고합니다. 하지만 언제나 make install을 실행합니다. 그 오류가 발생합니다. 나는 Cmake와 함께 일한 적이 없기 때문에 나는 그 모든 것을 처음 접했습니다. PLZ 도와주세요. 여기컴파일 중 오류가 발생했습니다.

libstructure.so: undefined reference to `AptamerTree::~AptamerTree()' 
libparserfastq.so: undefined reference to `ParserMain::ProcessLaneInParallel(std::string, std::string, std::string, std::string, std::string, int)' 
libstructure.so: undefined reference to `AptamerTree::GetRoot()' 
libparserfastq.so: undefined reference to `ParserMain::ParserMain(Parameters*, std::vector<AptamerPool*, std::allocator<AptamerPool*> >*, _win_st*)' 
libparserfastq.so: undefined reference to `ParserMain::StoreStatistics()' 
libparserfastq.so: undefined reference to `ParserMain::IsGZipped(std::string)' 
libparserfastq.so: undefined reference to `ParserMain::StoreConsensusSizes()' 
libparserfastq.so: undefined reference to `ParserMain::ProcessLaneInParallel(std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string, int, int, int)' 
libparserfastq.so: undefined reference to `ParserMain::~ParserMain()' 
libstructure.so: undefined reference to `AptamerTree::AptamerTree()' 
libstructure.so: undefined reference to `AptamerTree::InsertEdge(Node*, Node*)' 
libparserfastq.so: undefined reference to `ParserMain::SetStatus(std::string, int, int)' 
libparserfastq.so: undefined reference to `ParserMain::StoreQualities()' 
libstructure.so: undefined reference to `AptamerTree::begin()' 
libparserfastq.so: undefined reference to `ParserMain::StoreFrequencies()' 
libparserfastq.so: undefined reference to `ParserMain::StoreRandomizedRegionSizes()' 
libstructure.so: undefined reference to `AptamerTree::end()' 
libstructure.so: undefined reference to `AptamerTree::CreateNode()' 
libparserfastq.so: undefined reference to `ParserMain::LogStatistics()' 
collect2: error: ld returned 1 exit status 
make[2]: *** [src/htsaptamotiftest] Error 1 
make[1]: *** [src/CMakeFiles/htsaptamotiftest.dir/all] Error 2 
make: *** [all] Error 2 

#this is just a basic CMakeLists.txt, for more information see the cmake manpage 
MESSAGE("CONFIGURING HTSAptamotif") 

# set variables required for build 
get_filename_component(PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR} PATH) 
SET(INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) 
SET(EXTERNAL_INCLUDE_PATH ${INSTALL_PATH}/include/) 
SET(EXTERNAL_LIB_PATH ${INSTALL_PATH}/lib/) 


# use, i.e. don't skip the full RPATH for the build tree 
SET(CMAKE_SKIP_BUILD_RPATH FALSE) 

# when building, don't use the install RPATH already 
# (but later on when installing) 
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 

SET(CMAKE_INSTALL_RPATH "${INSTALL_PATH}/lib") 

# add the automatically determined parts of the RPATH 
# which point to directories outside the build tree to the install RPATH 
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 


# the RPATH to be used when installing, but only if it's not a system directory 
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${INSTALL_PATH}/lib" isSystemDir) 
IF("${isSystemDir}" STREQUAL "-1") 
    SET(CMAKE_INSTALL_RPATH "${INSTALL_PATH}/lib") 
ENDIF("${isSystemDir}" STREQUAL "-1") 


# we need openMP 
INCLUDE(FindOpenMP) 
IF(OPENMP_FOUND) 
    MESSAGE(" FOUND OPENMP") 
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 
    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") 
ENDIF() 

#and ncurses 
FIND_LIBRARY(NCURSRS_PANEL_LIBRARY NAMES panel DOC "The ncureses panel library") 
INCLUDE(FindCurses) 
IF(CURSES_FOUND) 
    MESSAGE(" FOUND CURSES") 
# add panels to the library path 
    SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${NCURSRS_PANEL_LIBRARY}) 
ENDIF() 




#add definitions, compiler switches, etc. 
#-g is with debugging info. disable this for production code 
#-lprofiler uses google cpu profiler. disable for production 
# debugging flags 
ADD_DEFINITIONS(-Wall -lmysqlcppconn -std=gnu++0x -ltcmalloc -lncurses -lpanel -O2 -g -lprofiler) 
# productions flags 
# ADD_DEFINITIONS(-Wall -lmysqlcppconn -std=gnu++0x -ltcmalloc -lncurses -lpanel -O2) 
#OLD ADD_DEFINITIONS(-Wall -lncurses -lpanel -lmysqlcppconn -std=gnu++0x -O2 -g -ltcmalloc -lprofiler) 
#ADD_DEFINITIONS(-Wno-sign-compare) 

# define include and link directories 
INCLUDE_DIRECTORIES(
    ${EXTERNAL_INCLUDE_PATH} 
# /usr/local/google-perftools/1.8.2/include 
) 

LINK_DIRECTORIES(
    ${EXTERNAL_LIB_PATH} 
# /usr/local/google-perftools/1.8.2/lib 
) 


#Define non-header libs here 
MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}") 
MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") 

SET(MySQL_LIBRARIES 
    ${EXTERNAL_LIB_PATH}libmysqlcppconn.so 
) 
MESSAGE(" MySQL_LIBRARIES: ${MySQL_LIBRARIES}") 

SET(ViennaRNA_LIBRARIES 
    ${EXTERNAL_LIB_PATH}libRNA.a 
) 
MESSAGE(" ViennaRNA_LIBRARIES: ${ViennaRNA_LIBRARIES}") 

SET(GPTOOLS_LIBRARIES 
    ${EXTERNAL_LIB_PATH}libprofiler.so 
    ${EXTERNAL_LIB_PATH}libtcmalloc.so 
) 
MESSAGE(" GooglePrefTools_LIBRARIES: ${GPTOOLS_LIBRARIES}") 

MESSAGE(" Curses_LIBRARIES: ${CURSES_LIBRARIES}") 



#build the shared libraries 
ADD_LIBRARY(htsaptamotif SHARED htsaptamotif.cpp) 
ADD_LIBRARY(parameters SHARED parameters.cpp) 
ADD_LIBRARY(aptamer SHARED aptamer.cpp) 
ADD_LIBRARY(aptamertree SHARED aptamertree.cpp) 
ADD_LIBRARY(databasesocket SHARED databasesocket.cpp) 
ADD_LIBRARY(aptamerpool SHARED aptamerpool.cpp) 
ADD_LIBRARY(structure SHARED structure.cpp) 
ADD_LIBRARY(substructure SHARED substructure.cpp) 
ADD_LIBRARY(substructureensemble SHARED substructureensemble.cpp) 
# ADD_LIBRARY(aptagraph SHARED aptagraph.cpp) #templates 
ADD_LIBRARY(numericalintegrator SHARED numericalintegrator.cpp) 
# ADD_LIBRARY(mstprims SHARED mstprims.cpp) #templates 
ADD_LIBRARY(aptamotif SHARED aptamotif.cpp) 
ADD_LIBRARY(poolgenerator SHARED poolgenerator.cpp) 
ADD_LIBRARY(lshcluster SHARED lshcluster.cpp) 
ADD_LIBRARY(dnacompressor SHARED dnacompressor.cpp) 
ADD_LIBRARY(aptamercluster SHARED aptamercluster.cpp) 
ADD_LIBRARY(parsermain SHARED parsermain.cpp) 
ADD_LIBRARY(parserfastq SHARED parserfastq.cpp) 
ADD_LIBRARY(parserfasta SHARED parserfasta.cpp) 
ADD_LIBRARY(parsertext SHARED parsertext.cpp) 
#external alignment library 
ADD_LIBRARY(nwaligner SHARED ssw.c) 
ADD_LIBRARY(nwalignerwrapper SHARED ssw_cpp.cpp) 

#for testing the shared library you probably need some test app too 
ADD_EXECUTABLE(htsaptamotiftest htsaptamotiftest.cpp) 

#need to link to some other libraries ? just add them here 
TARGET_LINK_LIBRARIES(parameters ${Boost_LIBRARIES} ${GPTOOLS_LIBRARIES} ${CURSES_LIBRARIES}) 
TARGET_LINK_LIBRARIES(databasesocket ${MySQL_LIBRARIES}) 
TARGET_LINK_LIBRARIES(aptamer ${ViennaRNA_LIBRARIES}) 
TARGET_LINK_LIBRARIES(htsaptamotiftest htsaptamotif parameters databasesocket aptamerpool aptamer aptamertree aptamotif structure substructure substructureensemble numericalintegrator poolgenerator parsermain parserfastq parserfasta parsertext lshcluster dnacompressor aptamercluster nwaligner nwalignerwrapper ${GPTOOLS_LIBRARIES} ${CURSES_LIBRARIES}) #aptagraph mstprims are templates 


# compile the socket program for gui comunication 
ADD_EXECUTABLE(guisocket guisocket.cpp) 
TARGET_LINK_LIBRARIES(guisocket ${Boost_LIBRARIES} parameters) 

#add and install target here 
INSTALL(TARGETS htsaptamotiftest htsaptamotif parameters databasesocket aptamerpool aptamer aptamertree structure substructure substructureensemble numericalintegrator aptamotif poolgenerator parsermain parserfastq parsertext parserfasta lshcluster dnacompressor aptamercluster nwaligner nwalignerwrapper guisocket 
    RUNTIME DESTINATION ${INSTALL_PATH}/bin 
    LIBRARY DESTINATION ${INSTALL_PATH}/lib 
    ARCHIVE DESTINATION ${INSTALL_PATH}/lib 
) 

어떤 생각이 문제를 해결하는 방법 년대 Cmakelist.txt입니까?

+0

"make install"전에 "make"를 실행 했습니까? –

+2

@MarcoA : Cmake는'설치'가'모두'에 의존하지 않는다는 벙어리가 아닙니다. ;-) – DevSolar

+1

"컴파일 중 오류 발생"은 모순입니다. 'ld'는 컴파일러가 아닌 링커이고, 컴파일하는 동안 링커 에러를 얻을 수 없습니다. – Griwes

답변

3

모든 yout 바이너리를 사용하는 모든 라이브러리와 링크해야합니다. libstructurelibparserfastq은 오류에 언급 된 기호가 포함 된 라이브러리와 연결되지 않은 것일 가능성이 큽니다. 해당 라이브러리에 적절한 TARGET_LINK_LIBRARIES 명령을 추가해야합니다.

관련 문제